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

[lworld] JITs need to properly handle static inline type field with unloaded type

    XMLWordPrintable

Details

    Description

      Running runtime/valhalla/inlinetypes/CircularityTest.java with -Xcomp triggers compilation of the static initializer of CircularityTest$B which contains an access to a static inline type field with unloaded type.

      C1 crashes with:

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/opt/mach5/mesos/work_dir/slaves/ff806ead-2cac-495d-9cbc-62116f99bf14-S14161/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/d1022ba1-d7ea-4bf2-b8ce-2a145f73e2ac/runs/ed978567-bfa0-4b2d-a463-1b9bc997ce93/workspace/open/src/hotspot/share/c1/c1_LIRGenerator.cpp:2050), pid=3369, tid=3387
      # assert(!could_be_null || !field->holder()->is_loaded()) failed: inline type field should be loaded
      #
      # JRE version: Java(TM) SE Runtime Environment (18.0) (fastdebug build 18-lworld3ea+0-2021-09-09-1338040.tobias.hartmann.valhalla3)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 18-lworld3ea+0-2021-09-09-1338040.tobias.hartmann.valhalla3, compiled mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x7847c2] LIRGenerator::inline_type_field_access_prolog(AccessField*, CodeEmitInfo*)+0x212

      Current CompileTask:
      C1: 136414 19542 b 3 runtime.valhalla.inlinetypes.CircularityTest$B::<clinit> (12 bytes)

      Stack: [0x00007f2ce85fa000,0x00007f2ce86fb000], sp=0x00007f2ce86f8d50, free space=1019k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x7847c2] LIRGenerator::inline_type_field_access_prolog(AccessField*, CodeEmitInfo*)+0x212
      V [libjvm.so+0x79c899] LIRGenerator::do_LoadField(LoadField*)+0xe9
      V [libjvm.so+0x782184] LIRGenerator::do_root(Instruction*)+0xa4
      V [libjvm.so+0x7860de] non-virtual thunk to LIRGenerator::block_do(BlockBegin*)+0x5e
      V [libjvm.so+0x7458f4] BlockList::iterate_forward(BlockClosure*)+0x94
      V [libjvm.so+0x700669] Compilation::emit_lir()+0x5c9
      V [libjvm.so+0x70366f] Compilation::compile_java_method()+0x3ff
      V [libjvm.so+0x7042e0] Compilation::compile_method()+0x1d0
      V [libjvm.so+0x704d5a] Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, bool, DirectiveSet*)+0x3ca
      V [libjvm.so+0x706293] Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1a3
      V [libjvm.so+0xa639f1] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xd31
      V [libjvm.so+0xa64728] CompileBroker::compiler_thread_loop()+0x598
      V [libjvm.so+0x1966a1c] JavaThread::thread_main_inner()+0x27c
      V [libjvm.so+0x196d040] Thread::call_run()+0x100
      V [libjvm.so+0x161dfa4] thread_native_entry(Thread*)+0x104

      C2 crashes with:

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/opt/mach5/mesos/work_dir/slaves/ff806ead-2cac-495d-9cbc-62116f99bf14-S14161/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/d1022ba1-d7ea-4bf2-b8ce-2a145f73e2ac/runs/ed978567-bfa0-4b2d-a463-1b9bc997ce93/workspace/open/src/hotspot/share/ci/ciMetadata.hpp:112), pid=23942, tid=23970
      # assert(is_inlinetype()) failed: bad cast
      #
      # JRE version: Java(TM) SE Runtime Environment (18.0) (fastdebug build 18-lworld3ea+0-2021-09-09-1338040.tobias.hartmann.valhalla3)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 18-lworld3ea+0-2021-09-09-1338040.tobias.hartmann.valhalla3, compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x1684414] Parse::do_get_xxx(Node*, ciField*)+0x824

      Current CompileTask:
      C2: 38981 5832 b runtime.valhalla.inlinetypes.CircularityTest$B::<clinit> (12 bytes)

      Stack: [0x00007f8014afb000,0x00007f8014bfc000], sp=0x00007f8014bf8940, free space=1014k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x1684414] Parse::do_get_xxx(Node*, ciField*)+0x824
      V [libjvm.so+0x1686042] Parse::do_field_access(bool, bool)+0x502
      V [libjvm.so+0x167ff70] Parse::do_one_bytecode()+0x1d20
      V [libjvm.so+0x1666618] Parse::do_one_block()+0x838
      V [libjvm.so+0x1667540] Parse::do_all_blocks()+0x130
      V [libjvm.so+0x166c68c] Parse::Parse(JVMState*, ciMethod*, float)+0xe1c
      V [libjvm.so+0x848e65] ParseGenerator::generate(JVMState*)+0x115
      V [libjvm.so+0xa5369b] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x143b
      V [libjvm.so+0x844640] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x6a0
      V [libjvm.so+0xa639f1] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xd31
      V [libjvm.so+0xa64728] CompileBroker::compiler_thread_loop()+0x598
      V [libjvm.so+0x1966a1c] JavaThread::thread_main_inner()+0x27c
      V [libjvm.so+0x196d040] Thread::call_run()+0x100
      V [libjvm.so+0x161dfa4] thread_native_entry(Thread*)+0x104

      Attachments

        Issue Links

          Activity

            People

              thartmann Tobias Hartmann
              thartmann Tobias Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: