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

UnexpectedDeoptimizationAllTest.java crashes in C1 during nmethod registration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 25
    • hotspot

      The jtreg test compiler/codecache/stress/UnexpectedDeoptimizationAllTest.java triggered this issue on a POWER10 64 thread SUSE Linux Enterprise Server 15 SP6 machine (observed only once, unclear if it is platform specific):

      # fatal error: not a NativeCall at 0x00007fff7ca20c40

      --------------- T H R E A D ---------------
      Current thread (0x00007fff2c1ca5f0): JavaThread "C1 CompilerThread4" daemon [_thread_in_vm, id=36509, stack(0x00007fff4ce00000,0x00007fff4d200000) (4096K)]

      Current CompileTask:
      C1:937 1400 3 java.lang.StringCoding::countNonZeroAscii (30 bytes)
      Stack: [0x00007fff4ce00000,0x00007fff4d200000], sp=0x00007fff4d1fcc50, free space=4083k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x16d0cdc] NativeCall::verify()+0x8c (nativeInst_ppc.cpp:159)
      V [libjvm.so+0x1946bac] Relocation::pd_call_destination(unsigned char*)+0x31c (nativeInst_ppc.hpp:177)
      V [libjvm.so+0x1945da4] CallRelocation::value()+0x24 (relocInfo.hpp:950)
      V [libjvm.so+0x16e587c] nmethod::verify_scopes() [clone .part.0]+0x21c (nmethod.cpp:3052)
      V [libjvm.so+0x16f0e58] nmethod::verify()+0x508 (nmethod.cpp:2997)
      V [libjvm.so+0x16f13e0] nmethod::new_nmethod(methodHandle const&, int, int, CodeOffsets*, int, DebugInformationRecorder*, Dependencies*, CodeBuffer*, int, OopMapSet*, ExceptionHandlerTable*, ImplicitExceptionTable*, AbstractCompiler*, CompLevel)+0x3b0 (nmethod.cpp:1226)
      V [libjvm.so+0x832e24] ciEnv::register_method(ciMethod*, int, CodeOffsets*, int, CodeBuffer*, int, OopMapSet*, ExceptionHandlerTable*, ImplicitExceptionTable*, AbstractCompiler*, bool, bool, bool, bool, int)+0x604 (ciEnv.cpp:1062)
      V [libjvm.so+0x61e390] Compilation::install_code(int)+0x120 (c1_Compilation.cpp:424)
      V [libjvm.so+0x623a90] Compilation::compile_method()+0x640 (c1_Compilation.cpp:487)
      ...

      The address which was incorrectly assumed to refer to a NativeCall points to the entry point (prolog) of the new nmethod which is being registered:
         0x7fff7ca20c40: .long 0x0
         0x7fff7ca20c44: addis r11,r1,-2
         0x7fff7ca20c48: std r0,0(r11)
         0x7fff7ca20c4c: std r20,16(r1)
         0x7fff7ca20c50: stdu r1,-112(r1)
         0x7fff7ca20c54: addis r20,r29,16
         0x7fff7ca20c58: addi r20,r20,-19328
         0x7fff7ca20c5c: mtctr r20
         0x7fff7ca20c60: lis r20,0
         0x7fff7ca20c64: ori r20,r20,0
         0x7fff7ca20c68: ld r0,32(r16)
         0x7fff7ca20c6c: cmpw r0,r20
         0x7fff7ca20c70: bnectrl

      Compiled method (c1) 3201 1400 3 java.lang.StringCoding::countNonZeroAscii (30 bytes)
       total in heap [0x00007fff7ca20b08,0x00007fff7ca21498] = 2448
       constants [0x00007fff7ca20c00,0x00007fff7ca20c40] = 64
       main code [0x00007fff7ca20c40,0x00007fff7ca21428] = 2024
       stub code [0x00007fff7ca21428,0x00007fff7ca21498] = 112
       mutable data [0x00007fff101076a0,0x00007fff10107738] = 152
       relocation [0x00007fff101076a0,0x00007fff101076d8] = 56
       metadata [0x00007fff101076d8,0x00007fff10107738] = 96
       immutable data [0x00007fff10107260,0x00007fff10107608] = 936
       dependencies [0x00007fff10107260,0x00007fff10107270] = 16
       nul chk table [0x00007fff10107270,0x00007fff10107290] = 32
       scopes pcs [0x00007fff10107290,0x00007fff101074d0] = 576
       scopes data [0x00007fff101074d0,0x00007fff10107608] = 312

      The entry point is overwritten with 0 which is the instruction which triggers SIGILL. That means it has been patched not entrant.

      Seems like -XX:-DeoptimizeRandom can hit nmethods which are not yet completely installed and usable.

            Unassigned Unassigned
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: