You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
00:40:09 java.lang.NoSuchMethodError: java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class java.lang.invoke.BoundMethodHandle$Species_LLLLLL (loaded from <Unknown> by <Bootstrap Loader>).
00:40:09 at java.lang.invoke.BoundMethodHandle$Species_LLLLLL.copyWithExtendL(java/lang/invoke/BoundMethodHandle$Species_LLLLLL)
00:40:09 at java.base/java.lang.invoke.MethodHandles.filterReturnValue(MethodHandles.java:5870)
00:40:09 at java.base/openj9.internal.foreign.abi.InternalDowncallHandler.permuteMH(InternalDowncallHandler.java:421)
00:40:09 at java.base/openj9.internal.foreign.abi.InternalDowncallHandler.getBoundMethodHandle(InternalDowncallHandler.java:396)
00:40:09 at java.base/jdk.internal.foreign.abi.DowncallLinker.getBoundMethodHandle(DowncallLinker.java:45)
00:40:09 at java.base/jdk.internal.foreign.abi.x64.sysv.CallArranger.arrangeDowncall(CallArranger.java:130)
00:40:09 at java.base/jdk.internal.foreign.abi.x64.sysv.SysVx64Linker.arrangeDowncall(SysVx64Linker.java:54)
00:40:09 at java.base/jdk.internal.foreign.abi.AbstractLinker.lambda$downcallHandle$0(AbstractLinker.java:62)
00:40:09 at java.base/jdk.internal.foreign.abi.SoftReferenceCache$Node.get(SoftReferenceCache.java:52)
00:40:09 at java.base/jdk.internal.foreign.abi.SoftReferenceCache.get(SoftReferenceCache.java:38)
00:40:09 at java.base/jdk.internal.foreign.abi.AbstractLinker.downcallHandle(AbstractLinker.java:60)
00:40:09 at java.base/java.lang.foreign.Linker.downcallHandle(Linker.java:221)
00:40:09 at CallGeneratorHelper.downcallHandle(CallGeneratorHelper.java:463)
00:40:09 at TestDowncallBase.doCall(TestDowncallBase.java:40)
00:40:09 at TestDowncallScope.testDowncall(TestDowncallScope.java:72)
16 - - jdk_foreign_0 3 min 41 sec NOT OK No No
17 - - jdk_foreign_1 2 min 38 sec OK No No
which seems odd to me jdk_foreign_0 failed while jdk_foreign_1 passed given the FFI invocation has nothing to do with JIT/GC, in which case jdk_foreign_0 and jdk_foreign_1 should end up with the same result.
I compiled a build on one of Jenkins Linux/x86_64 machines and verified with TestDowncallScope.java which works good as expected:
Looking at the java stacktrace in the description:
00:40:09 java.lang.NoSuchMethodError: java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;Ljava/lang/Object;
Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava
/lang/Object;)Ljava/lang/Object; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class
java.lang.invoke.BoundMethodHandle$Species_LLLLLL (loaded from <Unknown> by <Bootstrap Loader>).
00:40:09 at java.lang.invoke.BoundMethodHandle$Species_LLLLLL.copyWithExtendL(java/lang/invoke/BoundMethodHandle$Species_LLLLLL)
00:40:09 at java.base/java.lang.invoke.MethodHandles.filterReturnValue(MethodHandles.java:5870)
in which NoSuchMethodError was thrown out from OpenJDK MH.
I'm wondering whether there was any change merged in OpenJDK MH recently given the issue never occurs on other supported platforms.
I am not aware of any changes related to method handle invocation that was merged.
The exception doesnt seem possible as invokeBasic is implemented as an INL in the vm and resolution ignores any signature since the method is polymorphoic. There should be no reason for a NoSuchMethodError unless the methodhandle class is changed/corrupted
@nbhuiyan The MH INLs (invokeBasic/linkTo...) isn't suppose to be resolved via resolveSpecialMethodRefInto. But given that invokeBasic is defined as final I suppose it could also work here but it really should be fixed to use the proper helper to resolve the method ref. Your changes looks fine to me, maybe try cleaning old build before recompiling.
@fengxue-IS I agree that the right approach is to ensure that the right helper is used for resolving the method ref. The question that remains now is why do we end up in the resolveSpecialMethodRefInto helper in the first place. What information does the resolve process rely on to decide which helper to use, and is the compiled code providing some incorrect info that's resulting in going into the incorrect resolve helper?
23:08:41 test StdLibTest.test_printf([STRING, DOUBLE, CHAR, DOUBLE]): failure
23:08:41 java.lang.NoSuchMethodError: java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class java.lang.invoke.BoundMethodHandle$Species_LLLLLLL (loaded from <Unknown> by <Bootstrap Loader>).
23:08:41 at java.lang.invoke.BoundMethodHandle$Species_LLLLLLL.copyWithExtendL(java/lang/invoke/BoundMethodHandle$Species_LLLLLLL)
23:08:41 at java.base/java.lang.invoke.MethodHandles.filterReturnValue(MethodHandles.java:5851)
23:08:41 at jdk.incubator.foreign/openj9.internal.foreign.abi.InternalDowncallHandler.permuteMH(InternalDowncallHandler.java:421)
23:08:41 at jdk.incubator.foreign/openj9.internal.foreign.abi.InternalDowncallHandler.getBoundMethodHandle(InternalDowncallHandler.java:396)
23:08:41 at jdk.incubator.foreign/jdk.internal.foreign.abi.ProgrammableInvoker.getBoundMethodHandle(ProgrammableInvoker.java:46)
23:08:41 at jdk.incubator.foreign/jdk.internal.foreign.abi.x64.sysv.CallArranger.arrangeDowncall(CallArranger.java:134)
23:08:41 at jdk.incubator.foreign/jdk.internal.foreign.abi.x64.sysv.SysVx64Linker.downcallHandle(SysVx64Linker.java:97)
23:08:41 at jdk.incubator.foreign/jdk.internal.foreign.AbstractCLinker.downcallHandle(AbstractCLinker.java:44)
23:08:41 at StdLibTest$StdLibHelper.specializedPrintf(StdLibTest.java:350)
23:08:41 at StdLibTest$StdLibHelper.printf(StdLibTest.java:329)
23:08:41 at StdLibTest.test_printf(StdLibTest.java:144)
@fengxue-IS I agree that the right approach is to ensure that the right helper is used for resolving the method ref. The question that remains now is why do we end up in the resolveSpecialMethodRefInto helper in the first place. What information does the resolve process rely on to decide which helper to use, and is the compiled code providing some incorrect info that's resulting in going into the incorrect resolve helper?
The resolution helper is selected based on the bytecode / cp ref type, invokeBasic should be tagged as J9CPTYPE_INSTANCE_METHOD which can be either invokeSpecial or invokeVirtual as it isn't private, that correct bytecode should be invokeVirtual where special handling is done for MH INLs.
@nbhuiyan can you generate a core file and check what bytecode instruction is used to do the invocation in failing path BoundMethodHandle$Species_LLLLLLL.copyWithExtendL
Thanks, the bytecode is using invokeVirtual as expected, so problem here is how did the AOT code consider this as J9BCinvokeSpecial to trigger the incorrect resolve helper.
openjdk version "17.0.6" 2023-01-17
IBM Semeru Runtime Open Edition 17.0.6.0-m2 (build 17.0.6+9)
Eclipse OpenJ9 VM 17.0.6.0-m2 (build v0.36.0-release-c5da55ccc, JRE 17 Linux amd64-64-Bit Compressed References 20230117_376 (JIT enabled, AOT enabled)
OpenJ9 - c5da55ccc
OMR - 2bb04132e
JCL - 2842f5c454a based on jdk-17.0.6+9)
[2023-01-10T21:04:07.230Z] variation: Mode150
[2023-01-10T21:04:07.230Z] JVM_OPTIONS: -XX:+UseCompressedOops
[2023-01-10T21:06:12.082Z] TEST: java/foreign/TestIntrinsics.java
[2023-01-10T21:06:12.083Z] STDOUT:
[2023-01-10T21:06:12.083Z] test TestIntrinsics.testIntrinsics(): skip
[2023-01-10T21:06:12.083Z] java.lang.RuntimeException: java.lang.NoSuchMethodError: java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class java.lang.invoke.BoundMethodHandle$Species_LLLLLLL (loaded from <Unknown> by <Bootstrap Loader>).
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:49)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:145)
[2023-01-10T21:06:12.083Z] at org.testng.internal.Parameters.handleParameters(Parameters.java:797)
[2023-01-10T21:06:12.083Z] at org.testng.internal.Parameters.handleParameters(Parameters.java:740)
[2023-01-10T21:06:12.083Z] at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:59)
[2023-01-10T21:06:12.083Z] at org.testng.internal.ParameterHandler.createParameters(ParameterHandler.java:38)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:789)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
[2023-01-10T21:06:12.083Z] at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[2023-01-10T21:06:12.083Z] at org.testng.TestRunner.privateRun(TestRunner.java:764)
[2023-01-10T21:06:12.083Z] at org.testng.TestRunner.run(TestRunner.java:585)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.run(SuiteRunner.java:286)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.runSuites(TestNG.java:1069)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.run(TestNG.java:1037)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.Thread.run(Thread.java:857)
[2023-01-10T21:06:12.083Z] Caused by: java.lang.NoSuchMethodError: java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class java.lang.invoke.BoundMethodHandle$Species_LLLLLLL (loaded from <Unknown> by <Bootstrap Loader>).
[2023-01-10T21:06:12.083Z] at java.lang.invoke.BoundMethodHandle$Species_LLLLLLL.copyWithExtendL(java/lang/invoke/BoundMethodHandle$Species_LLLLLLL)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.invoke.MethodHandles.filterReturnValue(MethodHandles.java:5851)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/openj9.internal.foreign.abi.InternalDowncallHandler.permuteMH(InternalDowncallHandler.java:421)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/openj9.internal.foreign.abi.InternalDowncallHandler.getBoundMethodHandle(InternalDowncallHandler.java:396)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.abi.ProgrammableInvoker.getBoundMethodHandle(ProgrammableInvoker.java:46)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.abi.x64.sysv.CallArranger.arrangeDowncall(CallArranger.java:134)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.abi.x64.sysv.SysVx64Linker.downcallHandle(SysVx64Linker.java:97)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.AbstractCLinker.downcallHandle(AbstractCLinker.java:44)
[2023-01-10T21:06:12.083Z] at TestIntrinsics.tests(TestIntrinsics.java:128)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:45)
[2023-01-10T21:06:12.083Z] ... 30 more
[2023-01-10T21:06:12.083Z] STDERR:
[2023-01-10T21:06:12.083Z] WARNING: Using incubator modules: jdk.incubator.foreign
[2023-01-10T21:06:12.083Z] [Utils] [ERROR] [Error] java.lang.NoSuchMethodError: java/lang/invoke/MethodHandle.invokeBasic(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (loaded from jrt:/java.base by <Bootstrap Loader>) called from class java.lang.invoke.BoundMethodHandle$Species_LLLLLLL (loaded from <Unknown> by <Bootstrap Loader>).
[2023-01-10T21:06:12.083Z] at java.lang.invoke.BoundMethodHandle$Species_LLLLLLL.copyWithExtendL(java/lang/invoke/BoundMethodHandle$Species_LLLLLLL)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.invoke.MethodHandles.filterReturnValue(MethodHandles.java:5851)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/openj9.internal.foreign.abi.InternalDowncallHandler.permuteMH(InternalDowncallHandler.java:421)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/openj9.internal.foreign.abi.InternalDowncallHandler.getBoundMethodHandle(InternalDowncallHandler.java:396)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.abi.ProgrammableInvoker.getBoundMethodHandle(ProgrammableInvoker.java:46)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.abi.x64.sysv.CallArranger.arrangeDowncall(CallArranger.java:134)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.abi.x64.sysv.SysVx64Linker.downcallHandle(SysVx64Linker.java:97)
[2023-01-10T21:06:12.083Z] at jdk.incubator.foreign/jdk.internal.foreign.AbstractCLinker.downcallHandle(AbstractCLinker.java:44)
[2023-01-10T21:06:12.083Z] at TestIntrinsics.tests(TestIntrinsics.java:128)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:45)
[2023-01-10T21:06:12.083Z] at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:145)
[2023-01-10T21:06:12.083Z] at org.testng.internal.Parameters.handleParameters(Parameters.java:797)
[2023-01-10T21:06:12.083Z] at org.testng.internal.Parameters.handleParameters(Parameters.java:740)
[2023-01-10T21:06:12.083Z] at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:59)
[2023-01-10T21:06:12.083Z] at org.testng.internal.ParameterHandler.createParameters(ParameterHandler.java:38)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:789)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
[2023-01-10T21:06:12.083Z] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
[2023-01-10T21:06:12.083Z] at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[2023-01-10T21:06:12.083Z] at org.testng.TestRunner.privateRun(TestRunner.java:764)
[2023-01-10T21:06:12.083Z] at org.testng.TestRunner.run(TestRunner.java:585)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunner.run(SuiteRunner.java:286)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
[2023-01-10T21:06:12.083Z] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.runSuites(TestNG.java:1069)
[2023-01-10T21:06:12.083Z] at org.testng.TestNG.run(TestNG.java:1037)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.Thread.run(Thread.java:857)
[2023-01-10T21:06:12.083Z]
[2023-01-10T21:06:12.083Z] java.lang.Exception: failures: 1
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:96)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-01-10T21:06:12.083Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-01-10T21:06:12.083Z] at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
[2023-01-10T21:06:12.083Z] at java.base/java.lang.Thread.run(Thread.java:857)
[2023-01-10T21:06:12.083Z]
[2023-01-10T21:06:41.483Z] TEST: java/foreign/TestUpcall.java
[2023-01-10T21:06:41.493Z] ===============================================
[2023-01-10T21:06:41.493Z] java/foreign/TestUpcall.java
[2023-01-10T21:06:41.493Z] Total tests run: 1424, Passes: 688, Failures: 736, Skips: 0
[2023-01-10T21:06:41.493Z] ===============================================
[2023-01-10T21:06:41.493Z]
[2023-01-10T21:06:41.493Z] STDERR:
[2023-01-10T21:06:41.493Z] WARNING: Using incubator modules: jdk.incubator.foreign
[2023-01-10T21:06:41.493Z] java.lang.Exception: failures: 736
[2023-01-10T21:06:41.493Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:96)
[2023-01-10T21:06:41.493Z] at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
[2023-01-10T21:06:41.493Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2023-01-10T21:06:41.493Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[2023-01-10T21:06:41.493Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2023-01-10T21:06:41.493Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2023-01-10T21:06:41.493Z] at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
[2023-01-10T21:06:41.493Z] at java.base/java.lang.Thread.run(Thread.java:857)
[2023-01-10T21:06:41.493Z]
[2023-01-10T21:06:41.493Z] JavaTest Message: Test threw exception: java.lang.Exception: failures: 736
This problem happens because methods that are not yet AOT compilable (which is all of the java/lang/invoke/* methods), are considered compilable by the inliner, which then inlines non-AOT-compilable callees resulting in the strange invokeBasic dispatch attempt via the special method resolve helper. We either need AOT compilations to handle MH-related INL calls properly, or for the inliner to not inline callee methods that are not eligible for AOT compilations during AOT. The inliner decides this by using calleeMethod->isCompilable(), which did not have an override for AOT methods. This is fixed in #16556.
Is the INLs the only methods non-AOT compilable? or do we need to exclude the entire package?
The MH INLs such as invokebasic and linkTo* are never compiled even in JIT. For AOT, the entire java/lang/invoke package has to be excluded from compilation.
Activity
pshipton commentedon Oct 21, 2022
@ChengJin01 @tajila fyi
ChengJin01 commentedon Oct 21, 2022
This doesn't make any sense to me as it always works fine till https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_linux_Nightly/ and there is no updated code related to downcall.
I will double-check locally to see how it goes.
ChengJin01 commentedon Oct 21, 2022
which seems odd to me
jdk_foreign_0failed whilejdk_foreign_1passed given the FFI invocation has nothing to do with JIT/GC, in which casejdk_foreign_0andjdk_foreign_1should end up with the same result.TestDowncallScope.javawhich works good as expected:in which
NoSuchMethodErrorwas thrown out from OpenJDK MH.I'm wondering whether there was any change merged in OpenJDK MH recently given the issue never occurs on other supported platforms.
ChengJin01 commentedon Oct 21, 2022
FYI: @fengxue-IS
fengxue-IS commentedon Oct 21, 2022
I am not aware of any changes related to method handle invocation that was merged.
The exception doesnt seem possible as invokeBasic is implemented as an INL in the vm and resolution ignores any signature since the method is polymorphoic. There should be no reason for a NoSuchMethodError unless the methodhandle class is changed/corrupted
ChengJin01 commentedon Oct 21, 2022
Launched a Grinder (x10) at https://openj9-jenkins.osuosl.org/job/Grinder/1434/ on other x86_64 machines to see how it goes.
ChengJin01 commentedon Oct 24, 2022
All tests passed on the Grinder at https://openj9-jenkins.osuosl.org/job/Grinder/1434/tapTestReport/ and no issue was detected. So I suspect the issue was caused a corrupted nightly build or some platform dependent issue in there.
ChengJin01 commentedon Oct 24, 2022
This is the same issue in JIT which was detected a long while ago in #14483 and #14135 (still not yet resolved).
ChengJin01 commentedon Oct 24, 2022
FYI: @nbhuiyan, @0xdaryl
22 remaining items
fengxue-IS commentedon Jan 10, 2023
@nbhuiyan The MH INLs (
invokeBasic/linkTo...) isn't suppose to be resolved viaresolveSpecialMethodRefInto. But given thatinvokeBasicis defined asfinalI suppose it could also work here but it really should be fixed to use the proper helper to resolve the method ref.Your changes looks fine to me, maybe try cleaning old build before recompiling.
nbhuiyan commentedon Jan 10, 2023
@fengxue-IS I agree that the right approach is to ensure that the right helper is used for resolving the method ref. The question that remains now is why do we end up in the
resolveSpecialMethodRefIntohelper in the first place. What information does the resolve process rely on to decide which helper to use, and is the compiled code providing some incorrect info that's resulting in going into the incorrect resolve helper?pshipton commentedon Jan 10, 2023
https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_sanity.openjdk_x86-64_linux_Nightly/388
jdk_foreign_0
jdk_foreign_1
java/foreign/StdLibTest.java
java/foreign/TestIntrinsics.java
java/foreign/TestUpcall.java
One example:
fengxue-IS commentedon Jan 11, 2023
The resolution helper is selected based on the bytecode / cp ref type,
invokeBasicshould be tagged asJ9CPTYPE_INSTANCE_METHODwhich can be eitherinvokeSpecial or invokeVirtualas it isn't private, that correct bytecode should beinvokeVirtualwhere special handling is done for MH INLs.@nbhuiyan can you generate a core file and check what bytecode instruction is used to do the invocation in failing path
BoundMethodHandle$Species_LLLLLLL.copyWithExtendLnbhuiyan commentedon Jan 11, 2023
@fengxue-IS , here are the bytecodes of
copyWithExtendLobtained from a core dump:fengxue-IS commentedon Jan 11, 2023
Thanks, the bytecode is using
invokeVirtualas expected, so problem here is how did the AOT code consider this asJ9BCinvokeSpecialto trigger the incorrect resolve helper.JasonFengJ9 commentedon Jan 11, 2023
JDK17 0.36.0 milestone 2 build(
ub18x64rt1-3)50x grinder jdk_foreign_0 - 25/50 failed
pshipton commentedon Jan 12, 2023
https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_sanity.openjdk_x86-64_linux_Nightly/390
jdk_foreign_1
java/foreign/StdLibTest.java.StdLibTest
java/foreign/TestDowncall.java.TestDowncall
java/foreign/TestUpcall.java.TestUpcall
pshipton commentedon Jan 12, 2023
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_linux_Nightly/90
jdk_foreign_0
java/foreign/TestDowncallStack.java.TestDowncallStack
java/foreign/TestUpcallAsync.java.TestUpcallAsync
java/foreign/TestUpcallScope.java.TestUpcallScope
java/foreign/TestUpcallStack.java.TestUpcallStack
java/foreign/TestVarArgs.java.TestVarArgs
nbhuiyan commentedon Jan 13, 2023
This problem happens because methods that are not yet AOT compilable (which is all of the java/lang/invoke/* methods), are considered compilable by the inliner, which then inlines non-AOT-compilable callees resulting in the strange invokeBasic dispatch attempt via the special method resolve helper. We either need AOT compilations to handle MH-related INL calls properly, or for the inliner to not inline callee methods that are not eligible for AOT compilations during AOT. The inliner decides this by using
calleeMethod->isCompilable(), which did not have an override for AOT methods. This is fixed in #16556.fengxue-IS commentedon Jan 14, 2023
Is the INLs the only methods non-AOT compilable? or do we need to exclude the entire package?
pshipton commentedon Jan 16, 2023
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_linux_Nightly/92
jdk_foreign_1
java/foreign/TestDowncallStack.java.TestDowncallStack
java/foreign/TestUpcallAsync.java.TestUpcallAsync
nbhuiyan commentedon Jan 16, 2023
@fengxue-IS
The MH INLs such as invokebasic and linkTo* are never compiled even in JIT. For AOT, the entire java/lang/invoke package has to be excluded from compilation.
pshipton commentedon Jan 20, 2023
There was a failure in https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_sanity.openjdk_x86-64_linux_Nightly/394 but it seems to be testing a JVM before the fix was merged.