JDK-8358889 : C2 hits assert in backend due to malformed uncommon trap
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19
  • Priority: P3
  • Status: In Progress
  • Resolution: Unresolved
  • CPU: aarch64
  • Submitted: 2025-06-08
  • Updated: 2025-11-12
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 27
27Unresolved
Related Reports
Causes :  
Causes :  
Relates :  
Description
Using JavaFuzzer dist: /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S514346/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/4c980971-1496-4996-9d27-758584ccdf9d/runs/5a4388ce-1194-403d-b8d0-cf40c2043f64/./jib-data/install/com/oracle/jpg/bigapps/javafuzzer/javafuzzer/4.0/javafuzzer-4.0.zip
Using FuzzGen dist: /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S514346/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/4c980971-1496-4996-9d27-758584ccdf9d/runs/5a4388ce-1194-403d-b8d0-cf40c2043f64/./jib-data/install/com/oracle/jpg/bigapps/javafuzzer/fuzzgen/1.5/fuzzgen-1.5.zip
Generating 5000 tests
Summary total: GEN: 18:23:37     COMP: 00:28:49     REF: 29:32:27     VER: 01:00:42    
Summary mean : GEN: 00:00:13.243 COMP: 00:00:00.345 REF: 00:00:21.269 VER: 00:00:00.728
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S514292/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/c1b319e7-8bee-48e2-b9ba-1de3e53ad5ee/runs/17170e14-d5a3-4918-9243-ac7820d2ab6e/workspace/open/src/hotspot/share/opto/callnode.cpp:1164), pid=7802, tid=28931
#  assert(in_dump() != 0) failed: OK if dumping
#
# JRE version: Java(TM) SE Runtime Environment (26.0+2) (fastdebug build 26-ea+2-23)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-ea+2-23, compiled mode, sharing, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Core dump will be written. Default location: core.7802
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

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

Current thread (0x000000012080d410):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=28931, stack(0x000000016cbe8000,0x000000016cdeb000) (2060K)]


Current CompileTask:
C2:304   10    b        Test_120::mainTest (691 bytes)

Stack: [0x000000016cbe8000,0x000000016cdeb000],  sp=0x000000016cde7760,  free space=2045k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0x1207070]  VMError::report(outputStream*, bool)+0x1b00  (callnode.cpp:1164)
V  [libjvm.dylib+0x120a910]  VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x55c
V  [libjvm.dylib+0x5a50f0]  print_error_for_unit_test(char const*, char const*, char*)+0x0
V  [libjvm.dylib+0x3c9260]  CallStaticJavaNode::extract_uncommon_trap_request(Node const*)+0x204
V  [libjvm.dylib+0x5f998]  CallStaticJavaDirectNode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const+0x310
V  [libjvm.dylib+0xed9ee0]  PhaseOutput::scratch_emit_size(Node const*)+0x270
V  [libjvm.dylib+0xecd624]  PhaseOutput::shorten_branches(unsigned int*)+0x390
V  [libjvm.dylib+0xeccd9c]  PhaseOutput::Output()+0x728
V  [libjvm.dylib+0x4fb044]  Compile::Code_Gen()+0x77c
V  [libjvm.dylib+0x4f8574]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x17bc
V  [libjvm.dylib+0x3b9474]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x208
V  [libjvm.dylib+0x5186b8]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x98c
V  [libjvm.dylib+0x5179d8]  CompileBroker::compiler_thread_loop()+0x390
V  [libjvm.dylib+0x8fc030]  JavaThread::thread_main_inner()+0x1d0
V  [libjvm.dylib+0x1146da0]  Thread::call_run()+0xf0
V  [libjvm.dylib+0xebc744]  thread_native_entry(Thread*)+0x138
C  [libsystem_pthread.dylib+0x7034]  _pthread_start+0x88
Lock stack of current Java thread (top to bottom):

Comments
Seems to be triggered by JDK-8281429 in JDK 19 b22.
10-06-2025

ILW = Assert during C2 compilation due to malformed uncommon trap (probably harmless in product), intermittent with javafuzzer generated test and stress options, no workaround but disabled compilation of affected method = HLM = P3
10-06-2025

To reproduce, run: java -XX:+ReplayCompiles -XX:+ReplayIgnoreInitErrors -XX:ReplayDataFile=replay_pid7802.log -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN -XX:RepeatCompilation=10000 Or run: java -Xmx1G -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*Test*::mainTest -XX:RepeatCompilation=100 -XX:-TieredCompilation -Xcomp -XX:+StressLCM -XX:+StressGCM -XX:+StressIGVN Test_120.java
10-06-2025

I think the problem is that on AArch64, we do this in aarch64.ad: // Only non uncommon_trap calls need to reinitialize ptrue. if (Compile::current()->max_vector_size() > 0 && uncommon_trap_request() == 0) { __ reinitialize_ptrue(); } And the implementation of uncommon_trap_request() assumes that a malformed uncommon trap can only be observed when dumping (which probably is a correct assumption). This code was added by JDK-8258384 in JDK 17.
10-06-2025

I can only reproduce this back until JDK 22 because the replay file does not work anymore for JDK < 22.
10-06-2025

I can reproduce this on AArch64 (only) with the replay file and a large -XX:RepeatCompilation. Trying to narrow it down...
10-06-2025