[GR-51002] Improve intrinsification of method handles. #8109
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.
This PR solves the orders-of-magnitude performance difference for equals/hashCode methods of records. I plan to merge this also into the GraalVM 24.0 release, and later on backport to GraalVM 23.1.
The biggest change is around the inlining policy for the special "method handle intrinsification" mode of inline-before-analysis:
@LambdaForm.Compiled
annotated methods, and remains only active for@LambdaForm.Compiled
and@ForceInline
annotated methods (with a few exception). That seems to work surprisingly well.Other notable changes:
VarHandle
, we need to constant-foldMethodHandle.asType
when all arguments are constants. That needed some relaxing of checks inReflectionPlugins
, allowed parameter types are all subtypes of our manually listed types.For images with JIT compilation, we still use the old method handle intrinsification. Still, I think the new one is now also more correct, with the annotation-based distinction we can also reliably start the method handle intrinsification when trivial inlining is done as part of inline-before-analysis. But I did not experiment at all enabling the mode for images with JIT compilation.