[lworld] RFR: [lworld] C1 compilation fails when PinAllInstructions is turned on

Yi Yang github.com+5010047+kelthuzadx at openjdk.java.net
Mon Mar 1 11:55:15 UTC 2021


When turning on the -XX:+PinAllInstructions, C1 hits the following assertion:

`
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/qingfeng.yy/valhalla/src/hotspot/share/c1/c1_LIRGenerator.cpp:1524), pid=81974, tid=81994
#  assert(!x->is_pinned()) failed: only for unpinned constants
...
Stack: [0x00007fc0771fa000,0x00007fc0772fb000],  sp=0x00007fc0772f89f0,  free space=1018k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x65de6c]  LIRGenerator::load_constant(Constant*)+0x2a
V  [libjvm.so+0x65ee4b]  LIRGenerator::access_sub_element(LIRItem&, LIRItem&, LIR_OprDesc*&, ciField*, int)+0x319
V  [libjvm.so+0x66209c]  LIRGenerator::do_LoadIndexed(LoadIndexed*)+0x846
V  [libjvm.so+0x6277c4]  LoadIndexed::visit(InstructionVisitor*)+0x2e
V  [libjvm.so+0x6586ae]  LIRGenerator::do_root(Instruction*)+0xfc
V  [libjvm.so+0x65856e]  LIRGenerator::block_do(BlockBegin*)+0x7c
V  [libjvm.so+0x62696d]  BlockList::iterate_forward(BlockClosure*)+0x5d
V  [libjvm.so+0x61ee24]  IR::iterate_linear_scan_order(BlockClosure*)+0x2e
V  [libjvm.so+0x5ee90b]  Compilation::emit_lir()+0x95
V  [libjvm.so+0x5ef140]  Compilation::compile_java_method()+0x21e
V  [libjvm.so+0x5ef4af]  Compilation::compile_method()+0x107
V  [libjvm.so+0x5efd05]  Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, bool, DirectiveSet*)+0x3bb
V  [libjvm.so+0x5f3baf]  Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0xd9
V  [libjvm.so+0x81a938]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x88a
V  [libjvm.so+0x81956b]  CompileBroker::compiler_thread_loop()+0x3df
V  [libjvm.so+0x83bef1]  CompilerThread::thread_entry(JavaThread*, Thread*)+0x69
V  [libjvm.so+0x12fd598]  JavaThread::thread_main_inner()+0x14c
V  [libjvm.so+0x12fd444]  JavaThread::run()+0x11e
V  [libjvm.so+0x12fa630]  Thread::call_run()+0x180
V  [libjvm.so+0x1028936]  thread_native_entry(Thread*)+0x1e4
`

The root cause of this crash is because LIRGenerator::access_sub_element() uses LIRGenerator::load_constant() to load the default value of a primitive class type(constant) into a register, load_constant requires unpinned constant instr, so it unquestionably crashes when PinAllInstructions is enabled.

This problem also occurred in many places under `test/hotspot/jtreg/compiler/valhalla`. After applying this patch, they all passed with slowdebug build.

Thanks,
Yang

-------------

Commit messages:
 - PinAllInstructions hits some assertions

Changes: https://git.openjdk.java.net/valhalla/pull/355/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=355&range=00
  Stats: 15 lines in 1 file changed: 12 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/355.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/355/head:pull/355

PR: https://git.openjdk.java.net/valhalla/pull/355



More information about the valhalla-dev mailing list