Repetitive allocations Compile::current()->comp_arena() when using -XX:+VerifyLoopOptimizations

XMLWordPrintable

      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

            Assignee:
            Benoît Maillard
            Reporter:
            Benoît Maillard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: