Bug 231209 - CodeBlock should not add/remove LoopHintExecutionCounters.
Summary: CodeBlock should not add/remove LoopHintExecutionCounters.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-04 22:08 PDT by Mark Lam
Modified: 2021-10-05 12:20 PDT (History)
6 users (show)

See Also:


Attachments
proposed patch. (6.49 KB, patch)
2021-10-04 22:21 PDT, Mark Lam
no flags Details | Formatted Diff | Diff
proposed patch. (6.49 KB, patch)
2021-10-04 22:23 PDT, Mark Lam
sbarati: review+
Details | Formatted Diff | Diff
patch for landing. (6.63 KB, patch)
2021-10-04 23:06 PDT, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2021-10-04 22:08:58 PDT
This is because cached unlinked baseline JIT code would retain a pointer to those counters.  Hence, the UnlinkedCodeBlock should do the add /remove of the counters instead.

rdar://83571235
Comment 1 Mark Lam 2021-10-04 22:21:34 PDT
Created attachment 440157 [details]
proposed patch.
Comment 2 Mark Lam 2021-10-04 22:23:55 PDT
Created attachment 440158 [details]
proposed patch.
Comment 3 Saam Barati 2021-10-04 22:45:07 PDT
Comment on attachment 440158 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=440158&action=review

r=me

> Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:144
> +    void finalize();

Suggestion: “finalize” has some common meaning in cells, typically meaning doing some finalization work at the end of GC. Because of that, I’m not a fan of this name. And right now, it’s only doing one very specific thing. I suggest giving it a specific name to match the specific thing it’s doing.
Comment 4 Saam Barati 2021-10-04 22:45:13 PDT
Comment on attachment 440158 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=440158&action=review

r=me

> Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:144
> +    void finalize();

Suggestion: “finalize” has some common meaning in cells, typically meaning doing some finalization work at the end of GC. Because of that, I’m not a fan of this name. And right now, it’s only doing one very specific thing. I suggest giving it a specific name to match the specific thing it’s doing.
Comment 5 Mark Lam 2021-10-04 22:55:36 PDT
Thanks for the review.

(In reply to Saam Barati from comment #4)
> > Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:144
> > +    void finalize();
> 
> Suggestion: “finalize” has some common meaning in cells, typically meaning
> doing some finalization work at the end of GC. Because of that, I’m not a
> fan of this name. And right now, it’s only doing one very specific thing. I
> suggest giving it a specific name to match the specific thing it’s doing.

I've renamed it to initializeLoopHintExecutionCounter(), and changed it to be called only when Options::returnEarlyFromInfiniteLoopsForFuzzing() is true.
Comment 6 Mark Lam 2021-10-04 23:06:27 PDT
Created attachment 440160 [details]
patch for landing.
Comment 7 EWS 2021-10-05 12:20:36 PDT
Committed r283567 (242532@main): <https://commits.webkit.org/242532@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 440160 [details].