JDK-8337821 : C2: Hit MemLimit in PhaseChaitin::Split in VectorReplicateLongSpecialImmTest.java
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24,25
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2024-08-05
  • Updated: 2025-02-11
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
We hit the debug memory limit in PhaseChaitin::Split by removing the temporary flag -XX:CompileCommand=MemLimit,*.*,0 from VectorReplicateLongSpecialImmTest.java and running the below command on aarch64.

  make test TEST=compiler/vectorapi/VectorReplicateLongSpecialImmTest.java JTREG='JAVA_OPTIONS=-XX:-UseTLAB'

The issue triggers after the fix for JDK-8324345, which results in skipping escape analysis in more cases than before. Potentially, skipping escape analysis and leaving a larger set of nodes could explain the present issue.

After fixing the (potential) issue, please remove the flag -XX:CompileCommand=MemLimit,*.*,0 from VectorReplicateLongSpecialImmTest.java.


#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/scratch/dlunden/jdk/open/src/hotspot/share/compiler/compilationMemoryStatistic.cpp:568), pid=677343, tid=677364
#  fatal error: c2 compiler/vectorapi/VectorReplicateLongSpecialImmTest::testReplicateL_Imm(()V): Hit MemLimit (limit: 1073741824 now: 1073748984)
#
# JRE version: Java(TM) SE Runtime Environment (24.0) (slowdebug build 24-internal-2024-08-05-1215129.dlunden...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 24-internal-2024-08-05-1215129.dlunden..., mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Core dump will be written. Default location: /scratch/dlunden/jdk/build/linux-aarch64-slowdebug/test-support/jtreg_open_test_hotspot_jtreg_compiler_vectorapi_VectorReplicateLongSpecialImmTest_java/scratch/0/core.677343
#
# 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 (0x0000fffbfc1af270):  JavaThread "C2 CompilerThread3" daemon [_thread_in_native, id=677364, stack(0x0000fffc19710000,0x0000fffc19910000) (2048K)]


Current CompileTask:
C2:100677 1365 %           compiler.vectorapi.VectorReplicateLongSpecialImmTest::testReplicateL_Imm @ 2 (3851 bytes)

Stack: [0x0000fffc19710000,0x0000fffc19910000],  sp=0x0000fffc1990a540,  free space=2025k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x15b0e54]  VMError::report_and_die(int, char const*, char const*, std::__va_list, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x92c  (compilationMemoryStatistic.cpp:568)
V  [libjvm.so+0x9d6f78]  report_vm_out_of_memory(char const*, int, unsigned long, VMErrorType, char const*, ...)+0x0  (debug.cpp:214)
V  [libjvm.so+0x9226f8]  CompilationMemoryStatistic::on_arena_change(long, Arena const*)+0x368  (compilationMemoryStatistic.cpp:568)
V  [libjvm.so+0x64866c]  Arena::set_size_in_bytes(unsigned long)+0xf8  (arena.cpp:266)
V  [libjvm.so+0x648828]  Arena::grow(unsigned long, AllocFailStrategy::AllocFailEnum)+0x124  (arena.cpp:308)
V  [libjvm.so+0x48d6a4]  Arena::internal_amalloc(unsigned long, AllocFailStrategy::AllocFailEnum)+0x11c  (arena.hpp:134)
V  [libjvm.so+0x61b4c0]  Arena::Amalloc(unsigned long, AllocFailStrategy::AllocFailEnum)+0xc4  (arena.hpp:155)
V  [libjvm.so+0x138bd84]  ResourceArea::allocate_bytes(unsigned long, AllocFailStrategy::AllocFailEnum)+0x2c  (resourceArea.inline.hpp:35)
V  [libjvm.so+0x1388088]  PhaseChaitin::Split(unsigned int, ResourceArea*)+0x374  (reg_split.cpp:555)
V  [libjvm.so+0x835afc]  PhaseChaitin::Register_Allocate()+0x3f0  (chaitin.cpp:481)
V  [libjvm.so+0x9372c4]  Compile::Code_Gen()+0x248  (compile.cpp:2966)
V  [libjvm.so+0x92d740]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x11f8  (compile.cpp:885)
V  [libjvm.so+0x7e5f78]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1b4  (c2compiler.cpp:142)
V  [libjvm.so+0x951a98]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x8dc  (compileBroker.cpp:2303)
V  [libjvm.so+0x950688]  CompileBroker::compiler_thread_loop()+0x3a4  (compileBroker.cpp:1961)
V  [libjvm.so+0x972360]  CompilerThread::thread_entry(JavaThread*, JavaThread*)+0xb0  (compilerThread.cpp:65)
V  [libjvm.so+0xdb0200]  JavaThread::thread_main_inner()+0x188  (javaThread.cpp:757)
V  [libjvm.so+0xdb006c]  JavaThread::run()+0x208  (javaThread.cpp:742)
V  [libjvm.so+0x14fa214]  Thread::call_run()+0x1d8  (thread.cpp:225)
V  [libjvm.so+0x12bf274]  thread_native_entry(Thread*)+0x1d0  (os_linux.cpp:858)
C  [libpthread.so.0+0x7950]  start_thread+0x190
Lock stack of current Java thread (top to bottom):

Comments
I disabled the MemLimit for t105.java with JDK-8349820. Once this bug is fixed, the MemLimit should be re-enabled again.
11-02-2025

vmTestbase/jit/t/t105/t105.java also fails with a similar stack trace: # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (workspace/open/src/hotspot/share/compiler/compilationMemoryStatistic.cpp:568), pid=48286, tid=26115 # fatal error: c2 sun/security/util/KnownOIDs::<clinit>(()V): Hit MemLimit (limit: 1073741824 now: 1073878016) # # JRE version: Java(TM) SE Runtime Environment (25.0+1) (fastdebug build 25-ea+1-LTS-12) # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-ea+1-LTS-12, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64) # Core dump will be written. Default location: core.48286 # # If you would like to submit a bug report, please visit: # https://bugreport.java.com/bugreport/crash.jsp # Current CompileTask: C2:9685 324 b sun.security.util.KnownOIDs::<clinit> (6247 bytes) Stack: [0x000000016d190000,0x000000016d393000], sp=0x000000016d38ec20, free space=2043k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.dylib+0x116f030] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x548 (compilationMemoryStatistic.cpp:568) V [libjvm.dylib+0x573fac] DebuggingContext::~DebuggingContext()+0x0 V [libjvm.dylib+0x4c1708] CompilationMemoryStatistic::on_arena_change(long, Arena const*)+0x3bc V [libjvm.dylib+0x24db4c] Arena::grow(unsigned long, AllocFailStrategy::AllocFailEnum)+0xc4 V [libjvm.dylib+0xf1bfa4] PhaseChaitin::Split(unsigned int, ResourceArea*)+0x584 V [libjvm.dylib+0x3dd388] PhaseChaitin::Register_Allocate()+0x46c V [libjvm.dylib+0x4cdefc] Compile::Code_Gen()+0x3f4 V [libjvm.dylib+0x4cb948] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x15b4 V [libjvm.dylib+0x394ac0] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1e0 V [libjvm.dylib+0x4eac5c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x868 V [libjvm.dylib+0x4ea08c] CompileBroker::compiler_thread_loop()+0x348 V [libjvm.dylib+0x8cbc34] JavaThread::thread_main_inner()+0x1dc V [libjvm.dylib+0x10af898] Thread::call_run()+0xf4 V [libjvm.dylib+0xe491e0] thread_native_entry(Thread*)+0x138 C [libsystem_pthread.dylib+0x7240] _pthread_start+0x94 Lock stack of current Java thread (top to bottom):
11-02-2025

Thanks for checking, [~dlunden]! ILW = High compiler memory usage, single test with memory limit, no workaround = MLH = P4
11-11-2024

It turns out this is likely not a duplicate of JDK-8331295 (even though the error message and stack trace is equal). The fixes I found for `compiler/c2/TestFindNode.java` and `compiler/loopopts/TestDeepGraphVerifyIterativeGVN.java` in JDK-8331295 does not resolve this issue. I verified this by checking spill counts with and without the fixes, and it remains unchanged for `compiler/vectorapi/VectorReplicateLongSpecialImmTest.java`.
11-11-2024

This is a duplicate of JDK-8331295.
06-08-2024