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

[JDK11 OJDK-MH] Errors related to java.base/java.lang.invoke.MethodHandleImpl$AsVarargsCollector.invokeWithArguments #18245

Closed
ThanHenderson opened this issue Oct 5, 2023 · 1 comment
Labels
comp:vm jdk8 jdk11 project:MH Used to track Method Handles related work

Comments

@ThanHenderson
Copy link
Contributor

The below failure(s) is(are) only seen when OJDK MHs are enabled in OpenJ9.

Errors

Test: java/lang/invoke/7196190/GetUnsafeTest.java

Failed at GetUnsafeTest.java:88
Failed at GetUnsafeTest.java:89

Test: java/lang/invoke/7196190/ClassForNameTest.java

java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
        at java.base/java.lang.invoke.MethodHandleImpl$AsVarargsCollector.invokeWithArguments(MethodHandleImpl.java:584)
        at ClassForNameTest.main(ClassForNameTest.java:79)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
        at java.base/java.lang.Thread.run(Thread.java:839)
Caused by: java.lang.ClassNotFoundException: ClassForNameTest
        at java.base/java.lang.Class.forNameImpl(Native Method)
        at java.base/java.lang.Class.forName(Class.java:347)
        ... 13 more

How to Run Tests?

$BUILD_DIR/images/jdk/bin/java -jar $PROJ_ROOT/jtreg/lib/jtreg.jar -va -jdk:$BUILD_DIR/images/jdk <test-path>

Steps to build an OpenJ9 JDK11 with OJDK MHs enabled

Refer to #14540

ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9#14553 and eclipse-openj9#18245.
The visitAnnotation for Hidden seems to have unwanted side effects
when OJDK MHs are enabled and invokeWithArguments is used in JDK11. The
behaviour when removing the visitAnnotation matches the behaviour of
the RI and the implementation for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9/openj9#14553 and
eclipse-openj9/openj9#18245. The visitAnnotation for Hidden seems to
have unwanted side effects when OJDK MHs are enabled and
invokeWithArguments is used in JDK11. The behaviour when removing the
visitAnnotation matches the behaviour of the RI and the implementation
for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9/openj9#14553 and
eclipse-openj9/openj9#18245. The visitAnnotation for Hidden seems to
have unwanted side effects when OJDK MHs are enabled and
invokeWithArguments is used in JDK11. The behaviour when removing the
visitAnnotation matches the behaviour of the RI and the implementation
for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9-openjdk-jdk11 that referenced this issue Oct 10, 2023
This patch fixes both eclipse-openj9/openj9#14553 and
eclipse-openj9/openj9#18245. The visitAnnotation for Hidden seems to
have unwanted side effects when OJDK MHs are enabled and
invokeWithArguments is used in JDK11. The behaviour when removing the
visitAnnotation matches the behaviour of the RI and the implementation
for JDK17.

Closes: eclipse-openj9/openj9#14553 eclipse-openj9/openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
ThanHenderson added a commit to ThanHenderson/openj9 that referenced this issue Oct 19, 2023
This patch fixes both eclipse-openj9#14553 and
eclipse-openj9#18245. When OJDK MHs are enabled for JDK11, the
Hidden attribute for InjectedInvoker classes caused getStackClass and
getCallerClass to return the incorrect class. The solution is to
not iterate over InjectedInvoker classes despite them having the
J9AccMethodFrameIteratorSkip modifier set due to the Hidden attribute.

Closes: eclipse-openj9#14553 eclipse-openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
@babsingh babsingh added comp:vm jdk11 project:MH Used to track Method Handles related work jdk8 labels Oct 19, 2023
@ThanHenderson
Copy link
Contributor Author

Closed by: #18285

midronij pushed a commit to midronij/openj9 that referenced this issue Oct 26, 2023
This patch fixes both eclipse-openj9#14553 and
eclipse-openj9#18245. When OJDK MHs are enabled for JDK11, the
Hidden attribute for InjectedInvoker classes caused getStackClass and
getCallerClass to return the incorrect class. The solution is to
not iterate over InjectedInvoker classes despite them having the
J9AccMethodFrameIteratorSkip modifier set due to the Hidden attribute.

Closes: eclipse-openj9#14553 eclipse-openj9#18245
Signed-off-by: Nathan Henderson <nathan.henderson@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:vm jdk8 jdk11 project:MH Used to track Method Handles related work
Projects
None yet
Development

No branches or pull requests

2 participants