JDK-8257513 : C2: assert((constant_addr - _masm.code()->consts()->start()) == con.offset())
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,11,12,13,14,15,16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-12-01
  • Updated: 2021-02-02
  • Resolved: 2020-12-21
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 16 JDK 17
11.0.11-oracleFixed 16.0.1Fixed 17 b03Fixed
Related Reports
Relates :  
Description
open/test/jdk/java/lang/invoke/PermuteArgsTest.java

Fails with:
assert((constant_addr - _masm.code()->consts()->start()) == con.offset()) failed: must be: 633952 == 0

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/phedlin/gitviews/JDK-8257231/open/src/hotspot/share/opto/constantTable.cpp:162), pid=26420, tid=26434
#  assert((constant_addr - _masm.code()->consts()->start()) == con.offset()) failed: must be: 633952 == 0
#
# JRE version: Java(TM) SE Runtime Environment (16.0) (fastdebug build 16-internal+0-2020-12-01-1027499.phedlin...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 16-internal+0-2020-12-01-1027499.phedlin..., compiled mode, sharing, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xa632d2]  ConstantTable::emit(CodeBuffer&)+0x262
#
# 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/phedlin/gitviews/JDK-8257231/build/linux-x64/test-support/jtreg_open_test_jdk_java_lang_invoke_PermuteArgsTest_java/scratch/core.26420)
#
# 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: -Xbootclasspath/a:/home/phedlin/gitviews/JDK-8257231/build/linux-x64/test-support/jtreg_open_test_jdk_java_lang_invoke_PermuteArgsTest_java/extraPropDefns/bootClasses -Dtest.vm.opts=-Xmx512m -XX:MaxRAMPercentage=1 -Djava.io.tmpdir=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/test-support/jtreg_open_test_jdk_java_lang_invoke_PermuteArgsTest_java/tmp -Xcomp -XX:-TieredCompilation -XX:CompileThreshold=100 -XX:+DeoptimizeALot -XX:+StressCodeBuffers -ea -esa -Dtest.tool.vm.opts=-J-Xmx512m -J-XX:MaxRAMPercentage=1 -J-Djava.io.tmpdir=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/test-support/jtreg_open_test_jdk_java_lang_invoke_PermuteArgsTest_java/tmp -J-Xcomp -J-XX:-TieredCompilation -J-XX:CompileThreshold=100 -J-XX:+DeoptimizeALot -J-XX:+StressCodeBuffers -J-ea -J-esa -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/images/jdk -Dcompile.jdk=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/images/jdk -Dtest.timeout.factor=4.0 -Dtest.nativepath=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/images/test/jdk/jtreg/native -Dtest.root=/home/phedlin/gitviews/JDK-8257231/open/test/jdk -Xmx512m -XX:MaxRAMPercentage=1 -Djava.io.tmpdir=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/test-support/jtreg_open_test_jdk_java_lang_invoke_PermuteArgsTest_java/tmp -Xcomp -XX:-TieredCompilation -XX:CompileThreshold=100 -XX:+DeoptimizeALot -XX:+StressCodeBuffers -ea -esa -Djava.library.path=/home/phedlin/gitviews/JDK-8257231/build/linux-x64/images/test/jdk/jtreg/native -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI com.sun.javatest.regtest.agent.GetJDKProperties --system-properties --modules=boot-layer requires.VMProps

Host: ph2, Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz, 32 cores, 94G, Linux Mint 19.3 Tricia
Time: Tue Dec  1 11:54:19 2020 CET elapsed time: 6.918697 seconds (0d 0h 0m 6s)

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

Current thread (0x00007f2a9c349c00):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=26434, stack(0x00007f2a7d0f8000,0x00007f2a7d1f9000)]


Current CompileTask:
C2:   6918 1707   !b        java.lang.invoke.DirectMethodHandle::createFunction (291 bytes)

Stack: [0x00007f2a7d0f8000,0x00007f2a7d1f9000],  sp=0x00007f2a7d1f4070,  free space=1008k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xa632d2]  ConstantTable::emit(CodeBuffer&)+0x262
V  [libjvm.so+0x15b9d06]  PhaseOutput::fill_buffer(CodeBuffer*, unsigned int*)+0x296
V  [libjvm.so+0xa09fa8]  Compile::Code_Gen()+0x438
V  [libjvm.so+0xa137f7]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, DirectiveSet*)+0x1917
V  [libjvm.so+0x845adc]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1dc
V  [libjvm.so+0xa23978]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xe08
V  [libjvm.so+0xa244c8]  CompileBroker::compiler_thread_loop()+0x5a8
V  [libjvm.so+0x18abc76]  JavaThread::thread_main_inner()+0x256
V  [libjvm.so+0x18b25f0]  Thread::call_run()+0x100
V  [libjvm.so+0x15954e6]  thread_native_entry(Thread*)+0x116


Comments
Fix Request (JDK 16u): This bug leads to an assert during C2 compilation that may in rare cases also affect the product build. The fix is low risk and contains a regression test. The patch applies cleanly to JDK 16u. JDK-8259049 will be backported as well.
28-01-2021

Backporting this to JDK 16.0.1 seems reasonable to me.
11-01-2021

Can consideration be given to also porting this issue to 16u.
08-01-2021

Fix Request (11u) This fixes the corner case in C2 and keeps codebases in sync (I see 11.0.11-oracle). Patch does not apply to 11u cleanly, because the code was moved. 11u RFR (acked by kvn): https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-January/004573.html
07-01-2021

Changeset: 8e42efaa Author: Christian Hagedorn <chagedorn@openjdk.org> Date: 2020-12-21 08:06:48 +0000 URL: https://git.openjdk.java.net/jdk/commit/8e42efaa
21-12-2020

ILW = Assert during C2 compilation, with debug option -XX:+StressCodeBuffers, no workaround but disable stress option or compilation of affected method = HLM = P3
04-12-2020

ConstantTable::emit doesn't cope with effects of -XX:+StressCodeBuffers.
01-12-2020