JDK-8333258 : C2: high memory usage in PhaseCFG::insert_anti_dependences()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-05-30
  • Updated: 2024-11-06
  • Resolved: 2024-09-18
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 24
24 b16Fixed
Related Reports
Relates :  
Relates :  
Description
This is not a regression per se. JDK-8331185 enabled compiler memory limit checks that we now hit:

$ export JAVA_HOME=<point to fastdebug build>
$ export PATH=$JAVA_HOME/bin:$PATH
$ cd test/hotspot/jtreg/testlibrary/ctw
$ make
$ cd dist
$ wget https://repo1.maven.org/maven2/org/codehaus/jtstand/jtstand-chart/1.5.5/jtstand-chart-1.5.5.jar
$ JAVA_OPTIONS="-XX:+UseShenandoahGC" ./ctw.sh jtstand-chart-1.5.5.jar

#  Internal Error (/home/shipilev/shipilev-jdk/src/hotspot/share/compiler/compilationMemoryStatistic.cpp:559), pid=20797, tid=21156
#  fatal error: c2 org/jfree/chart/renderer/AbstractRenderer::clone(()Ljava/lang/Object;): Hit MemLimit (limit: 1073741824 now: 1073772544)

Current CompileTask:
C2:5996 3408    b  4       org.jfree.chart.renderer.AbstractRenderer::clone (419 bytes)

Stack: [0x0000fffdf8243000,0x0000fffdf8441000],  sp=0x0000fffdf843b6a0,  free space=2017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1848258]  VMError::report_and_die(int, char const*, char const*, std::__va_list, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x4ac  (compilationMemoryStatistic.cpp:559)
V  [libjvm.so+0xa0b9d4]  report_fatal(VMErrorType, char const*, int, char const*, ...)+0x114  (debug.cpp:214)
V  [libjvm.so+0x93b008]  CompilationMemoryStatistic::on_arena_change(long, Arena const*)+0x828  (compilationMemoryStatistic.cpp:559)
V  [libjvm.so+0x600fb4]  Arena::grow(unsigned long, AllocFailStrategy::AllocFailEnum)+0x3d4  (arena.cpp:258)
V  [libjvm.so+0xcba5bc]  Node_Array::Node_Array(Arena*, unsigned int)+0x9c  (arena.hpp:120)
V  [libjvm.so+0xcb0cd0]  PhaseCFG::insert_anti_dependences(Block*, Node*, bool)+0x2c0  (node.hpp:1637)
V  [libjvm.so+0xcb71cc]  PhaseCFG::schedule_late(VectorSet&, Node_Stack&)+0x8cc  (gcm.cpp:1410)
V  [libjvm.so+0xcb7a38]  PhaseCFG::global_code_motion()+0x398  (gcm.cpp:1521)
V  [libjvm.so+0xcba4bc]  PhaseCFG::do_global_code_motion()+0x50  (gcm.cpp:1644)
V  [libjvm.so+0x95fcc0]  Compile::Code_Gen()+0x210  (compile.cpp:2966)
V  [libjvm.so+0x964264]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x10e4  (compile.cpp:886)
V  [libjvm.so+0x7af854]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x170  (c2compiler.cpp:142)
V  [libjvm.so+0x96e2a8]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x528  (compileBroker.cpp:2303)
V  [libjvm.so+0x96f08c]  CompileBroker::compiler_thread_loop()+0x39c  (compileBroker.cpp:1961)
V  [libjvm.so+0xdd7914]  JavaThread::thread_main_inner()+0x1d4  (javaThread.cpp:759)
V  [libjvm.so+0x1761740]  Thread::call_run()+0x120  (thread.cpp:225)
V  [libjvm.so+0x1392c8c]  thread_native_entry(Thread*)+0x12c  (os_linux.cpp:846)
C  [libpthread.so.0+0x7230]  start_thread+0xb0
Lock stack of current Java thread (top to bottom):



Comments
Changeset: 5381f553 Branch: master Author: Roland Westrelin <roland@openjdk.org> Date: 2024-09-18 07:07:45 +0000 URL: https://git.openjdk.org/jdk/commit/5381f553ad61ddaa44d49c3039a05511cc68bdd0
18-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19791 Date: 2024-06-19 12:54:26 +0000
09-07-2024

I see similar failures without shenandoah.
14-06-2024

ILW = High C2 compiler memory usage, single method with CTW, no workaround = MLH = P4
30-05-2024

[~roland], want to take a look at this one?
30-05-2024