Repository navigation
[JSC] CodeBlock aging: refresh the execution-counter snapshot on every look, not only past the TTL #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[JSC] CodeBlock aging: refresh the execution-counter snapshot on every look, not only past the TTL #566
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Moving the counter snapshot ahead of the TTL gate means
m_previousCounter = currentCountis now written during marking on every look, soupdateActivity()'s laterm_previousCounter < counttest is always false andm_unlinkedCode->resetAge()is never called for LLInt/Baseline/DFG blocks; underuseUnlinkedCodeBlockJettisoning(mini/no-JIT mode) the UnlinkedCodeBlock's age hitsmaxAgeafter ~7 GCs and dies the moment its CodeBlock ages out, forcing a full re-parse on the next call where the base branch kept the bytecode cached. Fix: haveupdateActivity()decide activity from the flag this pass already computed (e.g. reset age whenevershouldJettisonDueToOldAgerenewed the lease) instead of re-comparingm_previousCounter.Extended reasoning...
shouldJettisonDueToOldAge()runs from the executable'svisitChildrenduring marking; with the reorder, an unmarked LLInt/Baseline block whose counter moved hits line 1431 and storesm_previousCounter = currentCountbefore the TTL early-out. The block is then strongly visited (line 1298 returns true), added to the CodeBlock set (line 1278), and at GC endreconcileWeakReferencesAtGCEnd→updateActivity()(guarded byVM::useUnlinkedCodeBlockJettisoning(), true when!useJIT()orforceMiniVMMode) reads the same counter intocountand testsm_previousCounter < countat CodeBlock.cpp:1988 — now always equal, soresetAge()at 1990 is skipped. On the base branch the TTL gate returned before touchingm_previousCounter, soupdateActivity()still saw the previous GC's snapshot, observed movement, and reset the UnlinkedCodeBlock's age each collection (only the single renewal GC per lease skipped it). After the change nothing ever resetsm_age;UnlinkedCodeBlock::visitChildren(UnlinkedCodeBlock.cpp:103) increments it every GC tomaxAge=7, and once the CodeBlock finally…Verification: normal — the reorder introduces a regression the base does not have, in the
VM::useUnlinkedCodeBlockJettisoning()configuration (VM.h:766-769 →!useJIT() || forceMiniVMMode() || Options::useUnlinkedCodeBlockJettisoning()). Mechanism, verified against both branches: -ScriptExecutable::visitCodeBlockEdge(ScriptExecutable.cpp:565) callsshouldVisitStrongly()during marking, which at…