[GR-68488] Extend JVMCI to express fixed binding #7
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.
See https://bugs.openjdk.org/browse/JDK-8364670 for a detailed description.
This PR adapts JVMCI such that it binds (or attaches) certain Java methods at the call site.
Binding a method at the call site means we save the
Method*
extracted from the code stream in the relocation information.By binding a method at the call site we want to override the usual call site resolution when the target of the call instruction is patched.
The current implementation does the computation if a method needs to be bound at the call site in
jvmciCodeInstaller.cpp
.A method needs to be bound if:
Hotspot already provides us with functionality to replace a method handle with the resolved method in sharedRuntime.cpp. We only need to bind the method to trigger this functionality.
To handle the case that the reexecute bit is set we need to introduce our own logic in sharedRuntime.cpp. We use the reexecute bit to indicate that the call is side-effect free and that the call resolution should not use the symbol information to extract the method. This is necessary as the bci may not point to an invoke bytecode. This will allow Graal to directly call the Truffle safepoint without having to go through a stub, see link We are allowed to use the reexecute bit as it is always set to false when we invoke a Java method. This is necessary as Hotspot expects the bci to point to the invoke bytecode.