JDK-8371541 : Repetitive allocations Compile::current()->comp_arena() when using -XX:+VerifyLoopOptimizations
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 26
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-11-10
  • Updated: 2025-11-10
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 :  
Description
While investigating JDK-8366990, I noticed that when using -XX:+VerifyLoopOptimizations we can end up in cases where Compile::current()->comp_arena() grows indefinitely. This is due to repetitive allocations on the compile arena during loop verification:

- _body(Compile::current()->comp_arena()) in the constructor of PhaseIdealLoopTree
- _loop_or_ctrl(igvn.C->comp_arena()) in the constructor of PhaseIdealLoop

The issue becomes quite obvious with some printing:
--- a/src/hotspot/share/opto/loopnode.hpp
+++ b/src/hotspot/share/opto/loopnode.hpp
@@ -1203,6 +1203,7 @@ class PhaseIdealLoop : public PhaseTransform {
     DEBUG_ONLY(C->set_phase_verify_ideal_loop();)
     build_and_optimize();
     DEBUG_ONLY(C->reset_phase_verify_ideal_loop();)
+    tty->print_cr("size of comp_arena: %lu", igvn.C->comp_arena()->size_in_bytes());
   }

java -XX:CompileCommand=compileonly,compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit::test -XX:-TieredCompilation -Xcomp -XX:PerMethodTrapLimit=0 -XX:+StressLoopPeeling -XX:+VerifyLoopOptimizations -XX:StressSeed=1870557292 -XX:CompileCommand=compileonly,compiler.loopopts.TestVerifyLoopOptimizationsHitsMemLimit::test open/test/hotspot/jtreg/compiler/loopopts/TestVerifyLoopOptimizationsHitsMemLimit.java