hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
changeset 46620 750c6edff33b
parent 44406 a46a6c4d1dd9
child 46625 edefffab74e2
equal deleted inserted replaced
46619:a3919f5e8d2b 46620:750c6edff33b
   219 
   219 
   220   // calcualte frame size
   220   // calcualte frame size
   221   const int regstosave_num       = sizeof(RegisterSaver_LiveRegs) /
   221   const int regstosave_num       = sizeof(RegisterSaver_LiveRegs) /
   222                                    sizeof(RegisterSaver::LiveRegType);
   222                                    sizeof(RegisterSaver::LiveRegType);
   223   const int register_save_size   = regstosave_num * reg_size;
   223   const int register_save_size   = regstosave_num * reg_size;
   224   const int frame_size_in_bytes  = round_to(register_save_size, frame::alignment_in_bytes)
   224   const int frame_size_in_bytes  = align_up(register_save_size, frame::alignment_in_bytes)
   225                                    + frame::abi_reg_args_size;
   225                                    + frame::abi_reg_args_size;
   226   *out_frame_size_in_bytes       = frame_size_in_bytes;
   226   *out_frame_size_in_bytes       = frame_size_in_bytes;
   227   const int frame_size_in_slots  = frame_size_in_bytes / sizeof(jint);
   227   const int frame_size_in_slots  = frame_size_in_bytes / sizeof(jint);
   228   const int register_save_offset = frame_size_in_bytes - register_save_size;
   228   const int register_save_offset = frame_size_in_bytes - register_save_size;
   229 
   229 
   656       break;
   656       break;
   657     default:
   657     default:
   658       ShouldNotReachHere();
   658       ShouldNotReachHere();
   659     }
   659     }
   660   }
   660   }
   661   return round_to(stk, 2);
   661   return align_up(stk, 2);
   662 }
   662 }
   663 
   663 
   664 #if defined(COMPILER1) || defined(COMPILER2)
   664 #if defined(COMPILER1) || defined(COMPILER2)
   665 // Calling convention for calling C code.
   665 // Calling convention for calling C code.
   666 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
   666 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
   843     default:
   843     default:
   844       ShouldNotReachHere();
   844       ShouldNotReachHere();
   845     }
   845     }
   846   }
   846   }
   847 
   847 
   848   return round_to(stk, 2);
   848   return align_up(stk, 2);
   849 }
   849 }
   850 #endif // COMPILER2
   850 #endif // COMPILER2
   851 
   851 
   852 static address gen_c2i_adapter(MacroAssembler *masm,
   852 static address gen_c2i_adapter(MacroAssembler *masm,
   853                             int total_args_passed,
   853                             int total_args_passed,
   871 
   871 
   872   assert_different_registers(sender_SP, code, ientry, return_pc, tmp);
   872   assert_different_registers(sender_SP, code, ientry, return_pc, tmp);
   873 
   873 
   874   // Adapter needs TOP_IJAVA_FRAME_ABI.
   874   // Adapter needs TOP_IJAVA_FRAME_ABI.
   875   const int adapter_size = frame::top_ijava_frame_abi_size +
   875   const int adapter_size = frame::top_ijava_frame_abi_size +
   876                            round_to(total_args_passed * wordSize, frame::alignment_in_bytes);
   876       align_up(total_args_passed * wordSize, frame::alignment_in_bytes);
   877 
   877 
   878   // regular (verified) c2i entry point
   878   // regular (verified) c2i entry point
   879   c2i_entrypoint = __ pc();
   879   c2i_entrypoint = __ pc();
   880 
   880 
   881   // Does compiled code exists? If yes, patch the caller's callsite.
   881   // Does compiled code exists? If yes, patch the caller's callsite.
  1020     // Sig words on the stack are greater-than VMRegImpl::stack0. Those in
  1020     // Sig words on the stack are greater-than VMRegImpl::stack0. Those in
  1021     // registers are below. By subtracting stack0, we either get a negative
  1021     // registers are below. By subtracting stack0, we either get a negative
  1022     // number (all values in registers) or the maximum stack slot accessed.
  1022     // number (all values in registers) or the maximum stack slot accessed.
  1023 
  1023 
  1024     // Convert 4-byte c2 stack slots to words.
  1024     // Convert 4-byte c2 stack slots to words.
  1025     comp_words_on_stack = round_to(comp_args_on_stack*VMRegImpl::stack_slot_size, wordSize)>>LogBytesPerWord;
  1025     comp_words_on_stack = align_up(comp_args_on_stack*VMRegImpl::stack_slot_size, wordSize)>>LogBytesPerWord;
  1026     // Round up to miminum stack alignment, in wordSize.
  1026     // Round up to miminum stack alignment, in wordSize.
  1027     comp_words_on_stack = round_to(comp_words_on_stack, 2);
  1027     comp_words_on_stack = align_up(comp_words_on_stack, 2);
  1028     __ resize_frame(-comp_words_on_stack * wordSize, R11_scratch1);
  1028     __ resize_frame(-comp_words_on_stack * wordSize, R11_scratch1);
  1029   }
  1029   }
  1030 
  1030 
  1031   // Now generate the shuffle code.  Pick up all register args and move the
  1031   // Now generate the shuffle code.  Pick up all register args and move the
  1032   // rest through register value=Z_R12.
  1032   // rest through register value=Z_R12.
  1916           case T_DOUBLE: double_slots++; break;
  1916           case T_DOUBLE: double_slots++; break;
  1917           default:  ShouldNotReachHere();
  1917           default:  ShouldNotReachHere();
  1918         }
  1918         }
  1919       }
  1919       }
  1920     }
  1920     }
  1921     total_save_slots = double_slots * 2 + round_to(single_slots, 2); // round to even
  1921     total_save_slots = double_slots * 2 + align_up(single_slots, 2); // round to even
  1922   }
  1922   }
  1923 
  1923 
  1924   int oop_handle_slot_offset = stack_slots;
  1924   int oop_handle_slot_offset = stack_slots;
  1925   stack_slots += total_save_slots;                                                // 3)
  1925   stack_slots += total_save_slots;                                                // 3)
  1926 
  1926 
  1943   int workspace_slot_offset = stack_slots;                                        // 6)
  1943   int workspace_slot_offset = stack_slots;                                        // 6)
  1944   stack_slots         += 2;
  1944   stack_slots         += 2;
  1945 
  1945 
  1946   // Now compute actual number of stack words we need.
  1946   // Now compute actual number of stack words we need.
  1947   // Rounding to make stack properly aligned.
  1947   // Rounding to make stack properly aligned.
  1948   stack_slots = round_to(stack_slots,                                             // 7)
  1948   stack_slots = align_up(stack_slots,                                             // 7)
  1949                          frame::alignment_in_bytes / VMRegImpl::stack_slot_size);
  1949                          frame::alignment_in_bytes / VMRegImpl::stack_slot_size);
  1950   int frame_size_in_bytes = stack_slots * VMRegImpl::stack_slot_size;
  1950   int frame_size_in_bytes = stack_slots * VMRegImpl::stack_slot_size;
  1951 
  1951 
  1952 
  1952 
  1953   // Now we can start generating code.
  1953   // Now we can start generating code.
  2202     // slow case of monitor enter. Inline a special case of call_VM that
  2202     // slow case of monitor enter. Inline a special case of call_VM that
  2203     // disallows any pending_exception.
  2203     // disallows any pending_exception.
  2204 
  2204 
  2205     // Save argument registers and leave room for C-compatible ABI_REG_ARGS.
  2205     // Save argument registers and leave room for C-compatible ABI_REG_ARGS.
  2206     int frame_size = frame::abi_reg_args_size +
  2206     int frame_size = frame::abi_reg_args_size +
  2207                      round_to(total_c_args * wordSize, frame::alignment_in_bytes);
  2207         align_up(total_c_args * wordSize, frame::alignment_in_bytes);
  2208     __ mr(R11_scratch1, R1_SP);
  2208     __ mr(R11_scratch1, R1_SP);
  2209     RegisterSaver::push_frame_and_save_argument_registers(masm, R12_scratch2, frame_size, total_c_args, out_regs, out_regs2);
  2209     RegisterSaver::push_frame_and_save_argument_registers(masm, R12_scratch2, frame_size, total_c_args, out_regs, out_regs2);
  2210 
  2210 
  2211     // Do the call.
  2211     // Do the call.
  2212     __ set_last_Java_frame(R11_scratch1, r_return_pc);
  2212     __ set_last_Java_frame(R11_scratch1, r_return_pc);
  2568 }
  2568 }
  2569 
  2569 
  2570 // This function returns the adjust size (in number of words) to a c2i adapter
  2570 // This function returns the adjust size (in number of words) to a c2i adapter
  2571 // activation for use during deoptimization.
  2571 // activation for use during deoptimization.
  2572 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) {
  2572 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) {
  2573   return round_to((callee_locals - callee_parameters) * Interpreter::stackElementWords, frame::alignment_in_bytes);
  2573   return align_up((callee_locals - callee_parameters) * Interpreter::stackElementWords, frame::alignment_in_bytes);
  2574 }
  2574 }
  2575 
  2575 
  2576 uint SharedRuntime::out_preserve_stack_slots() {
  2576 uint SharedRuntime::out_preserve_stack_slots() {
  2577 #if defined(COMPILER1) || defined(COMPILER2)
  2577 #if defined(COMPILER1) || defined(COMPILER2)
  2578   return frame::jit_out_preserve_size / VMRegImpl::stack_slot_size;
  2578   return frame::jit_out_preserve_size / VMRegImpl::stack_slot_size;