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

Update MethodHandleNatives_getMemberVMInfo to work with MemberName.vminfoIsConsistent #13877

Closed
babsingh opened this issue Nov 8, 2021 · 0 comments · Fixed by #13890
Closed
Labels
comp:vm jdk18 project:MH Used to track Method Handles related work

Comments

@babsingh
Copy link
Contributor

babsingh commented Nov 8, 2021

Refer to #13852 (comment). Reproducing the AssertionError in the comment highlights the incompatibility between MethodHandleNatives_getMemberVMInfo and MemberName.vminfoIsConsistent.

This error is seen while building jdk-next (JDK18).

Related: #13852

MethodHandleNatives_getMemberVMInfo

Java_java_lang_invoke_MethodHandleNatives_getMemberVMInfo(JNIEnv *env, jclass clazz, jobject self)

MemberName.vminfoIsConsistent

https://github.com/ibmruntimes/openj9-openjdk-jdk/blob/a3abf3d6e8a2600f6ec7b73936f57d6e5442428e/src/java.base/share/classes/java/lang/invoke/MemberName.java#L338

AssertionError

Exception in thread "(unnamed thread)" java/lang/AssertionError: -1:jdk.internal.module.ModulePath.lambda$readExplodedModule$9(Path)Set/invokeVirtual
	at java/lang/invoke/MemberName.vminfoIsConsistent (java.base@18/MemberName.java:350)
	at java/lang/invoke/MemberName$Factory.resolve (java.base@18/MemberName.java:1099)
	at java/lang/invoke/MemberName$Factory.resolveOrFail (java.base@18/MemberName.java:1114)
	at java/lang/invoke/MethodHandles$Lookup.resolveOrFail (java.base@18/MethodHandles.java:3681)
	at java/lang/invoke/MethodHandles$Lookup.linkMethodHandleConstant (java.base@18/MethodHandles.java:4175)
	at java/lang/invoke/MethodHandleNatives.linkMethodHandleConstant (java.base@18/MethodHandleNatives.java:612)
	at java/lang/invoke/MethodHandleResolver.sendResolveMethodHandle (java.base@18/MethodHandleResolver.java:267)
	at java/lang/invoke/MethodHandleResolver.getCPMethodHandleAt (java.base@18/NativeMethod:4294967295)
	at java/lang/invoke/MethodHandleResolver.getAdditionalBsmArg (java.base@18/MethodHandleResolver.java:384)
	at java/lang/invoke/MethodHandleResolver.resolveInvokeDynamic (java.base@18/MethodHandleResolver.java:182)
	at jdk/internal/module/ModulePath.readExplodedModule (java.base@18/ModulePath.java:689)
	at jdk/internal/module/ModulePath.readModule (java.base@18/ModulePath.java:320)
	at jdk/internal/module/ModulePath.scanDirectory (java.base@18/ModulePath.java:284)
	at jdk/internal/module/ModulePath.scan (java.base@18/ModulePath.java:232)
	at jdk/internal/module/ModulePath.scanNextEntry (java.base@18/ModulePath.java:190)
	at jdk/internal/module/ModulePath.find (java.base@18/ModulePath.java:154)
	at jdk/internal/module/SystemModuleFinders$1.lambda$find$0 (java.base@18/SystemModuleFinders.java:216)
@babsingh babsingh added the project:MH Used to track Method Handles related work label Nov 8, 2021
@babsingh babsingh added this to the Release 0.31 (Java 18) milestone Nov 8, 2021
@pshipton pshipton added the jdk18 label Nov 8, 2021
babsingh added a commit to babsingh/openj9 that referenced this issue Nov 10, 2021
MemberName.vminfoIsConsistent is only used in an assertion to validate the
vmtarget and vmindex elements of MemberName. It relies on MHN.getMemberVMInfo
to retrieve the vmtarget and vmindex elements of MemberName.

For correct validation, MHN.getMemberVMInfo should return 0 for vmindex when
the vTableIndex is 0 and ref kind is invokevirtual or invokeinterface.
Otherwise, it should return -1 for vmindex. MHN.getMemberVMInfo has been
updated to perform this behaviour. This in return fixes the behaviour of
MemberName.vminfoIsConsistent.

Closes: eclipse-openj9#13877

Co-authored-by: Jack Lu <Jack.S.Lu@ibm.com>
Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Adopt OpenJDK MethodHandles automation moved this from To do to Done Nov 10, 2021
qasimy123 pushed a commit to qasimy123/openj9-jit-debug-agent that referenced this issue Nov 26, 2021
MemberName.vminfoIsConsistent is only used in an assertion to validate the
vmtarget and vmindex elements of MemberName. It relies on MHN.getMemberVMInfo
to retrieve the vmtarget and vmindex elements of MemberName.

For correct validation, MHN.getMemberVMInfo should return 0 for vmindex when
the vTableIndex is 0 and ref kind is invokevirtual or invokeinterface.
Otherwise, it should return -1 for vmindex. MHN.getMemberVMInfo has been
updated to perform this behaviour. This in return fixes the behaviour of
MemberName.vminfoIsConsistent.

Closes: eclipse-openj9/openj9#13877

Co-authored-by: Jack Lu <Jack.S.Lu@ibm.com>
Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm jdk18 project:MH Used to track Method Handles related work
Development

Successfully merging a pull request may close this issue.

2 participants