GH-118093: Handle some polymorphism before requiring progress in tier two#122843
Uh oh!
There was an error while loading. Please reload this page.
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.
Despite our best intentions, we currently don't handle polymorphism at all in tier two, since our current forward progress requirement means that we need to deopt the first instruction of every new trace.
This changes our trace stitching for side exits to not require progress until a certain tree depth is reached (currently four). It also changes the optimizer to rejoin with any traces encountered during projection, since this does a better job of keeping us on trace in loops (we can take four side exits per iteration before requiring progress) and keeps the amount of tier two code from exploding.
As a simple microbenchmark, this goes from ~10% slower when run with the JIT enabled to ~25% faster after this change.
Overall, the benchmarks are 0.6% faster, including nice improvements on all of our interpreter-heavy benchmarks. The stats show that we're actually executing more traces and a bit (~1%) more tier one code now, but that's expected since side exit chains require up to 4x as much "warming up" as before.