JDK-8316533 : C2 compilation fails with assert(verify(phase)) failed: missing Value() optimization
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21,22
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2023-09-19
  • Updated: 2024-01-15
  • Resolved: 2023-11-06
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 22
22 b23Fixed
Related Reports
Cloners :  
Relates :  
Relates :  
Relates :  
Description
Test compiler/arraycopy/TestCloneWithStressReflectiveCode.java crashes with JFR enabled.

To reproduce easily, call the test directly without JTreg:
$ java -XX:+StressReflectiveCode -Xcomp -XX:-TieredCompilation -XX:StartFlightRecording=dumponexit=true TestCloneWithStressReflectiveCode.java

STDOUT:
int:1
  0  Root  === 0 49  [[ 0 1 3 36 44 51 53 56 57 60 63 67 ]] 
 26  Proj  === 21  [[ 50 37 ]] #5  Oop:java/util/TimeZone (java/lang/Cloneable,java/io/Serializable) * !jvms: TimeZone::getDefault @ bci:0 (line 674)
 42  IfTrue  === 41  [[ 20 50 ]] #1 !jvms: TimeZone::getDefault @ bci:3 (line 674)
 51  ConP  === 0  [[ 52 54 54 64 64 66 66 ]]  #precise java/util/TimeZone: 0x00007f8c41c77980 (java/lang/Cloneable,java/io/Serializable):Constant:exact *  Klass:precise java/util/TimeZone: 0x00007f8c41c77980 (java/lang/Cloneable,java/io/Serializable):Constant:exact *
 50  CastPP  === 42 26  [[ 20 52 58 58 ]]  #java/util/TimeZone (java/lang/Cloneable,java/io/Serializable):NotNull *  Oop:java/util/TimeZone (java/lang/Cloneable,java/io/Serializable):NotNull * !jvms: TimeZone::getDefault @ bci:3 (line 674)
 52  SubTypeCheck  === _ 50 51  [[ ]]  !jvms: TimeZone::getDefault @ bci:3 (line 674)

int:0
  0  Root  === 0 49  [[ 0 1 3 36 44 51 53 56 57 60 63 67 ]] 
 51  ConP  === 0  [[ 52 54 54 64 64 66 66 ]]  #precise java/util/TimeZone: 0x00007f8c41c77980 (java/lang/Cloneable,java/io/Serializable):Constant:exact *  Klass:precise java/util/TimeZone: 0x00007f8c41c77980 (java/lang/Cloneable,java/io/Serializable):Constant:exact *

==============================
 26  Proj  === 21  [[ 50 37 ]] #5  Oop:java/util/TimeZone (java/lang/Cloneable,java/io/Serializable) * !jvms: TimeZone::getDefault @ bci:0 (line 674)
 22  Proj  === 21  [[ 28 ]] #0 !jvms: TimeZone::getDefault @ bci:0 (line 674)
 37  CmpP  === _ 26 36  [[ 38 ]]  !jvms: TimeZone::getDefault @ bci:3 (line 674)
 28  Catch  === 22 23  [[ 29 30 ]]  !jvms: TimeZone::getDefault @ bci:0 (line 674)
  7  Parm  === 3  [[ 4 10 18 19 21 34 55 59 65 ]] Memory  Memory: @BotPTR *+bot, idx=Bot; !jvms: TimeZone::getDefault @ bci:-1 (line 674)
  6  Parm  === 3  [[ 4 17 21 ]] I_O !jvms: TimeZone::getDefault @ bci:-1 (line 674)
  5  Parm  === 3  [[ 4 17 21 ]] Control !jvms: TimeZone::getDefault @ bci:-1 (line 674)
 38  Bool  === _ 37  [[ 41 ]] [ne] !jvms: TimeZone::getDefault @ bci:3 (line 674)
 29  CatchProj  === 28  [[ 41 ]] #0@bci -1  !jvms: TimeZone::getDefault @ bci:0 (line 674)
 21  CallStaticJava  === 5 6 7 8 1 ) [[ 22 23 24 26 27 ]] # Static  java.util.TimeZone::getDefaultRef java/util/TimeZone (java/lang/Cloneable,java/io/Serializable) * (  ) TimeZone::getDefault @ bci:0 (line 674) !jvms: TimeZone::getDefault @ bci:0 (line 674)
 41  If  === 29 38  [[ 42 43 ]] P=0.999999, C=-1.000000 !jvms: TimeZone::getDefault @ bci:3 (line 674)
 36  ConP  === 0  [[ 37 45 ]]  #null
 44  ConI  === 0  [[ 45 ]]  #int:-10
  9  Parm  === 3  [[ 4 11 17 20 32 35 45 ]] ReturnAdr !jvms: TimeZone::getDefault @ bci:-1 (line 674)
 24  Proj  === 21  [[ 25 31 39 45 47 ]] #2  Memory: @BotPTR *+bot, idx=Bot; !jvms: TimeZone::getDefault @ bci:0 (line 674)
 23  Proj  === 21  [[ 20 28 32 33 35 45 ]] #1 !jvms: TimeZone::getDefault @ bci:0 (line 674)
 43  IfFalse  === 41  [[ 45 ]] #0 !jvms: TimeZone::getDefault @ bci:3 (line 674)
  3  Start  === 3 0  [[ 3 5 6 7 8 9 ]]  #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address}
 45  CallStaticJava  === 43 23 24 8 9 (44 36 ) [[ 46 48 ]] # Static uncommon_trap(reason='null_check' action='maybe_recompile' debug_id='0')  void ( int ) C=0.000100 TimeZone::getDefault @ bci:3 (line 674) !jvms: TimeZone::getDefault @ bci:3 (line 674)
  8  Parm  === 3  [[ 4 11 17 20 21 32 35 49 45 ]] FramePtr !jvms: TimeZone::getDefault @ bci:-1 (line 674)
  1  Con  === 0  [[ ]]  #top
 46  Proj  === 45  [[ 49 ]] #0 !jvms: TimeZone::getDefault @ bci:3 (line 674)
 49  Halt  === 46 1 1 8 1  [[ 0 ]]  !jvms: TimeZone::getDefault @ bci:3 (line 674)
  0  Root  === 0 49  [[ 0 1 3 36 44 51 53 56 57 60 63 67 ]] 
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S141885/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/45073736-7ca8-476b-8a56-e801b53f8158/runs/adced348-bc5a-4e8a-8764-03ede0a8c31c/workspace/open/src/hotspot/share/opto/subtypenode.cpp:114), pid=162369, tid=162385
#  assert(verify(phase)) failed: missing Value() optimization
#
# JRE version: Java(TM) SE Runtime Environment (22.0) (fastdebug build 22-internal-2023-09-19-0403435.leonid.mesnik.jdk-flags)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-internal-2023-09-19-0403435.leonid.mesnik.jdk-flags, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x170ee1f]  SubTypeCheckNode::Ideal(PhaseGVN*, bool)+0x34f
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/scratch/3/core.162369)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -Dtest.vm.opts=-XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=/opt/mach5/mesos/work_dir/jib-master/install/jdk/20/36/bundles/linux-x64/jdk-20_linux-x64_bin.tar.gz/jdk-20 -Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/tmp -Dtest.tool.vm.opts=-J-XX:MaxRAMPercentage=4.16667 -J-Dtest.boot.jdk=/opt/mach5/mesos/work_dir/jib-master/install/jdk/20/36/bundles/linux-x64/jdk-20_linux-x64_bin.tar.gz/jdk-20 -J-Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/tmp -Dtest.compiler.opts= -Dtest.java.opts=-XX:StartFlightRecording=dumponexit=true -Dtest.jdk=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/linux-x64-debug.jdk/jdk-22/fastdebug -Dcompile.jdk=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/linux-x64-debug.jdk/jdk-22/fastdebug -Dtest.timeout.factor=10.0 -Dtest.nativepath=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/linux-x64-debug.test/hotspot/jtreg/native -Dtest.root=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/src.full/open/test/hotspot/jtreg -Dtest.name=compiler/arraycopy/TestCloneWithStressReflectiveCode.java -Dtest.file=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/src.full/open/test/hotspot/jtreg/compiler/arraycopy/TestCloneWithStressReflectiveCode.java -Dtest.src=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/src.full/open/test/hotspot/jtreg/compiler/arraycopy -Dtest.src.path=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/src.full/open/test/hotspot/jtreg/compiler/arraycopy -Dtest.classes=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/classes/2/compiler/arraycopy/TestCloneWithStressReflectiveCode.d -Dtest.class.path=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/classes/2/compiler/arraycopy/TestCloneWithStressReflectiveCode.d -Dtest.class.path.prefix=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/classes/2/compiler/arraycopy/TestCloneWithStressReflectiveCode.d:/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/src.full/open/test/hotspot/jtreg/compiler/arraycopy -XX:MaxRAMPercentage=4.16667 -Dtest.boot.jdk=/opt/mach5/mesos/work_dir/jib-master/install/jdk/20/36/bundles/linux-x64/jdk-20_linux-x64_bin.tar.gz/jdk-20 -Djava.io.tmpdir=/opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/tmp -XX:StartFlightRecording=dumponexit=true -Djava.library.path=/opt/mach5/mesos/work_dir/jib-master/install/2023-09-19-0403435.leonid.mesnik.jdk-flags/linux-x64-debug.test/hotspot/jtreg/native -XX:-InlineUnsafeOps -XX:-ReduceInitialCardMarks -XX:+StressReflectiveCode -Xcomp -XX:-TieredCompilation com.sun.javatest.regtest.agent.MainWrapper /opt/mach5/mesos/work_dir/slaves/cd627e65-f015-4fb1-a1d2-b6c9b8127f98-S152311/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/e68583f5-aa27-4f51-ac4d-7577b20597b8/runs/b2bea7be-6d4f-4a2d-b8f8-5b0cbcda915e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler/compiler/arraycopy/TestCloneWithStressReflectiveCode.d/main.1.jta

Host: ol8-x64-172654, Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz, 12 cores, 23G, Oracle Linux Server release 8.7
Time: Tue Sep 19 04:34:10 2023 UTC elapsed time: 18.420527 seconds (0d 0h 0m 18s)

---------------  T H R E A D  ---------------

Current thread (0x00007fa0ac32f1b0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=162385, stack(0x00007fa0918fa000,0x00007fa0919fa000) (1024K)]


Current CompileTask:
C2:  18420 2894    b        java.util.TimeZone::getDefault (10 bytes)

Stack: [0x00007fa0918fa000,0x00007fa0919fa000],  sp=0x00007fa0919f64d0,  free space=1009k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x170ee1f]  SubTypeCheckNode::Ideal(PhaseGVN*, bool)+0x34f  (subtypenode.cpp:114)
V  [libjvm.so+0x15302b9]  PhaseGVN::transform_no_reclaim(Node*)+0x69  (phaseX.cpp:667)
V  [libjvm.so+0xd9aa86]  GraphKit::gen_subtype_check(Node*, Node*)+0x166  (graphKit.cpp:2902)
V  [libjvm.so+0xd9adab]  GraphKit::subtype_check_receiver(Node*, ciKlass*, Node**)+0x5b  (graphKit.cpp:2948)
V  [libjvm.so+0x8500bf]  PredictedCallGenerator::generate(JVMState*)+0x7bf  (callGenerator.cpp:889)
V  [libjvm.so+0xb87cd2]  Parse::do_call()+0x682  (doCall.cpp:675)
V  [libjvm.so+0x1506e78]  Parse::do_one_bytecode()+0x5a8  (parse2.cpp:2728)
V  [libjvm.so+0x14f5e92]  Parse::do_one_block()+0x582  (parse1.cpp:1577)
V  [libjvm.so+0x14f6d55]  Parse::do_all_blocks()+0x135  (parse1.cpp:713)
V  [libjvm.so+0x14fb54f]  Parse::Parse(JVMState*, ciMethod*, float)+0xb6f  (parse1.cpp:617)
V  [libjvm.so+0x84c788]  ParseGenerator::generate(JVMState*)+0x168  (callGenerator.cpp:99)
V  [libjvm.so+0x9ef9cd]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x163d  (compile.cpp:783)
V  [libjvm.so+0x84a0fb]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x13b  (c2compiler.cpp:119)
V  [libjvm.so+0x9fbe30]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x980  (compileBroker.cpp:2285)
V  [libjvm.so+0x9fcb58]  CompileBroker::compiler_thread_loop()+0x4a8  (compileBroker.cpp:1946)
V  [libjvm.so+0xeba2cc]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:720)
V  [libjvm.so+0x17a1a3a]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14a68ea]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:785)
Comments
This introduced a regression (see JDK-8320175) and was backed out.
15-01-2024

Changeset: b5c863b7 Author: Emanuel Peter <epeter@openjdk.org> Date: 2023-11-06 10:41:09 +0000 URL: https://git.openjdk.org/jdk/commit/b5c863b772603b3fbf159d2bd3f6d1caffaff16a
06-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16361 Date: 2023-10-25 14:29:07 +0000
02-11-2023

I narrowed it down to JDK-8297933 in JDK 21 (paging [~roland]).
20-09-2023

ILW = Missing optimization in C2 (harmless in product), single test with -XX:+StressReflectiveCode, -XX:+ExpandSubTypeCheckAtParseTime = MLM = P4
20-09-2023