JDK-8222552 : [Graal] org.graalvm.compiler.jtt.jdk.UnsafeAllocateInstance01 fails with "AssertionError: expected null but got an exception"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 13
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2019-04-16
  • Updated: 2020-08-07
  • Resolved: 2020-08-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
org.graalvm.compiler.jtt.jdk.UnsafeAllocateInstance01 fails with
 
1) run3(org.graalvm.compiler.jtt.jdk.UnsafeAllocateInstance01)
java.lang.AssertionError: expected null but got an exception
	at org.graalvm.compiler.core.test.GraalCompilerTest.assertEquals(GraalCompilerTest.java:919)
	at org.graalvm.compiler.core.test.GraalCompilerTest.testAgainstExpected(GraalCompilerTest.java:885)
	at org.graalvm.compiler.jtt.JTTTest.runTest(JTTTest.java:111)
	at org.graalvm.compiler.jtt.JTTTest.runTest(JTTTest.java:94)
	at org.graalvm.compiler.jtt.JTTTest.runTest(JTTTest.java:90)

2) run4(org.graalvm.compiler.jtt.jdk.UnsafeAllocateInstance01)
java.lang.AssertionError: expected null but got an exception
	at org.graalvm.compiler.core.test.GraalCompilerTest.assertEquals(GraalCompilerTest.java:919)
	at org.graalvm.compiler.core.test.GraalCompilerTest.testAgainstExpected(GraalCompilerTest.java:885)
	at org.graalvm.compiler.jtt.JTTTest.runTest(JTTTest.java:111)
	at org.graalvm.compiler.jtt.JTTTest.runTest(JTTTest.java:94)
	at org.graalvm.compiler.jtt.JTTTest.runTest(JTTTest.java:90)

when running with -Xcomp (note no Graal as JIT is used)
Comments
Closing as duplicate of JDK-8153540.
07-08-2020

[~dlong], as JDK-8202670 added @Ignore to UnsafeAllocateInstanance01::run01, shouldn't we close this bug as a dup of JDK-8202670? or JDK-8153540?
06-12-2019

The test seems to be testing undefined behavior, similar to JDK-8153540. Normally the caller is expected to make sure arguments passed to Unsafe methods are correct. There is no guarantee of error checking, exceptions, or not crashing.
15-05-2019

The JNI version of Unsafe.allocateInstance will throw these exceptions: Caused by: java.lang.IllegalAccessException: java.lang.Class at java.base/jdk.internal.misc.Unsafe.allocateInstance(Native Method) Caused by: java.lang.InstantiationException: java.util.List at java.base/jdk.internal.misc.Unsafe.allocateInstance(Native Method) Apparently that's what we get with -Xcomp. I'm not sure what this test is trying to accomplish. It seems like it is trying to take advantage of the undefined behavior of the C2 intrinsic.
14-05-2019

Adding the testbug label for now. Please remove if it turns out to be a JIT issue.
23-04-2019

[~dlong] JDK-8192853 was filed against "Graal JIT mode + -Xcomp", this bug is reproduced just in "-server -Xcomp" configuration. So, this is why I filed separate bug.
18-04-2019

[~epavlova] In JDK-8192853, Doug said "I propose that Graal unit tests are not to be run with -Xcomp". So should we make this a duplicate?
18-04-2019

It could be the case the tests are not suitable for running in -Xcomp, so let me know if this is the case.
18-04-2019

One more unsafe failure is org.graalvm.compiler.core.test.UnsafeVirtualizationTest
18-04-2019

To reproduce run compiler/graalunit/JttJdkTest.java or create open/test/hotspot/jtreg/compiler/graalunit/Unsafe.java with following content: /* * @test * @summary * @requires vm.opt.final.EnableJVMCI == true * * @modules jdk.internal.vm.compiler * * @library /test/lib /compiler/graalunit / * * @build compiler.graalunit.common.GraalUnitTestLauncher * * @run main compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.jdk.UnsafeAllocateInstance01 */ and then run > make run-test TEST="compiler/graalunit/Unsafe.java" TEST_VM_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+TieredCompilation -XX:-UseJVMCICompiler -Xcomp"
16-04-2019