JDK-8235584 : UseProfiledLoopPredicate fails with assert(_phase->get_loop(c) == loop) failed: have to be in the same loop
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,14,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-12-09
  • Updated: 2022-06-27
  • Resolved: 2020-01-16
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 11 JDK 13 JDK 14 JDK 15
11.0.8-oracleFixed 13.0.6Fixed 14 b33Fixed 15Fixed
Related Reports
Relates :  
Relates :  
Description
Reverting the change in loopPredicate.cpp:1393 and running the regression test crashes the frequency computation code:
http://cr.openjdk.java.net/~thartmann/8235452/webrev.00/

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/oracle/jdk_jdk/open/src/hotspot/share/opto/loopPredicate.cpp:888), pid=18401, tid=18412
#  assert(_phase->get_loop(c) == loop) failed: have to be in the same loop
#
# JRE version: Java(TM) SE Runtime Environment (14.0) (fastdebug build 14-internal+0-adhoc.tobias.open)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 14-internal+0-adhoc.tobias.open, mixed mode, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x116338b]  PathFrequency::to(Node*)+0x9b
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/tobias/Downloads/tmp2/tmp/core.18401)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -Xbatch -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Test::test -XX:+PrintCompilation -XX:-TieredCompilation -XX:+TraceLoopOpts -XX:+UseG1GC -XX:PrintIdealGraphFile=graph.xml -XX:+PrintIdealGraph -XX:PrintIdealGraphLevel=4 Test

Host: prometheus, Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz, 8 cores, 15G, Ubuntu 18.04.3 LTS
Time: Mon Dec  9 09:28:46 2019 CET elapsed time: 0 seconds (0d 0h 0m 0s)

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

Current thread (0x00007fc3e03cf000):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=18412, stack(0x00007fc3ba8aa000,0x00007fc3ba9ab000)]


Current CompileTask:
C2:    696   29 %  b        Test::test @ 19 (49 bytes)

Stack: [0x00007fc3ba8aa000,0x00007fc3ba9ab000],  sp=0x00007fc3ba9a5080,  free space=1004k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x116338b]  PathFrequency::to(Node*)+0x9b
V  [libjvm.so+0x115feb9]  PhaseIdealLoop::loop_predication_impl(IdealLoopTree*) [clone .part.93]+0x999
V  [libjvm.so+0x11606ba]  IdealLoopTree::loop_predication(PhaseIdealLoop*)+0x1ca
V  [libjvm.so+0x1198519]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xfd9
V  [libjvm.so+0x978e41]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2c1
V  [libjvm.so+0x975cd8]  Compile::Optimize()+0xa08
V  [libjvm.so+0x977565]  Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x1215
V  [libjvm.so+0x7e1140]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x110
V  [libjvm.so+0x9836db]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x2db
V  [libjvm.so+0x9846b8]  CompileBroker::compiler_thread_loop()+0x4d8
V  [libjvm.so+0x16a8db6]  JavaThread::thread_main_inner()+0x206
V  [libjvm.so+0x16adf16]  Thread::call_run()+0xf6
V  [libjvm.so+0x13c955e]  thread_native_entry(Thread*)+0x10e

Comments
Fix request(13u): I'd like to port this for parity with LTS 11u. Applies clean with the current state of jdk13u. Tests do pass.
22-01-2021

11u Fix Request: Backporting this patch eliminates a crash in C2. Patch applies cleanly to 11u once JDK-8235452 is backported. This bug shares the test case from 8235452. As I commented on that bug: test doesn't fail without the patch, enhancement 8220376 is needed for the test to fail (as an experiment I backported it and the test does fail with it). Anyway, bug exists even if the test doesn't fail so I'd like to proceed with the backport. tier1 and tier2 tests pass with the patch.
18-03-2020

URL: https://hg.openjdk.java.net/jdk/jdk14/rev/5bb84e036c14 User: roland Date: 2020-01-16 12:58:47 +0000
16-01-2020

ILW = Assert during C2 compilation, reproducible when partially reverting other change, -XX:-UseProfiledLoopPredicate = HLM = P3
13-01-2020

Roland, could you please have a look? You know that code best :)
09-12-2019