JDK-8210762 : [lworld] hotspot test Unsafe/RangeCheck.java fails with -Xcomp -XX:+EnableValhalla
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-09-14
  • Updated: 2018-11-27
  • Resolved: 2018-09-24
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.
Other
repo-valhallaFixed
Related Reports
Relates :  
Relates :  
Description
Test hotspot/jtreg/runtime/Unsafe/RangeCheck.java fails with the following assert when run with "-Xcomp -XX:+EnableValhalla".

#  Internal Error (.../open/src/hotspot/share/opto/compile.cpp:1451), pid=57803, tid=57814
#  assert(InlineUnsafeOps) failed: indeterminate pointers come only from unsafe ops
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 12-lworldea+0-2018-09-06-1320400.hseigel.vtlworldcl.mach5new, compiled mode, compressed oops, g1 gc, linux-amd64)
# CreateCoredumpOnCrash turned off, no core file dumped
#

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

Command Line: -XX:+EnableValhalla -Xcomp -Xmx128m --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED -XX:-CreateCoredumpOnCrash -XX:-InlineUnsafeOps RangeCheck$DummyClassWithMainRangeCheck

Host: busaa027.us.oracle.com, Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz, 72 cores, 503G, Oracle Linux Server release 7.0
Time: Fri Sep 14 13:33:58 2018 EDT elapsed time: 5 seconds (0d 0h 0m 5s)

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

Current thread (0x00007f81d0391800):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=57814, stack(0x00007f81b2149000,0x00007f81b224a000)]


Current CompileTask:
C2:   5211  551    b        java.lang.reflect.Array::newInstance (6 bytes)

Stack: [0x00007f81b2149000,0x00007f81b224a000],  sp=0x00007f81b2245e00,  free space=1011k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1918b83]  VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x2c3
V  [libjvm.so+0x191994f]  VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, __va_list_tag*)+0x2f
V  [libjvm.so+0xb49ec0]  report_vm_error(char const*, int, char const*, char const*, ...)+0x100
V  [libjvm.so+0xa4f9db]  Compile::flatten_alias_type(TypePtr const*) const+0xd9b
V  [libjvm.so+0xa57c94]  Compile::find_alias_type(TypePtr const*, bool, ciField*)+0x74
V  [libjvm.so+0x67bd5c]  BarrierSetC2::load_at_resolved(C2Access&, Type const*) const+0xfc
V  [libjvm.so+0xcbbf7a]  G1BarrierSetC2::load_at_resolved(C2Access&, Type const*) const+0x6a
V  [libjvm.so+0x67d924]  BarrierSetC2::load_at(C2Access&, Type const*) const+0x5f4
V  [libjvm.so+0xdf7ea7]  GraphKit::access_load_at(Node*, Node*, TypePtr const*, Type const*, BasicType, unsigned long)+0xd7
V  [libjvm.so+0xdf943a]  GraphKit::new_array(Node*, Node*, int, Node**, bool)+0x122a
V  [libjvm.so+0x1230b83]  LibraryCallKit::inline_unsafe_newArray(bool)+0x273
V  [libjvm.so+0x124670f]  LibraryIntrinsic::generate(JVMState*)+0xaf
V  [libjvm.so+0xc3e757]  Parse::do_call()+0x527
V  [libjvm.so+0x156c926]  Parse::do_one_bytecode()+0x2d26
V  [libjvm.so+0x155793a]  Parse::do_one_block()+0x44a
V  [libjvm.so+0x1558d41]  Parse::do_all_blocks()+0xe1
V  [libjvm.so+0x155cc89]  Parse::Parse(JVMState*, ciMethod*, float)+0xe29
V  [libjvm.so+0x848d4c]  ParseGenerator::generate(JVMState*)+0x8c
V  [libjvm.so+0xa62aeb]  Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0xaab
V  [libjvm.so+0x846b51]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0xd1
V  [libjvm.so+0xa70319]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x409
V  [libjvm.so+0xa71337]  CompileBroker::compiler_thread_loop()+0x367
V  [libjvm.so+0x182bd27]  JavaThread::thread_main_inner()+0x2c7
V  [libjvm.so+0x182c05a]  JavaThread::run()+0x22a
V  [libjvm.so+0x14fa490]  thread_native_entry(Thread*)+0x100

Comments
http://hg.openjdk.java.net/valhalla/valhalla/rev/ccc5a29b1200
24-09-2018

http://cr.openjdk.java.net/~thartmann/8210762/webrev.00/
21-09-2018

Straight forward fix: diff -r a790155817c2 src/hotspot/share/opto/compile.cpp --- a/src/hotspot/share/opto/compile.cpp Fri Sep 14 17:11:12 2018 +0200 +++ b/src/hotspot/share/opto/compile.cpp Sun Sep 16 13:04:34 2018 -0400 @@ -1448,7 +1448,8 @@ // Process weird unsafe references. if (offset == Type::OffsetBot && (tj->isa_instptr() /*|| tj->isa_klassptr()*/)) { - assert(InlineUnsafeOps, "indeterminate pointers come only from unsafe ops"); + bool default_value_load = EnableValhalla && tj->is_instptr()->klass() == ciEnv::current()->Class_klass(); + assert(InlineUnsafeOps || default_value_load, "indeterminate pointers come only from unsafe ops"); assert(!is_known_inst, "scalarizable allocation should not have unsafe references"); tj = TypeOopPtr::BOTTOM; ptr = tj->ptr();
16-09-2018

The problem is this load of the default oop added by JDK-8189802: http://hg.openjdk.java.net/valhalla/valhalla/rev/b826402f953a#l9.123
16-09-2018