Hoist proto_version load. #121
Merged
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.
Before this commit, we loaded a closure's
proto_versionon every iteration of the loop, which leads to a guard in every opcode in a trace.This commit hoists that load out to the only point where that value can change -- the
startfunc/returnlabel(s). These are where a new closure is dealt with (e.g. as a result ofOP_CALL). Although we still have to callyk_promotefor every opcode, the trace optimiser has a much easier job, because this tends to stay in a variable -- in general it can now remove 1 guard for all but the first opcode. Across several benchmarks I've looked at, this leads to a 2-6% increase.