src/cpu/ppc/vm/sharedRuntime_ppc.cpp

changeset 6511
31e80afe3fed
parent 6495
67fa91961822
child 6512
fd1b9f02cc91
     1.1 --- a/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Thu Feb 20 11:05:12 2014 +0100
     1.2 +++ b/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Thu Mar 06 10:55:28 2014 -0800
     1.3 @@ -67,7 +67,7 @@
     1.4      return_pc_is_thread_saved_exception_pc
     1.5    };
     1.6  
     1.7 -  static OopMap* push_frame_abi112_and_save_live_registers(MacroAssembler* masm,
     1.8 +  static OopMap* push_frame_reg_args_and_save_live_registers(MacroAssembler* masm,
     1.9                           int* out_frame_size_in_bytes,
    1.10                           bool generate_oop_map,
    1.11                           int return_pc_adjustment,
    1.12 @@ -200,12 +200,12 @@
    1.13    RegisterSaver_LiveIntReg(   R30 ), // r30 must be the last register
    1.14  };
    1.15  
    1.16 -OopMap* RegisterSaver::push_frame_abi112_and_save_live_registers(MacroAssembler* masm,
    1.17 +OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssembler* masm,
    1.18                           int* out_frame_size_in_bytes,
    1.19                           bool generate_oop_map,
    1.20                           int return_pc_adjustment,
    1.21                           ReturnPCLocation return_pc_location) {
    1.22 -  // Push an abi112-frame and store all registers which may be live.
    1.23 +  // Push an abi_reg_args-frame and store all registers which may be live.
    1.24    // If requested, create an OopMap: Record volatile registers as
    1.25    // callee-save values in an OopMap so their save locations will be
    1.26    // propagated to the RegisterMap of the caller frame during
    1.27 @@ -221,7 +221,7 @@
    1.28                                     sizeof(RegisterSaver::LiveRegType);
    1.29    const int register_save_size   = regstosave_num * reg_size;
    1.30    const int frame_size_in_bytes  = round_to(register_save_size, frame::alignment_in_bytes)
    1.31 -                                   + frame::abi_112_size;
    1.32 +                                   + frame::abi_reg_args_size;
    1.33    *out_frame_size_in_bytes       = frame_size_in_bytes;
    1.34    const int frame_size_in_slots  = frame_size_in_bytes / sizeof(jint);
    1.35    const int register_save_offset = frame_size_in_bytes - register_save_size;
    1.36 @@ -229,7 +229,7 @@
    1.37    // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words.
    1.38    OopMap* map = generate_oop_map ? new OopMap(frame_size_in_slots, 0) : NULL;
    1.39  
    1.40 -  BLOCK_COMMENT("push_frame_abi112_and_save_live_registers {");
    1.41 +  BLOCK_COMMENT("push_frame_reg_args_and_save_live_registers {");
    1.42  
    1.43    // Save r30 in the last slot of the not yet pushed frame so that we
    1.44    // can use it as scratch reg.
    1.45 @@ -294,7 +294,7 @@
    1.46      offset += reg_size;
    1.47    }
    1.48  
    1.49 -  BLOCK_COMMENT("} push_frame_abi112_and_save_live_registers");
    1.50 +  BLOCK_COMMENT("} push_frame_reg_args_and_save_live_registers");
    1.51  
    1.52    // And we're done.
    1.53    return map;
    1.54 @@ -699,15 +699,19 @@
    1.55  
    1.56    int i;
    1.57    VMReg reg;
    1.58 -  // Leave room for C-compatible ABI_112.
    1.59 -  int stk = (frame::abi_112_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size;
    1.60 +  // Leave room for C-compatible ABI_REG_ARGS.
    1.61 +  int stk = (frame::abi_reg_args_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size;
    1.62    int arg = 0;
    1.63    int freg = 0;
    1.64  
    1.65    // Avoid passing C arguments in the wrong stack slots.
    1.66 +#if defined(ABI_ELFv2)
    1.67 +  assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 96,
    1.68 +         "passing C arguments in wrong stack slots");
    1.69 +#else
    1.70    assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 112,
    1.71           "passing C arguments in wrong stack slots");
    1.72 -
    1.73 +#endif
    1.74    // We fill-out regs AND regs2 if an argument must be passed in a
    1.75    // register AND in a stack slot. If regs2 is NULL in such a
    1.76    // situation, we bail-out with a fatal error.
    1.77 @@ -1504,7 +1508,11 @@
    1.78  
    1.79    __ block_comment("block_for_jni_critical");
    1.80    address entry_point = CAST_FROM_FN_PTR(address, SharedRuntime::block_for_jni_critical);
    1.81 +#if defined(ABI_ELFv2)
    1.82 +  __ call_c(entry_point, relocInfo::runtime_call_type);
    1.83 +#else
    1.84    __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, entry_point), relocInfo::runtime_call_type);
    1.85 +#endif
    1.86    address start           = __ pc() - __ offset(),
    1.87            calls_return_pc = __ last_calls_return_pc();
    1.88    oop_maps->add_gc_map(calls_return_pc - start, map);
    1.89 @@ -1877,7 +1885,7 @@
    1.90    // Layout of the native wrapper frame:
    1.91    // (stack grows upwards, memory grows downwards)
    1.92    //
    1.93 -  // NW     [ABI_112]                  <-- 1) R1_SP
    1.94 +  // NW     [ABI_REG_ARGS]             <-- 1) R1_SP
    1.95    //        [outgoing arguments]       <-- 2) R1_SP + out_arg_slot_offset
    1.96    //        [oopHandle area]           <-- 3) R1_SP + oop_handle_offset (save area for critical natives)
    1.97    //        klass                      <-- 4) R1_SP + klass_offset
    1.98 @@ -2211,8 +2219,8 @@
    1.99      // slow case of monitor enter. Inline a special case of call_VM that
   1.100      // disallows any pending_exception.
   1.101  
   1.102 -    // Save argument registers and leave room for C-compatible ABI_112.
   1.103 -    int frame_size = frame::abi_112_size +
   1.104 +    // Save argument registers and leave room for C-compatible ABI_REG_ARGS.
   1.105 +    int frame_size = frame::abi_reg_args_size +
   1.106                       round_to(total_c_args * wordSize, frame::alignment_in_bytes);
   1.107      __ mr(R11_scratch1, R1_SP);
   1.108      RegisterSaver::push_frame_and_save_argument_registers(masm, R12_scratch2, frame_size, total_c_args, out_regs, out_regs2);
   1.109 @@ -2250,9 +2258,12 @@
   1.110  
   1.111    // The JNI call
   1.112    // --------------------------------------------------------------------------
   1.113 -
   1.114 +#if defined(ABI_ELFv2)
   1.115 +  __ call_c(native_func, relocInfo::runtime_call_type);
   1.116 +#else
   1.117    FunctionDescriptor* fd_native_method = (FunctionDescriptor*) native_func;
   1.118    __ call_c(fd_native_method, relocInfo::runtime_call_type);
   1.119 +#endif
   1.120  
   1.121  
   1.122    // Now, we are back from the native code.
   1.123 @@ -2724,7 +2735,7 @@
   1.124    OopMapSet *oop_maps = new OopMapSet();
   1.125  
   1.126    // size of ABI112 plus spill slots for R3_RET and F1_RET.
   1.127 -  const int frame_size_in_bytes = frame::abi_112_spill_size;
   1.128 +  const int frame_size_in_bytes = frame::abi_reg_args_spill_size;
   1.129    const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint);
   1.130    int first_frame_size_in_bytes = 0; // frame size of "unpack frame" for call to fetch_unroll_info.
   1.131  
   1.132 @@ -2757,11 +2768,11 @@
   1.133  
   1.134    // Push the "unpack frame"
   1.135    // Save everything in sight.
   1.136 -  map = RegisterSaver::push_frame_abi112_and_save_live_registers(masm,
   1.137 -                                                                 &first_frame_size_in_bytes,
   1.138 -                                                                 /*generate_oop_map=*/ true,
   1.139 -                                                                 return_pc_adjustment_no_exception,
   1.140 -                                                                 RegisterSaver::return_pc_is_lr);
   1.141 +  map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
   1.142 +                                                                   &first_frame_size_in_bytes,
   1.143 +                                                                   /*generate_oop_map=*/ true,
   1.144 +                                                                   return_pc_adjustment_no_exception,
   1.145 +                                                                   RegisterSaver::return_pc_is_lr);
   1.146    assert(map != NULL, "OopMap must have been created");
   1.147  
   1.148    __ li(exec_mode_reg, Deoptimization::Unpack_deopt);
   1.149 @@ -2787,11 +2798,11 @@
   1.150    // Push the "unpack frame".
   1.151    // Save everything in sight.
   1.152    assert(R4 == R4_ARG2, "exception pc must be in r4");
   1.153 -  RegisterSaver::push_frame_abi112_and_save_live_registers(masm,
   1.154 -                                                           &first_frame_size_in_bytes,
   1.155 -                                                           /*generate_oop_map=*/ false,
   1.156 -                                                           return_pc_adjustment_exception,
   1.157 -                                                           RegisterSaver::return_pc_is_r4);
   1.158 +  RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
   1.159 +                                                             &first_frame_size_in_bytes,
   1.160 +                                                             /*generate_oop_map=*/ false,
   1.161 +                                                             return_pc_adjustment_exception,
   1.162 +                                                             RegisterSaver::return_pc_is_r4);
   1.163  
   1.164    // Deopt during an exception. Save exec mode for unpack_frames.
   1.165    __ li(exec_mode_reg, Deoptimization::Unpack_exception);
   1.166 @@ -2876,8 +2887,8 @@
   1.167    // ...).
   1.168  
   1.169    // Spill live volatile registers since we'll do a call.
   1.170 -  __ std( R3_RET,  _abi_112_spill(spill_ret),  R1_SP);
   1.171 -  __ stfd(F1_RET, _abi_112_spill(spill_fret), R1_SP);
   1.172 +  __ std( R3_RET, _abi_reg_args_spill(spill_ret),  R1_SP);
   1.173 +  __ stfd(F1_RET, _abi_reg_args_spill(spill_fret), R1_SP);
   1.174  
   1.175    // Let the unpacker layout information in the skeletal frames just
   1.176    // allocated.
   1.177 @@ -2889,8 +2900,8 @@
   1.178    __ reset_last_Java_frame();
   1.179  
   1.180    // Restore the volatiles saved above.
   1.181 -  __ ld( R3_RET, _abi_112_spill(spill_ret),  R1_SP);
   1.182 -  __ lfd(F1_RET, _abi_112_spill(spill_fret), R1_SP);
   1.183 +  __ ld( R3_RET, _abi_reg_args_spill(spill_ret),  R1_SP);
   1.184 +  __ lfd(F1_RET, _abi_reg_args_spill(spill_fret), R1_SP);
   1.185  
   1.186    // Pop the unpack frame.
   1.187    __ pop_frame();
   1.188 @@ -2930,7 +2941,7 @@
   1.189    Register unc_trap_reg     = R23_tmp3;
   1.190  
   1.191    OopMapSet* oop_maps = new OopMapSet();
   1.192 -  int frame_size_in_bytes = frame::abi_112_size;
   1.193 +  int frame_size_in_bytes = frame::abi_reg_args_size;
   1.194    OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
   1.195  
   1.196    // stack: (deoptee, optional i2c, caller_of_deoptee, ...).
   1.197 @@ -2943,7 +2954,7 @@
   1.198    __ save_LR_CR(R11_scratch1);
   1.199  
   1.200    // Push an "uncommon_trap" frame.
   1.201 -  __ push_frame_abi112(0, R11_scratch1);
   1.202 +  __ push_frame_reg_args(0, R11_scratch1);
   1.203  
   1.204    // stack: (unpack frame, deoptee, optional i2c, caller_of_deoptee, ...).
   1.205  
   1.206 @@ -2996,7 +3007,7 @@
   1.207    // interpreter frames just created.
   1.208  
   1.209    // Push a simple "unpack frame" here.
   1.210 -  __ push_frame_abi112(0, R11_scratch1);
   1.211 +  __ push_frame_reg_args(0, R11_scratch1);
   1.212  
   1.213    // stack: (unpack frame, skeletal interpreter frame, ..., optional
   1.214    // skeletal interpreter frame, optional c2i, caller of deoptee,
   1.215 @@ -3064,11 +3075,11 @@
   1.216    }
   1.217  
   1.218    // Save registers, fpu state, and flags.
   1.219 -  map = RegisterSaver::push_frame_abi112_and_save_live_registers(masm,
   1.220 -                                                                 &frame_size_in_bytes,
   1.221 -                                                                 /*generate_oop_map=*/ true,
   1.222 -                                                                 /*return_pc_adjustment=*/0,
   1.223 -                                                                 return_pc_location);
   1.224 +  map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
   1.225 +                                                                   &frame_size_in_bytes,
   1.226 +                                                                   /*generate_oop_map=*/ true,
   1.227 +                                                                   /*return_pc_adjustment=*/0,
   1.228 +                                                                   return_pc_location);
   1.229  
   1.230    // The following is basically a call_VM. However, we need the precise
   1.231    // address of the call in order to generate an oopmap. Hence, we do all the
   1.232 @@ -3151,11 +3162,11 @@
   1.233  
   1.234    address start = __ pc();
   1.235  
   1.236 -  map = RegisterSaver::push_frame_abi112_and_save_live_registers(masm,
   1.237 -                                                                 &frame_size_in_bytes,
   1.238 -                                                                 /*generate_oop_map*/ true,
   1.239 -                                                                 /*return_pc_adjustment*/ 0,
   1.240 -                                                                 RegisterSaver::return_pc_is_lr);
   1.241 +  map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
   1.242 +                                                                   &frame_size_in_bytes,
   1.243 +                                                                   /*generate_oop_map*/ true,
   1.244 +                                                                   /*return_pc_adjustment*/ 0,
   1.245 +                                                                   RegisterSaver::return_pc_is_lr);
   1.246  
   1.247    // Use noreg as last_Java_pc, the return pc will be reconstructed
   1.248    // from the physical frame.

mercurial