Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8222128

[lworld] Assertion failure in ci with flattenable non-flattened field inside a flattened field




      When a value field is flattened, and this value field include a flattenable but not flattened field, it triggers an assertion failure in ciField:

      # A fatal error has been detected by the Java Runtime Environment:
      # Internal Error (/home.local/fred/WORK/Valhalla/gate/valhalla/open/src/hotspot/share/ci/ciField.cpp:238), pid=23045, tid=23056
      # assert(!field->is_flattenable()) failed: field must not be flattenable
      # JRE version: Java(TM) SE Runtime Environment (13.0) (fastdebug build 13-lworldea+0-2019-04-04-1729120.fred.null)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 13-lworldea+0-2019-04-04-1729120.fred.null, compiled mode, compressed oops, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x869b8f] ciField::ciField(ciField*, ciInstanceKlass*, int, bool)+0x17f
      # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
      # 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: -Xcomp -XX:+EnableValhalla --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main LayoutTest.java

      Host: dalk, Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz, 16 cores, 31G, Ubuntu 18.10
      Time: Mon Apr 8 09:54:09 2019 EDT elapsed time: 55 seconds (0d 0h 0m 55s)

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

      Current thread (0x00007fe17844e000): JavaThread "C2 CompilerThread0" daemon [_thread_in_vm, id=23056, stack(0x00007fe14b58b000,0x00007fe14b68c000)]

      Current CompileTask:
      C2: 55983 7806 b LayoutTest::work (28 bytes)

      Stack: [0x00007fe14b58b000,0x00007fe14b68c000], sp=0x00007fe14b6885e0, free space=1013k
      Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x869b8f] ciField::ciField(ciField*, ciInstanceKlass*, int, bool)+0x17f
      V [libjvm.so+0x87b17c] ciInstanceKlass::compute_nonstatic_fields_impl(GrowableArray<ciField*>*, bool)+0xdec
      V [libjvm.so+0x87b7bd] ciInstanceKlass::compute_nonstatic_fields()+0x24d
      V [libjvm.so+0x875629] ciInstanceKlass::get_field_by_offset(int, bool)+0x119
      V [libjvm.so+0x16cc74b] TypeOopPtr::TypeOopPtr(Type::TYPES, TypePtr::PTR, ciKlass*, bool, ciObject*, Type::Offset, Type::Offset, int, TypePtr const*, int)+0x27b
      V [libjvm.so+0x16cd830] TypeInstPtr::TypeInstPtr(TypePtr::PTR, ciKlass*, bool, ciObject*, Type::Offset, int, TypePtr const*, int)+0x40
      V [libjvm.so+0x16cd9e0] TypeInstPtr::make(TypePtr::PTR, ciKlass*, bool, ciObject*, Type::Offset, int, TypePtr const*, int) [clone .constprop.192]+0x130
      V [libjvm.so+0x16ce21d] TypeInstPtr::add_offset(long) const+0xcd
      V [libjvm.so+0x9adc87] Compile::alias_type(ciField*)+0x77
      V [libjvm.so+0x14136a6] Parse::do_get_xxx(Node*, ciField*)+0x76
      V [libjvm.so+0x14185f2] Parse::do_field_access(bool, bool)+0x6f2
      V [libjvm.so+0x1411a5c] Parse::do_one_bytecode()+0x2d7c
      V [libjvm.so+0x13fb6e0] Parse::do_one_block()+0x650
      V [libjvm.so+0x13fc1a3] Parse::do_all_blocks()+0x113
      V [libjvm.so+0x13ffdd2] Parse::Parse(JVMState*, ciMethod*, float)+0xd52
      V [libjvm.so+0x7ef1bc] ParseGenerator::generate(JVMState*)+0x18c
      V [libjvm.so+0x9bfa84] Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0xed4
      V [libjvm.so+0x7eca1d] C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x10d
      V [libjvm.so+0x9cc6ad] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x32d
      V [libjvm.so+0x9cd4a8] CompileBroker::compiler_thread_loop()+0x378
      V [libjvm.so+0x169b2f6] JavaThread::thread_main_inner()+0x1b6
      V [libjvm.so+0x16a0826] Thread::call_run()+0xf6
      V [libjvm.so+0x13a979d] thread_native_entry(Thread*)+0x10d

      The following code reproduces the problem (must be executed wth -Xcomp):

      public class LayoutTest {

          Small.val small;;
          Big.val big;;

          public LayoutTest() {
      small = new Small();
      big = new Big();
          static value class Small {
      final int i;
      final Big.val big;

      private Small() {
      i = 3;
      big = new Big();

          static value class Big {
      long l0,l1,l2,l3,l4,l5,l6,l7,l8,l9;
      long l10,l11,l12,l13,l14,l15,l16,l17,l18,l19;
      long l20,l21,l22,l23,l24,l25,l26,l27,l28,l29;

      private Big() {
      l0 = l1 = l2 = l3 = l4 = l5 = l6 = l7 = l8 = l9 = 5;
      l10 = l11 = l12 = l13 = l14 = l15 = l16 = l17 = l18 = l19 = 7;
      l20 = l21 = l22 = l23 = l24 = l25 = l26 = l27 = l28 = l29 = 11;

          public static void main(String[] args) {
      LayoutTest test = new LayoutTest();
      long l = test.work();

          long work() {
      return small.i + small.big.l0 + big.l0;




            thartmann Tobias Hartmann
            fparain Frederic Parain
            0 Vote for this issue
            2 Start watching this issue