JDK-8228888 : C2 compilation fails with assert "m has strange control"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,10,11,12,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-07-31
  • Updated: 2020-06-01
  • Resolved: 2019-08-20
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 Other
11.0.6Fixed 13.0.4Fixed 14 b11Fixed openjdk8u232Fixed
Related Reports
Relates :  
Description
#  Internal Error (/oracle/jdk_jdk/open/src/hotspot/share/opto/loopopts.cpp:327), pid=8199, tid=8213
#  assert(m->is_Phi() || is_dominator(get_ctrl(m), n_ctrl)) failed: m has strange control

Current CompileTask:
C2:   3174  581 %  b  4       compiler.loopopts.StrangeControl::test @ 7 (24 bytes)

Stack: [0x00007f04146a6000,0x00007f04147a7000],  sp=0x00007f04147a1410,  free space=1005k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1209c74]  PhaseIdealLoop::has_local_phi_input(Node*)+0x364
V  [libjvm.so+0x120c2fd]  PhaseIdealLoop::split_if_with_blocks_pre(Node*) [clone .part.132]+0x10d
V  [libjvm.so+0x120dc4f]  PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x1af
V  [libjvm.so+0x12043b2]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xfe2
V  [libjvm.so+0x9c7d61]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2c1
V  [libjvm.so+0x9c4539]  Compile::Optimize()+0x3a9
V  [libjvm.so+0x9c6306]  Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x1136
V  [libjvm.so+0x8004ed]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x10d
V  [libjvm.so+0x9d28cb]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x2db
V  [libjvm.so+0x9d38c8]  CompileBroker::compiler_thread_loop()+0x4f8
V  [libjvm.so+0x1827d36]  JavaThread::thread_main_inner()+0x1b6
V  [libjvm.so+0x182d476]  Thread::call_run()+0xf6
V  [libjvm.so+0x142c0ae]  thread_native_entry(Thread*)+0x10e
Comments
Fix Request (13u) This fixes C2 false assertion failure that obscures later (real) assertion failures. Patch applies cleanly to 11u, passes tier1. test passes with fix.
26-05-2020

Fix Request (8u) This fixes C2 false assertion failure that obscures later (real) assertion failures. Patch applies cleanly to 8u. New test fails without the fix, passes with it. No new failures with tier1 testing.
09-10-2019

Fix Request (11u) This fixes C2 false assertion failure that obscures later (real) assertion failures. Patch applies cleanly to 11u, passes tier1, tier2 tests. New test fails without the fix, passes with it.
02-09-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/aff991f6e64d User: thartmann Date: 2019-08-20 05:47:35 +0000
20-08-2019

The assert triggers when OSR compiling an infinite loop with two back branches (see StrangeControl.jasm): http://cr.openjdk.java.net/~thartmann/8228888/8228888_graph.png PhaseIdealLoop::has_local_phi_input() tries to determine if all inputs of n (118 Phi) are block local phis. When looking at input m (108 StoreI), the assert fires because m is not a Phi and control of m (102 IfFalse) does not dominate control of n (83 Region). I think the assert which was added by JDK-8187822 is too strong. If n is a Phi itself, control of all its inputs does not need to dominate its own control.
07-08-2019

Given that JDK-8187822 was backported to 8, adding affected versions.
07-08-2019

Assert was added by JDK-8187822. ILW = Assert in C2 during loop opts (doesn't affect product), never showed up but reproducible with test, disable compilation or loop opts = MMM = P3
31-07-2019

http://cr.openjdk.java.net/~thartmann/8228888/webrev.00/
31-07-2019