<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>245321</bug_id>
          
          <creation_ts>2022-09-17 11:45:13 -0700</creation_ts>
          <short_desc>Ran clang-tidy on JSC, WTF and bmalloc</short_desc>
          <delta_ts>2022-10-06 09:44:01 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>REOPENED</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=245874</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>245874</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Mikhail R. Gadelha">mikhail</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1899232</commentid>
    <comment_count>0</comment_count>
    <who name="Mikhail R. Gadelha">mikhail</who>
    <bug_when>2022-09-17 11:45:13 -0700</bug_when>
    <thetext>The following checks were used:
    
    * modernize-use-default-member-init
    * readability-redundant-member-init
    * modernize-use-equals-default
    * performance-trivially-destructible
    
    Some interesting points:
    
    1. No all constants were moved to move inits: stuff like UINT_MAX are
    not actually constant in the platform that I run clang-tidy (linux 64bit),
    so these had to be moved manually.
    2. modernize-use-equals-default tried to set default to constructors and
    destructors of unions, which broke compilation.
    3. Some constructros were left with an empty body so the compiler
    doesn&apos;t complain about unused variable for classes like AllowUnfinalizedAccessScope
    4. In the struct BranchTarget (DFGNode.h), a float (count) was being
    initialized using a pure NaN (double). While gcc didn&apos;t complain when it was done
    in the constructor initializer list, it started to warn about fp narrowing.
    So I manually changed the init value to use the NAN macro.
    5. Some enums were not moved from the initializer list, I&apos;m not sure
    why. I did my best to manually move as many as I could find but is
    highly likely that a few remain.
    6. Windows doesn&apos;t seem to support default member initializer for a member of an
    anonymous struct within a union, so these had to be removed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899329</commentid>
    <comment_count>1</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-09-18 06:43:30 -0700</bug_when>
    <thetext>Committed 254605@main (700ac83f17d8): &lt;https://commits.webkit.org/254605@main&gt;

Reviewed commits have been landed. Closing PR #3500 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899330</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-09-18 06:44:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/100089222&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902415</commentid>
    <comment_count>3</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2022-09-30 12:11:49 -0700</bug_when>
    <thetext>This caused a regression on ARM 32bit -- SIGILL during WebProcess startup.
I&apos;ve split this patch into multiple pieces, WebKit main + only the bmalloc/ portion of this patch is enough to have WebProcess constantly abort with SIGILL.

It&apos;s hard to produce actual stacktraces, as I have to selectively build certain files with debug symbols, a full WebKit debug or RelWithDebInfo builds leads to large libWPEWebKit.so, exceeding &gt; 2GB, not possible to use as-is on embedded.

Anyhow, I&apos;m 100% certain by bisect that this commit is guilty and we&apos;re likely facing a compiler problem, since by code inspection I cannot find anything suspicious in the clang-tidy-patch itself.

However the patch already triggered a debug compilation problem with clang10, where KeyValuePairs &quot;= default&quot; constructor leads to a compilation error, whereas using &quot; { }&quot; instead works fine :/

Looking forward to nail down the culprit within the Source/bmalloc/ changes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902416</commentid>
    <comment_count>4</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2022-09-30 12:12:13 -0700</bug_when>
    <thetext>I&apos;ll reopen this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903597</commentid>
    <comment_count>5</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-10-05 16:41:16 -0700</bug_when>
    <thetext>(In reply to Nikolas Zimmermann from comment #3)
&gt; This caused a regression on ARM 32bit -- SIGILL during WebProcess startup.
&gt; I&apos;ve split this patch into multiple pieces, WebKit main + only the bmalloc/
&gt; portion of this patch is enough to have WebProcess constantly abort with
&gt; SIGILL.
&gt; 
&gt; It&apos;s hard to produce actual stacktraces, as I have to selectively build
&gt; certain files with debug symbols, a full WebKit debug or RelWithDebInfo
&gt; builds leads to large libWPEWebKit.so, exceeding &gt; 2GB, not possible to use
&gt; as-is on embedded.
&gt; 
&gt; Anyhow, I&apos;m 100% certain by bisect that this commit is guilty and we&apos;re
&gt; likely facing a compiler problem, since by code inspection I cannot find
&gt; anything suspicious in the clang-tidy-patch itself.
&gt; 
&gt; However the patch already triggered a debug compilation problem with
&gt; clang10, where KeyValuePairs &quot;= default&quot; constructor leads to a compilation
&gt; error, whereas using &quot; { }&quot; instead works fine :/
&gt; 
&gt; Looking forward to nail down the culprit within the Source/bmalloc/ changes.

Let&apos;s revert this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903613</commentid>
    <comment_count>6</comment_count>
    <who name="Mikhail R. Gadelha">mikhail</who>
    <bug_when>2022-10-05 17:13:06 -0700</bug_when>
    <thetext>Hey Yusuke, I&apos;ll help Nikolas debugging the issue, please wait a couple of days before reverting it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903614</commentid>
    <comment_count>7</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-10-05 17:13:38 -0700</bug_when>
    <thetext>(In reply to Mikhail R. Gadelha from comment #6)
&gt; Hey Yusuke, I&apos;ll help Nikolas debugging the issue, please wait a couple of
&gt; days before reverting it.

It is not OK. The latest watchOS is build is already broken, which needs to be fixed ASAP.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903619</commentid>
    <comment_count>8</comment_count>
    <who name="Mikhail R. Gadelha">mikhail</who>
    <bug_when>2022-10-05 17:19:57 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #7)
&gt; (In reply to Mikhail R. Gadelha from comment #6)
&gt; &gt; Hey Yusuke, I&apos;ll help Nikolas debugging the issue, please wait a couple of
&gt; &gt; days before reverting it.
&gt; 
&gt; It is not OK. The latest watchOS is build is already broken, which needs to
&gt; be fixed ASAP.

I&apos;ll work on it.

Also, is there a log of the watchOS crash?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903622</commentid>
    <comment_count>9</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-10-05 17:23:48 -0700</bug_when>
    <thetext>(In reply to Mikhail R. Gadelha from comment #8)
&gt; (In reply to Yusuke Suzuki from comment #7)
&gt; &gt; (In reply to Mikhail R. Gadelha from comment #6)
&gt; &gt; &gt; Hey Yusuke, I&apos;ll help Nikolas debugging the issue, please wait a couple of
&gt; &gt; &gt; days before reverting it.
&gt; &gt; 
&gt; &gt; It is not OK. The latest watchOS is build is already broken, which needs to
&gt; &gt; be fixed ASAP.
&gt; 
&gt; I&apos;ll work on it.
&gt; 
&gt; Also, is there a log of the watchOS crash?

I&apos;m seeing the changes in detail right now, and seeing a bit wrong changes in various places. For example, JSC::UnlinkedFunctionExecutable::m_features&apos; initialization look missing. Unused `m_spillStateForJSGetterSetter` field is added in AccessGenerationState, etc.
So you need to split the changes and we need careful review for each change. I&apos;ll revert it now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903689</commentid>
    <comment_count>10</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2022-10-06 01:33:24 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #9)
&gt; (In reply to Mikhail R. Gadelha from comment #8)
&gt; &gt; (In reply to Yusuke Suzuki from comment #7)
&gt; &gt; &gt; (In reply to Mikhail R. Gadelha from comment #6)
&gt; &gt; &gt; &gt; Hey Yusuke, I&apos;ll help Nikolas debugging the issue, please wait a couple of
&gt; &gt; &gt; &gt; days before reverting it.
&gt; &gt; &gt; 
&gt; &gt; &gt; It is not OK. The latest watchOS is build is already broken, which needs to
&gt; &gt; &gt; be fixed ASAP.
&gt; &gt; 
&gt; &gt; I&apos;ll work on it.
&gt; &gt; 
&gt; &gt; Also, is there a log of the watchOS crash?
&gt; 
&gt; I&apos;m seeing the changes in detail right now, and seeing a bit wrong changes
&gt; in various places. For example, JSC::UnlinkedFunctionExecutable::m_features&apos;
&gt; initialization look missing. Unused `m_spillStateForJSGetterSetter` field is
&gt; added in AccessGenerationState, etc.
&gt; So you need to split the changes and we need careful review for each change.
&gt; I&apos;ll revert it now.

Thanks Yusuke, I&apos;ve aleady had a hard time splitting up the patch into more smaler pieces, to continue my bisect within the patch... :/

I agree it is easier to revert it, and reland smaller -- after the SIGILL is understood.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903705</commentid>
    <comment_count>11</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2022-10-06 02:49:31 -0700</bug_when>
    <thetext>I&apos;ve nailed this down to either the change to Gigacache.cpp or IsoDirectory.h.
Background: I reverted the whole patch, and only added Source/bmalloc changes - SIGILL fired. Then reverted file-by-file until only 3 files were left. Then reverted the changes to Gigacache.cpp / IsoDirectory.h and the SIGILL is gone.

clang10 choked also on debug builds on another file where s/= default;/= {}/ fixed the build -- from that I suspect clang10 has an issue with these contstructs, therefore most likely IsoDirectory.h is causing some misbehavior / compiler bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1903779</commentid>
    <comment_count>12</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2022-10-06 09:44:01 -0700</bug_when>
    <thetext>BTW the change is reverted in https://github.com/WebKit/WebKit/commit/aabfacb8cf9ca4780d20ce2cca233f7988e994e2</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>