src/cpu/sparc/vm/methodHandles_sparc.cpp

changeset 2271
e62345fd6a46
parent 2266
fff777a71346
child 2314
f95d63e2154a
     1.1 --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue Nov 02 14:56:40 2010 -0700
     1.2 +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Thu Nov 04 12:16:58 2010 -0700
     1.3 @@ -70,17 +70,17 @@
     1.4  
     1.5  // Code generation
     1.6  address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) {
     1.7 -  // I5_savedSP: sender SP (must preserve)
     1.8 +  // I5_savedSP/O5_savedSP: sender SP (must preserve)
     1.9    // G4 (Gargs): incoming argument list (must preserve)
    1.10 -  // G5_method:  invoke methodOop; becomes method type.
    1.11 +  // G5_method:  invoke methodOop
    1.12    // G3_method_handle: receiver method handle (must load from sp[MethodTypeForm.vmslots])
    1.13 -  // O0, O1: garbage temps, blown away
    1.14 -  Register O0_argslot = O0;
    1.15 +  // O0, O1, O2, O3, O4: garbage temps, blown away
    1.16 +  Register O0_mtype   = O0;
    1.17    Register O1_scratch = O1;
    1.18    Register O2_scratch = O2;
    1.19    Register O3_scratch = O3;
    1.20 +  Register O4_argslot = O4;
    1.21    Register O4_argbase = O4;
    1.22 -  Register O5_mtype   = O5;
    1.23  
    1.24    // emit WrongMethodType path first, to enable back-branch from main path
    1.25    Label wrong_method_type;
    1.26 @@ -91,7 +91,7 @@
    1.27    __ cmp(O1_scratch, (int) vmIntrinsics::_invokeExact);
    1.28    __ brx(Assembler::notEqual, false, Assembler::pt, invoke_generic_slow_path);
    1.29    __ delayed()->nop();
    1.30 -  __ mov(O5_mtype, G5_method_type);  // required by throw_WrongMethodType
    1.31 +  __ mov(O0_mtype, G5_method_type);  // required by throw_WrongMethodType
    1.32    // mov(G3_method_handle, G3_method_handle);  // already in this register
    1.33    __ jump_to(AddressLiteral(Interpreter::throw_WrongMethodType_entry()), O1_scratch);
    1.34    __ delayed()->nop();
    1.35 @@ -104,21 +104,21 @@
    1.36    {
    1.37      Register tem = G5_method;
    1.38      for (jint* pchase = methodOopDesc::method_type_offsets_chain(); (*pchase) != -1; pchase++) {
    1.39 -      __ ld_ptr(Address(tem, *pchase), O5_mtype);
    1.40 -      tem = O5_mtype;          // in case there is another indirection
    1.41 +      __ ld_ptr(Address(tem, *pchase), O0_mtype);
    1.42 +      tem = O0_mtype;          // in case there is another indirection
    1.43      }
    1.44    }
    1.45  
    1.46    // given the MethodType, find out where the MH argument is buried
    1.47 -  __ load_heap_oop(Address(O5_mtype,   __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, O1_scratch)),        O0_argslot);
    1.48 -  __ ldsw(  Address(O0_argslot, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O0_argslot);
    1.49 -  __ add(Gargs, __ argument_offset(O0_argslot, 1), O4_argbase);
    1.50 +  __ load_heap_oop(Address(O0_mtype,   __ delayed_value(java_dyn_MethodType::form_offset_in_bytes,        O1_scratch)), O4_argslot);
    1.51 +  __ ldsw(         Address(O4_argslot, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O4_argslot);
    1.52 +  __ add(Gargs, __ argument_offset(O4_argslot, 1), O4_argbase);
    1.53    // Note: argument_address uses its input as a scratch register!
    1.54    __ ld_ptr(Address(O4_argbase, -Interpreter::stackElementSize), G3_method_handle);
    1.55  
    1.56    trace_method_handle(_masm, "invokeExact");
    1.57  
    1.58 -  __ check_method_handle_type(O5_mtype, G3_method_handle, O1_scratch, wrong_method_type);
    1.59 +  __ check_method_handle_type(O0_mtype, G3_method_handle, O1_scratch, wrong_method_type);
    1.60    __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    1.61  
    1.62    // for invokeGeneric (only), apply argument and result conversions on the fly
    1.63 @@ -135,15 +135,14 @@
    1.64  #endif //ASSERT
    1.65  
    1.66    // make room on the stack for another pointer:
    1.67 -  insert_arg_slots(_masm, 2 * stack_move_unit(), _INSERT_REF_MASK,
    1.68 -                   O4_argbase, O1_scratch, O2_scratch, O3_scratch);
    1.69 +  insert_arg_slots(_masm, 2 * stack_move_unit(), _INSERT_REF_MASK, O4_argbase, O1_scratch, O2_scratch, O3_scratch);
    1.70    // load up an adapter from the calling type (Java weaves this)
    1.71    Register O2_form    = O2_scratch;
    1.72    Register O3_adapter = O3_scratch;
    1.73 -  __ load_heap_oop(Address(O5_mtype, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, O1_scratch)), O2_form);
    1.74 +  __ load_heap_oop(Address(O0_mtype, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes,               O1_scratch)), O2_form);
    1.75    // load_heap_oop(Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
    1.76    // deal with old JDK versions:
    1.77 -  __ add(   Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
    1.78 +  __ add(          Address(O2_form,  __ delayed_value(java_dyn_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter);
    1.79    __ cmp(O3_adapter, O2_form);
    1.80    Label sorry_no_invoke_generic;
    1.81    __ brx(Assembler::lessUnsigned, false, Assembler::pn, sorry_no_invoke_generic);
    1.82 @@ -157,14 +156,14 @@
    1.83    // As a trusted first argument, pass the type being called, so the adapter knows
    1.84    // the actual types of the arguments and return values.
    1.85    // (Generic invokers are shared among form-families of method-type.)
    1.86 -  __ st_ptr(O5_mtype,   Address(O4_argbase, 0 * Interpreter::stackElementSize));
    1.87 +  __ st_ptr(O0_mtype,   Address(O4_argbase, 0 * Interpreter::stackElementSize));
    1.88    // FIXME: assert that O3_adapter is of the right method-type.
    1.89    __ mov(O3_adapter, G3_method_handle);
    1.90    trace_method_handle(_masm, "invokeGeneric");
    1.91    __ jump_to_method_handle_entry(G3_method_handle, O1_scratch);
    1.92  
    1.93    __ bind(sorry_no_invoke_generic); // no invokeGeneric implementation available!
    1.94 -  __ mov(O5_mtype, G5_method_type);  // required by throw_WrongMethodType
    1.95 +  __ mov(O0_mtype, G5_method_type);  // required by throw_WrongMethodType
    1.96    // mov(G3_method_handle, G3_method_handle);  // already in this register
    1.97    __ jump_to(AddressLiteral(Interpreter::throw_WrongMethodType_entry()), O1_scratch);
    1.98    __ delayed()->nop();

mercurial