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

[lworld] C2: Meeting two constant TypeAryPtr with different nullness is wrongly treated as exact

XMLWordPrintable

      We wrongly treat the meet of two constant TypeAryPtr with different nullness as exact. This is wrong and triggers an assert during CCP.


      Original report:

      The following two tests fail in tier1 with -Xcomp with the assertion below:

      - valhalla/valuetypes/NullRestrictedArraysTest.java
      - valhalla/valuetypes/FlatVarHandleTest.java

      Could be related to JDK-8351569.

      Output:
         0 Root === 0 38 66 77 88 99 653 237 662 403 631 644 [[ 0 1 3 24 25 33 40 56 61 72 83 94 156 398 161 382 381 183 189 193 200 221 232 272 301 305 336 335 310 311 314 430 415 479 417 ]]
       538 Phi === 536 24 496 [[ 493 496 585 500 506 526 526 526 537 ]] #int:0..max-1:www #tripcount !orig=108,[299] !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:10 (line 184)
        11 Parm === 3 [[ 39 26 ]] Parm1: narrowoop: java/lang/Object *[int:>=0] (java/lang/Cloneable,java/io/Serializable) * !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:-1 (line 183)
        31 IfTrue === 30 [[ 50 39 ]] #1 !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:6 (line 183)
       490 If === 483 287 [[ 491 492 ]] P=0.500000, C=-1.000000
       301 ConI === 0 [[ 514 ]] #int:3
       537 ConvI2L === _ 538 [[ 512 514 518 ]] #long:0..maxint-1:www !orig=316,[192] !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:22 (line 184)
        39 CastPP === 31 11 [[ 664 41 41 399 62 73 84 95 286 196 233 428 233 223 223 197 195 196 197 572 526 526 ]] #narrowoop: java/lang/Object *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull * !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:6 (line 183)
       492 IfFalse === 490 [[ 659 636 664 ]] #0
       514 LShiftL === _ 537 301 [[ 513 ]] !orig=302 !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:22 (line 184)
       664 CheckCastPP === 492 39 [[ 513 509 549 528 513 ]] #flat:narrowoop: NullRestrictedArraysTest$Value (NullRestrictedArraysTest$I):exact *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact:flat(+bot) * !orig=[297],[431] !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:22 (line 184)
       513 AddP === _ 664 664 514 [[ 509 ]] !orig=304 !jvms: NullRestrictedArraysTest::testVarHandleArray @ bci:22 (line 184)
      told = flat:narrowoop: NullRestrictedArraysTest$Value (NullRestrictedArraysTest$I):exact *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact:flat(+bot) *
      tnew = flat:narrowoop: NullRestrictedArraysTest$Value (NullRestrictedArraysTest$I):exact *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact:flat(+bot)+any * [narrow]

      Failure:
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/opt/mach5/mesos/work_dir/slaves/d14b0f60-a475-4b75-84a6-b4452f3162de-S13935/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/06d09a65-a3f6-417f-bb9d-c3e30b8809a7/runs/c7475573-26c7-464a-821c-e18f0ef2ce5f/workspace/open/src/hotspot/share/opto/phaseX.cpp:1840), pid=1380342, tid=1380358
      # fatal error: Not monotonic
      #
      # JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-lworld5ea-LTS-2025-03-27-1423593.christian.hagedorn.valhalla2)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-lworld5ea-LTS-2025-03-27-1423593.christian.hagedorn.valhalla2, compiled mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x17481f9] PhaseCCP::verify_type(Node*, Type const*, Type const*)+0x169

      C2:96010 18126 b 4 FlatVarHandleTest$WeakPoint::makePoints (43 bytes)

      Stack: [0x00007f56e0560000,0x00007f56e0660000], sp=0x00007f56e065b060, free space=1004k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x17481f9] PhaseCCP::verify_type(Node*, Type const*, Type const*)+0x169 (phaseX.cpp:1840)
      V [libjvm.so+0x174d147] PhaseCCP::analyze()+0x417 (phaseX.cpp:1883)
      V [libjvm.so+0xac9fa6] Compile::Optimize()+0x946 (compile.cpp:2878)
      V [libjvm.so+0xacd28b] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1f2b (compile.cpp:866)
      V [libjvm.so+0x8f75ad] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x46d (c2compiler.cpp:142)
      V [libjvm.so+0xadab8c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xbfc (compileBroker.cpp:2331)
      V [libjvm.so+0xadbac8] CompileBroker::compiler_thread_loop()+0x598 (compileBroker.cpp:1975)
      V [libjvm.so+0x101c47f] JavaThread::thread_main_inner()+0x12f (javaThread.cpp:777)
      V [libjvm.so+0x1a28e46] Thread::call_run()+0xb6 (thread.cpp:231)
      V [libjvm.so+0x16b8378] thread_native_entry(Thread*)+0x128 (os_linux.cpp:877)

            chagedorn Christian Hagedorn
            chagedorn Christian Hagedorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: