JDK-8226627 : assert(t->singleton()) failed: must be a constant
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11.0.12,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-06-22
  • Updated: 2021-04-06
  • Resolved: 2019-07-05
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
11.0.12Fixed 13 b29Fixed 14Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
CTW of SPECjvm2008 hit the following assert on macosx-x64:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/scratch/mesos/slaves/8cd6f162-51f6-4a7f-a76b-32ddeb30fb11-S13073/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/2bf8df6d-ff2d-4a35-9d55-2d93b1dea2c1/runs/01230338-cd62-4864-85d4-72b24e29f3ff/workspace/open/src/hotspot/share/opto/phaseX.cpp:737), pid=64776, tid=22019
#  assert(t->singleton()) failed: must be a constant
#
# JRE version: Java(TM) SE Runtime Environment (13.0) (fastdebug build 13-ea+0-1370)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 13-ea+0-1370, mixed mode, sharing, compressed oops, g1 gc, bsd-amd64)
# Core dump will be written. Default location: /cores/core.64776
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

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

Command Line: -XX:MaxRAMPercentage=6 -XX:+CreateCoredumpOnCrash -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -XX:-TieredCompilation -Xbatch -XX:-UseCounterDecay -XX:-ShowMessageBoxOnError -XX:+UnlockDiagnosticVMOptions -XX:+DisplayVMOutputToStderr -DCompileTheWorldStartAt=0 -DCompileTheWorldStopAt=524 -XX:+WhiteBoxAPI -Xbootclasspath/a:. --add-exports=java.base/jdk.internal.jimage=ALL-UNNAMED --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED --add-exports=java.base/jdk.internal.access=ALL-UNNAMED -XX:+LogCompilation -XX:LogFile=hotspot_jfreechart-1.0.5.jar_0_%p.log -XX:ErrorFile=hs_err_jfreechart-1.0.5.jar_0_%p.log -XX:ReplayDataFile=replay_jfreechart-1.0.5.jar_0_%p.log -XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.* sun.hotspot.tools.ctw.CompileTheWorld /scratch/mesos/jib-master/install/org/spec/SPECjvm2008/1.00/SPECjvm2008-1.00.zip/SPECjvm2008/lib/jfreechart-1.0.5.jar

Host: <host>, MacPro6,1 x86_64 3700 MHz, 8 cores, 16G, Darwin 17.5.0
Time: Fri Jun 21 23:46:09 2019 GMT elapsed time: 24 seconds (0d 0h 0m 24s)

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

Current thread (0x00007fe093850000):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=22019, stack(0x000070000e911000,0x000070000ea11000)]


Current CompileTask:
C2:  24971 3317    b        org.jfree.chart.block.BorderArrangement::arrangeRR (624 bytes)

Stack: [0x000070000e911000,0x000070000ea11000],  sp=0x000070000ea0d250,  free space=1008k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0xc0d562]  VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x6de
V  [libjvm.dylib+0xc0dc3d]  VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x47
V  [libjvm.dylib+0x419f1c]  report_vm_error(char const*, int, char const*, char const*, ...)+0x145
V  [libjvm.dylib+0xa47215]  PhaseTransform::makecon(Type const*)+0x3b
V  [libjvm.dylib+0x19ec2a]  AddNode::Ideal(PhaseGVN*, bool)+0x1da
V  [libjvm.dylib+0xa49572]  PhaseIterGVN::transform_old(Node*)+0x1ba
V  [libjvm.dylib+0xa49132]  PhaseIterGVN::optimize()+0xae
V  [libjvm.dylib+0x3927a5]  Compile::Optimize()+0x7c9
V  [libjvm.dylib+0x390db4]  Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0xaaa
V  [libjvm.dylib+0x2c012e]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0xdc
V  [libjvm.dylib+0x3a3c8e]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x6da
V  [libjvm.dylib+0x3a33dd]  CompileBroker::compiler_thread_loop()+0x283
V  [libjvm.dylib+0xb8c101]  JavaThread::thread_main_inner()+0x1a1
V  [libjvm.dylib+0xb8bcb4]  JavaThread::run()+0x2aa
V  [libjvm.dylib+0xb8876b]  Thread::call_run()+0x11b
V  [libjvm.dylib+0x9f46e4]  thread_native_entry(Thread*)+0x13a
C  [libsystem_pthread.dylib+0x3661]  _pthread_body+0x154
C  [libsystem_pthread.dylib+0x350d]  _pthread_body+0x0
C  [libsystem_pthread.dylib+0x2bf9]  thread_start+0xd
Comments
Fix Request (11u): Backport this fix as a follow-up to JDK-8212043 and JDK-8217561 backports. Original patch applies cleanly. Testing: tier1, tier2 (linux-aarch64, linux-x86_64).
29-03-2021

Should be included with JDK-8212043 and JDK-8217561 backports to 11u.
28-03-2021

//------------------------------add_ring--------------------------------------- // Supplied function returns the sum of the inputs. // This also type-checks the inputs for sanity. Guaranteed never to // be passed a TOP or BOTTOM type, these are filtered out by pre-check. const Type *AddFNode::add_ring( const Type *t0, const Type *t1 ) const { // We must be adding 2 float constants. return TypeF::make( t0->getf() + t1->getf() ); } doesn't do any special handling for inf/-inf nan cases, so presumes standards to support it.
02-07-2019

from mails Andrew Haley : Please think also about constant propagation. This: @Benchmark public double constExpr() { double tmp = dnums[33]; for (int i = 1; i < SIZE; i++) { tmp = min(dnums[27], min(0.1, min(1.1, min(2.1, min(3.1, min(4.1, min(5.1, min(6.1, min(7.1, min(8.1, min(9.1, dnums[12]))))))))))); } return tmp; } } causes an Internal Error (/home/aph/jdk-jdk/src/hotspot/share/opto/phaseX.cpp:691) when I run it with your patch. I think you are not handling the case where both arguments are constant, and you need to do that. It might be sufficient simply to say if (a->is_Con() || b->is_Con()) { return false; } http://openjdk.5641.n7.nabble.com/RFR-M-8212043-Add-floating-point-Math-min-max-intrinsics-tt353924.html#a359786
29-06-2019

constant cases were disabled for this intrinsics. but still some cases it found later to be constants and tried to fold. i tried implementing constant folding here [1] . but real fix should be to check why constant folding is disabled at first place. and do necessary actions. [1] http://cr.openjdk.java.net/~jcm/8226627/webrev/ (some typos, updated inplace)
29-06-2019

from the comments it looks like case of missing implementation. so going ahead with MinFD/MaxFD constant fold implementation.
29-06-2019

> Is this the same issue as JDK-8226646? No, it's a different issue. Setting fix version to 13 because this is a regression.
26-06-2019

the changes that was added with JDK-8212043 caused this issue. the add_ring code for MaxF/MaxD/MinD/MinF should be similar to MaxI/MinI. rather than returning bottom type all the time.
26-06-2019

Is this the same issue as JDK-8226646? Please note that this has caused tier 3 failures since JDK-8044164 was integrated.
25-06-2019

w/ -Djava.awt.headless=true, it happes on windows and linux as well.
25-06-2019