Print this page
rev 1081 : imported patch indy-cleanup-6893081.patch

Split Close
Expand all
Collapse all
          --- old/src/cpu/x86/vm/runtime_x86_32.cpp
          +++ new/src/cpu/x86/vm/runtime_x86_32.cpp
↓ open down ↓ 35 lines elided ↑ open up ↑
  36   36  //
  37   37  // Given an exception pc at a call we call into the runtime for the
  38   38  // handler in this method. This handler might merely restore state
  39   39  // (i.e. callee save registers) unwind the frame and jump to the
  40   40  // exception handler for the nmethod if there is no Java level handler
  41   41  // for the nmethod.
  42   42  //
  43   43  // This code is entered with a jmp.
  44   44  //
  45   45  // Arguments:
  46      -//   rax,: exception oop
       46 +//   rax: exception oop
  47   47  //   rdx: exception pc
  48   48  //
  49   49  // Results:
  50      -//   rax,: exception oop
       50 +//   rax: exception oop
  51   51  //   rdx: exception pc in caller or ???
  52   52  //   destination: exception handler of caller
  53   53  //
  54   54  // Note: the exception pc MUST be at a call (precise debug information)
  55   55  //       Only register rax, rdx, rcx are not callee saved.
  56   56  //
  57   57  
  58   58  void OptoRuntime::generate_exception_blob() {
  59   59  
  60   60    // Capture info about frame layout
↓ open down ↓ 45 lines elided ↑ open up ↑
 106  106    oop_maps->add_gc_map( __ pc() - start,  new OopMap( framesize, 0 ));
 107  107    __ get_thread(rcx);
 108  108    __ reset_last_Java_frame(rcx, false, false);
 109  109  
 110  110    // Restore callee-saved registers
 111  111    __ movptr(rbp, Address(rsp, rbp_off * wordSize));
 112  112  
 113  113    __ addptr(rsp, return_off * wordSize);   // Epilog!
 114  114    __ pop(rdx); // Exception pc
 115  115  
      116 +  // rax: exception handler for given <exception oop/exception pc>
 116  117  
 117      -  // rax,: exception handler for given <exception oop/exception pc>
      118 +  // Restore SP from BP if the exception PC is a MethodHandle call.
      119 +  __ cmpl(Address(rcx, JavaThread::is_method_handle_exception_offset()), 0);
      120 +  __ cmovptr(Assembler::notEqual, rsp, rbp);
 118  121  
 119  122    // We have a handler in rax, (could be deopt blob)
 120  123    // rdx - throwing pc, deopt blob will need it.
 121  124  
 122  125    __ push(rax);
 123  126  
 124      -  // rcx contains handler address
 125      -
 126      -  __ get_thread(rcx);           // TLS
 127  127    // Get the exception
 128  128    __ movptr(rax, Address(rcx, JavaThread::exception_oop_offset()));
 129  129    // Get the exception pc in case we are deoptimized
 130  130    __ movptr(rdx, Address(rcx, JavaThread::exception_pc_offset()));
 131  131  #ifdef ASSERT
 132  132    __ movptr(Address(rcx, JavaThread::exception_handler_pc_offset()), NULL_WORD);
 133  133    __ movptr(Address(rcx, JavaThread::exception_pc_offset()), NULL_WORD);
 134  134  #endif
 135  135    // Clear the exception oop so GC no longer processes it as a root.
 136  136    __ movptr(Address(rcx, JavaThread::exception_oop_offset()), NULL_WORD);
 137  137  
 138  138    __ pop(rcx);
 139  139  
 140      -  // rax,: exception oop
      140 +  // rax: exception oop
 141  141    // rcx: exception handler
 142  142    // rdx: exception pc
 143  143    __ jmp (rcx);
 144  144  
 145  145    // -------------
 146  146    // make sure all code is generated
 147  147    masm->flush();
 148  148  
 149  149    _exception_blob = ExceptionBlob::create(&buffer, oop_maps, framesize);
 150  150  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX