Perf/tiered compile once body retention - #3
Merged
Merged
Conversation
Each lazy function's optimised body lives in a once-cell, filled by the first caller under the scratch lock, and every compile path (requester, broker, optimize_function, record_call, late resume points, closure promotion) reads it through tier_body. A region cut from a body already through the pipeline takes only the finishing passes and the entry cleanup; a region of a lowered body is outlined once per loop. The LLVM tier gets the Arc it is handed, and a reload swaps the cells. git-bug: 73e6e26fd19da79528b2bafffa99d1b4de019d1298246dbfd5afa52cd7621920
A frame of a function with loops holds the body the body source gave while it runs, so a resume point it asks for is made from that body whatever the runtime keeps. Bytecode whose body nobody holds is made again. The runtime is told when the first frame returns and may let the body, and the bytecode, go.
The scratch module copies in only the bodies an optimisation reaches through direct calls and is dropped once no optimisation is under way and no compile waits. An interp body goes once its function has native code, or when a large body's first frame returns; an optimised body goes after the ladder's last compile unless it is small enough to be inlined. A frame still running a body finds it, and a body asked for again is made again, once per cell. git-bug: 08988fa9d5b1d1f4ef42a0f9281172a42e87167a460a92dadc84c5972840ebee
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.