Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for VarHandle's MethodType table only when necessary #20329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nbhuiyan
Copy link
Member

@nbhuiyan nbhuiyan commented Oct 10, 2024

A VarHandle can be initialized such that its access mode method invocation behaves like a MethodHandle.invokeExact invocation. We can check if this is the case by checking whether the VarHandle.exact field was set to true. In such a case, an additional check is necessary, where we need to verify whether AccessDescriptor.symbolicMethodTypeExact field matches the corresponding entry in the MethodType table, failing which the JIT should abort trying to lookup the MethodHandle table.

The MethodType table would only be initialized for a VarHandle if the VarHandle.exact field was initialized as true. Therefore, by moving the check for whether the MethodType table is valid to occur only after we confirm that the VarHandle has invokeExact behaviour, we prevent prematurely aborting the MH entry lookup in getMethodHandleTableEntryIndex when the MT table is not initialized.

A VarHandle can be initialized such that its access mode method
invocation behaves like a MethodHandle.invokeExact invocation.
We can check if this is the case by checking whether the
VarHandle.exact field was set to true. In such a case, an additional
check is necessary, where we need to verify whether
AccessDescriptor.symbolicMethodTypeExact field matches the
corresponding entry in the MethodType table, failing which the
JIT should abort trying to lookup the MethodHandleTable.

The MethodType table would only be initialized for a VarHandle
if the VarHandle.exact field was initialized as true. Therefore,
by moving the check for whether the MethodType table is valid
to occur only after we confirm that the VarHandle has
invokeExact behaviour, we prevent prematurely aborting the MH
entry lookup in getMethodHandleTableEntryIndex when the MT
table is not initialized.

Signed-off-by: Nazim Bhuiyan <[email protected]>
@nbhuiyan
Copy link
Member Author

@jdmpapin Requesting your review.

@jdmpapin jdmpapin requested review from jdmpapin and removed request for dsouzai October 10, 2024 18:17
@jdmpapin
Copy link
Contributor

Jenkins test sanity all jdk17

@jdmpapin
Copy link
Contributor

Jenkins test sanity alinux,xlinux jdk17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants