src/cpu/x86/vm/c1_LIRAssembler_x86.cpp

changeset 1730
3cf667df43ef
parent 1692
7b4415a18c8a
child 1732
c466efa608d5
     1.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Mon Mar 08 04:46:30 2010 -0800
     1.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Mar 09 20:16:19 2010 +0100
     1.3 @@ -436,40 +436,18 @@
     1.4  
     1.5    int offset = code_offset();
     1.6  
     1.7 -  // if the method does not have an exception handler, then there is
     1.8 -  // no reason to search for one
     1.9 -  if (compilation()->has_exception_handlers() || compilation()->env()->jvmti_can_post_on_exceptions()) {
    1.10 -    // the exception oop and pc are in rax, and rdx
    1.11 -    // no other registers need to be preserved, so invalidate them
    1.12 -    __ invalidate_registers(false, true, true, false, true, true);
    1.13 -
    1.14 -    // check that there is really an exception
    1.15 -    __ verify_not_null_oop(rax);
    1.16 -
    1.17 -    // search an exception handler (rax: exception oop, rdx: throwing pc)
    1.18 -    __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id)));
    1.19 -
    1.20 -    // if the call returns here, then the exception handler for particular
    1.21 -    // exception doesn't exist -> unwind activation and forward exception to caller
    1.22 -  }
    1.23 -
    1.24 -  // the exception oop is in rax,
    1.25 +  // the exception oop and pc are in rax, and rdx
    1.26    // no other registers need to be preserved, so invalidate them
    1.27 -  __ invalidate_registers(false, true, true, true, true, true);
    1.28 +  __ invalidate_registers(false, true, true, false, true, true);
    1.29  
    1.30    // check that there is really an exception
    1.31    __ verify_not_null_oop(rax);
    1.32  
    1.33 -  // unlock the receiver/klass if necessary
    1.34 -  // rax,: exception
    1.35 -  ciMethod* method = compilation()->method();
    1.36 -  if (method->is_synchronized() && GenerateSynchronizationCode) {
    1.37 -    monitorexit(FrameMap::rbx_oop_opr, FrameMap::rcx_opr, SYNC_header, 0, rax);
    1.38 -  }
    1.39 -
    1.40 -  // unwind activation and forward exception to caller
    1.41 -  // rax,: exception
    1.42 -  __ jump(RuntimeAddress(Runtime1::entry_for(Runtime1::unwind_exception_id)));
    1.43 +  // search an exception handler (rax: exception oop, rdx: throwing pc)
    1.44 +  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id)));
    1.45 +
    1.46 +  __ stop("should not reach here");
    1.47 +
    1.48    assert(code_offset() - offset <= exception_handler_size, "overflow");
    1.49    __ end_a_stub();
    1.50  
    1.51 @@ -495,8 +473,10 @@
    1.52  
    1.53    int offset = code_offset();
    1.54    InternalAddress here(__ pc());
    1.55 +
    1.56    __ pushptr(here.addr());
    1.57    __ jump(RuntimeAddress(SharedRuntime::deopt_blob()->unpack()));
    1.58 +
    1.59    assert(code_offset() - offset <= deopt_handler_size, "overflow");
    1.60    __ end_a_stub();
    1.61  
    1.62 @@ -593,7 +573,7 @@
    1.63    }
    1.64  
    1.65    // Pop the stack before the safepoint code
    1.66 -  __ leave();
    1.67 +  __ remove_frame(initial_frame_size_in_bytes());
    1.68  
    1.69    bool result_is_oop = result->is_valid() ? result->is_oop() : false;
    1.70  
    1.71 @@ -2738,6 +2718,7 @@
    1.72      switch (code) {
    1.73        case lir_static_call:
    1.74        case lir_optvirtual_call:
    1.75 +      case lir_dynamic_call:
    1.76          offset += NativeCall::displacement_offset;
    1.77          break;
    1.78        case lir_icvirtual_call:
    1.79 @@ -2753,30 +2734,41 @@
    1.80  }
    1.81  
    1.82  
    1.83 -void LIR_Assembler::call(address entry, relocInfo::relocType rtype, CodeEmitInfo* info) {
    1.84 +void LIR_Assembler::call(LIR_OpJavaCall* op, relocInfo::relocType rtype) {
    1.85    assert(!os::is_MP() || (__ offset() + NativeCall::displacement_offset) % BytesPerWord == 0,
    1.86           "must be aligned");
    1.87 -  __ call(AddressLiteral(entry, rtype));
    1.88 -  add_call_info(code_offset(), info);
    1.89 +  __ call(AddressLiteral(op->addr(), rtype));
    1.90 +  add_call_info(code_offset(), op->info(), op->is_method_handle_invoke());
    1.91  }
    1.92  
    1.93  
    1.94 -void LIR_Assembler::ic_call(address entry, CodeEmitInfo* info) {
    1.95 +void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
    1.96    RelocationHolder rh = virtual_call_Relocation::spec(pc());
    1.97    __ movoop(IC_Klass, (jobject)Universe::non_oop_word());
    1.98    assert(!os::is_MP() ||
    1.99           (__ offset() + NativeCall::displacement_offset) % BytesPerWord == 0,
   1.100           "must be aligned");
   1.101 -  __ call(AddressLiteral(entry, rh));
   1.102 -  add_call_info(code_offset(), info);
   1.103 +  __ call(AddressLiteral(op->addr(), rh));
   1.104 +  add_call_info(code_offset(), op->info(), op->is_method_handle_invoke());
   1.105  }
   1.106  
   1.107  
   1.108  /* Currently, vtable-dispatch is only enabled for sparc platforms */
   1.109 -void LIR_Assembler::vtable_call(int vtable_offset, CodeEmitInfo* info) {
   1.110 +void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) {
   1.111    ShouldNotReachHere();
   1.112  }
   1.113  
   1.114 +
   1.115 +void LIR_Assembler::preserve_SP() {
   1.116 +  __ movptr(rbp, rsp);
   1.117 +}
   1.118 +
   1.119 +
   1.120 +void LIR_Assembler::restore_SP() {
   1.121 +  __ movptr(rsp, rbp);
   1.122 +}
   1.123 +
   1.124 +
   1.125  void LIR_Assembler::emit_static_call_stub() {
   1.126    address call_pc = __ pc();
   1.127    address stub = __ start_a_stub(call_stub_size);
   1.128 @@ -2829,10 +2821,12 @@
   1.129      } else {
   1.130        unwind_id = Runtime1::handle_exception_nofpu_id;
   1.131      }
   1.132 +    __ call(RuntimeAddress(Runtime1::entry_for(unwind_id)));
   1.133    } else {
   1.134 -    unwind_id = Runtime1::unwind_exception_id;
   1.135 +    // remove the activation
   1.136 +    __ remove_frame(initial_frame_size_in_bytes());
   1.137 +    __ jump(RuntimeAddress(Runtime1::entry_for(Runtime1::unwind_exception_id)));
   1.138    }
   1.139 -  __ call(RuntimeAddress(Runtime1::entry_for(unwind_id)));
   1.140  
   1.141    // enough room for two byte trap
   1.142    __ nop();

mercurial