Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8323781

[lworld] Synchronization on inline type does not throw IllegalMonitorStateException with lightweight locking

XMLWordPrintable

      When trying to synchronize on an inline type, we should throw an IllegalMonitorStateException. However, this only work with heavy monitors (-XX:LockingMode=0) or legacy stack locking (-XX:LockingMode=1). We fail to throw the exception with lightweight locking (-XX:LockingMode=2) due to not masking the inline type bit in the new lightweight locking code. This should be fixed and already fails before merging jdk-22+16 which just changed the default from legacy stack locking to lightweight locking with JDK-8315880 (was backed out again later with JDK-8319253 in jdk-22+24 but is not merged in, yet).

      ---------------
      Original report:

      Test affected:

      * compiler/valhalla/inlinetypes/TestIntrinsics.java
      * compiler/valhalla/inlinetypes/TestLWorld.java

      Example Output

      Scenario #5
      ===========
      Scenario flags: [-XX:+EnableValhalla, -XX:+EnablePrimitiveClasses, --add-exports, java.base/jdk.internal.value=ALL-UNNAMED, -XX:+IgnoreUnrecognizedVMOptions, -XX:-UseACmpProfile, -XX:+AlwaysIncrementalInline, -XX:FlatArrayElementMaxOops=5, -XX:FlatArrayElementMaxSize=-1, -XX:-UseArrayLoadStoreProfile, -XX:InlineFieldMaxFlatSize=-1, -XX:-InlineTypePassFieldsAsArgs, -XX:-InlineTypeReturnedAsFields, --add-exports, java.base/jdk.internal.misc=ALL-UNNAMED, --add-exports, java.base/jdk.internal.value=ALL-UNNAMED, -XX:-DeoptimizeALot]

      TestFramework test VM exited with code 1

      ....

      Error Output
      ------------
      Exception in thread "main" compiler.lib.ir_framework.shared.TestRunException:

      Test Failures (1)
      -----------------
      Custom Run Test: @Run: test59_verifier - @Test: test59:
      compiler.lib.ir_framework.shared.TestRunException: There was an error while invoking @Run method public void compiler.valhalla.inlinetypes.TestIntrinsics.test59_verifier() throws java.lang.Exception
      at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:162)
      at compiler.lib.ir_framework.test.AbstractTest.run(AbstractTest.java:99)
      at compiler.lib.ir_framework.test.CustomRunTest.run(CustomRunTest.java:89)
      at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:826)
      at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:250)
      at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:165)
      Caused by: java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
      at java.base/java.lang.reflect.Method.invoke(Method.java:582)
      at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:159)
      ... 5 more
      Caused by: java.lang.RuntimeException: test59 failed: synchronization on inline type should not succeed
      at compiler.valhalla.inlinetypes.TestIntrinsics.test59_verifier(TestIntrinsics.java:1181)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
      ... 7 more



      at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:861)
      at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:250)
      at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:165)




        #############################################################
         - To only run the failed tests use -DTest, -DExclude,
           and/or -DScenarios.
         - To also get the standard output of the test VM run with
           -DReportStdout=true or for even more fine-grained logging
           use -DVerbose=true.
        #############################################################


      compiler.lib.ir_framework.shared.TestRunException: The following scenarios have failed: #0, #1, #2, #3, #4, #5. Please check stderr for more information.
      at compiler.lib.ir_framework.TestFramework.reportScenarioFailures(TestFramework.java:676)
      at compiler.lib.ir_framework.TestFramework.startWithScenarios(TestFramework.java:636)
      at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:348)
      at compiler.valhalla.inlinetypes.TestIntrinsics.main(TestIntrinsics.java:71)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
      at java.base/java.lang.reflect.Method.invoke(Method.java:582)
      at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
      at java.base/java.lang.Thread.run(Thread.java:1570)

            chagedorn Christian Hagedorn
            dsimms David Simms
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: