<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - NewRegexp should not prevent inlining"
   href="https://bugs.webkit.org/show_bug.cgi?id=154808#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - NewRegexp should not prevent inlining"
   href="https://bugs.webkit.org/show_bug.cgi?id=154808">bug 154808</a>
              from <span class="vcard"><a class="email" href="mailto:fpizlo&#64;apple.com" title="Filip Pizlo &lt;fpizlo&#64;apple.com&gt;"> <span class="fn">Filip Pizlo</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=154808#c9">comment #9</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=154808#c8">comment #8</a>)
&gt; &gt; Comment on <span class=""><a href="attachment.cgi?id=286601&amp;action=diff" name="attach_286601" title="Patch">attachment 286601</a> <a href="attachment.cgi?id=286601&amp;action=edit" title="Patch">[details]</a></span>
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; You shouldn't be adding any new fields to CodeBlock. 
&gt; &gt; 
&gt; &gt; The DFG already has a mechanism for strongly marking objects known to the
&gt; &gt; compiler such as the RegExps. It's called freezing: just do
&gt; &gt; m_graph.freezeStrongly(...). 
&gt; &gt; 
&gt; &gt; You don't need to record the RegExp object anywhere other than the NewRegExp
&gt; &gt; node. That node should not have an index into any vectors. It should just
&gt; &gt; hold a pointer to RegExp. We already do this for other node types. See for
&gt; &gt; example Node::cellOperand(). Notice that its already compatible with
&gt; &gt; freezing.
&gt; 
&gt; Thank you for this info. I really didn't know about that. I took a look in
&gt; code using the freezing and it looks simpler and more correct than my
&gt; current patch. Just for curiosity, as I understood, this Freeze mechanism
&gt; interact with the GC, right? If yes, How does it happen?</span >

There's a lot of logic there:

- Freezing causes the resulting CodeBlock to have either a strong or weak reference to the frozen object, depending on whether you froze it strongly or weakly.

- Freezing immediately causes the ongoing DFG compilation plan to track the reference if a GC happens while the compiler is running.  The GC knows how to safepoint the compiler.  This means that from the compiler's standpoint, GCs can only happen at well-defined points: either before the compiler started, during B3 compilation, or after the compiler finished.

There are a lot of other details; I can't remember all of them off the top of my head.  The short version is just: we already use freezing a lot, and it's designed exactly for what you want: you have some object that the generated code will refer to and you want to make sure that this object gets marked.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>