Remove MemberName Object Ref from Stack in OpenJDK MethodHandle linkTo* INL Methods #22112
+7
−19
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.
When calling the various linkTo methods (namely
linkToStatic()
,linkToSpecial()
,linkToVirtual()
,linkToInterface()
), the JIT must pass in aMemberName
object whichlinkTo*()
expects to be at_sp[0]
. ThelinkTo*()
methods use the MN to find the target method, after which it is not needed. So, before running the target, we move the MN to_sp[methodArgCount]
, wheremethodArgCount
is the argument count of the target method.This creates problems on x86, where we pass arguments on the stack. For cases where the target is not compiled, we must transition into the VM to link using one of the
linkTo*()
methods (as opposed to running usingdispatch*()
directly from the JIT'ed code). But if the invocation in the VM triggers a recompilation, only the arguments of the target are popped before returning, and not the MN . This means the MN will still be on the stack upon return from the target, and eventually ends up in the pc since the arguments to the helper are assumed to have been cleaned up.For the case where the target is still interpreted, we still only pop target's args before returning to the JIT and again the MN is still on the stack.
This PR changes the
linkTo*()
methods to pop the MN from the stack as it is not used by the target.#18751