JDK-8246153 : TestEliminateArrayCopy fails with -XX:+StressReflectiveCode
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-05-29
  • Updated: 2020-06-24
  • Resolved: 2020-06-02
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 15
11.0.9-oracleFixed 15 b26Fixed
Description
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/oracle/jdk_jdk/open/src/hotspot/share/opto/macro.cpp:980), pid=20982, tid=20997
#  assert(alloc->in(0)->is_Proj() && alloc->in(0)->in(0)->Opcode() == Op_MemBarCPUOrder) failed: mem barrier expected before allocation
#
# JRE version: Java(TM) SE Runtime Environment (15.0) (fastdebug build 15-internal+0-2020-05-26-1033362.tobias...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 15-internal+0-2020-05-26-1033362.tobias..., mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x118ac58]  PhaseMacroExpand::process_users_of_allocation(CallNode*)+0x698
#
# 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 /oracle/jdk_jdk/open/JTwork/scratch/core.20982)
#
# 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: -Dtest.file=/oracle/jdk_jdk/open/test/hotspot/jtreg/compiler/arraycopy/TestEliminateArrayCopy.java -Dtest.src=/oracle/jdk_jdk/open/test/hotspot/jtreg/compiler/arraycopy -Dtest.src.path=/oracle/jdk_jdk/open/test/hotspot/jtreg/compiler/arraycopy:/oracle/jdk_jdk/open/test/hotspot/jtreg -Dtest.classes=/oracle/jdk_jdk/open/JTwork/classes/compiler/arraycopy/TestEliminateArrayCopy.d -Dtest.class.path=/oracle/jdk_jdk/open/JTwork/classes/compiler/arraycopy/TestEliminateArrayCopy.d:/oracle/jdk_jdk/open/JTwork/classes -Dtest.vm.opts= -Dtest.tool.vm.opts= -Dtest.compiler.opts= -Dtest.java.opts=-XX:+StressReflectiveCode -Dtest.jdk=/oracle/jdk_jdk/build/linux-x64/jdk -Dcompile.jdk=/oracle/jdk_jdk/build/linux-x64/jdk -Dtest.timeout.factor=1.0 -Dtest.root=/oracle/jdk_jdk/open/test/hotspot/jtreg -XX:+StressReflectiveCode -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m* com.sun.javatest.regtest.agent.MainWrapper /oracle/jdk_jdk/open/JTwork/compiler/arraycopy/TestEliminateArrayCopy.d/main.0.jta

Host: prometheus, Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz, 8 cores, 15G, Ubuntu 18.04.4 LTS
Time: Fri May 29 14:11:00 2020 CEST elapsed time: 1.541864 seconds (0d 0h 0m 1s)

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

Current thread (0x00007fccfc33fc70):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=20997, stack(0x00007fcce0602000,0x00007fcce0703000)]


Current CompileTask:
C2:   1541  633    b  4       compiler.arraycopy.TestEliminateArrayCopy$CloneTests::m1 (6 bytes)

Stack: [0x00007fcce0602000,0x00007fcce0703000],  sp=0x00007fcce06fe590,  free space=1009k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x118ac58]  PhaseMacroExpand::process_users_of_allocation(CallNode*)+0x698
V  [libjvm.so+0x11947ea]  PhaseMacroExpand::eliminate_allocate_node(AllocateNode*) [clone .part.0]+0x2fa
V  [libjvm.so+0x1194f2d]  PhaseMacroExpand::eliminate_macro_nodes()+0x5cd
V  [libjvm.so+0x8fd441]  Compile::Optimize()+0xe31
V  [libjvm.so+0x8feecc]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x15bc
V  [libjvm.so+0x74c125]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x175
V  [libjvm.so+0x90d76e]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x45e
V  [libjvm.so+0x90ee08]  CompileBroker::compiler_thread_loop()+0x6b8
V  [libjvm.so+0x169383c]  JavaThread::thread_main_inner()+0x21c
V  [libjvm.so+0x1699660]  Thread::call_run()+0x100
V  [libjvm.so+0x139eb86]  thread_native_entry(Thread*)+0x116
Comments
Fix request (11u) -- will label after testing completed. I would like to downport this for parity with 11.0.9-oracle. The change does not apply, the code looks quite different in 11: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-June/003343.html Review: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-June/003353.html
24-06-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/0b2fc7e19361 User: thartmann Date: 2020-06-02 07:08:23 +0000
02-06-2020

With -XX:+StressReflectiveCode, loads from the layout helper emitted by GraphKit::get_layout_helper are not folded (usually done via LoadNode::Value -> LoadNode::load_array_final_field). As a result, the control input of the AllocateNode does not directly point to the MemBar but to the initial_slow_test emitted by GraphKit::new_instance that has not been folded either. Instead of using the control input to find the MemBar when removing allocations after scalar replacement, we should simply use the memory input: http://cr.openjdk.java.net/~thartmann/8246153/webrev.00/
29-05-2020

ILW = Assert during C2 compilation, with debug stress option, disable debug option or scalar replacement = MLM = P4
29-05-2020