< prev index next > src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
Print this page
// restore sp
__ mov(rsp, r13);
__ bind(L);
}
-
static void gen_c2i_adapter(MacroAssembler *masm,
int total_args_passed,
int comp_args_on_stack,
const BasicType *sig_bt,
const VMRegPair *regs,
// Schedule the branch target address early.
__ movptr(rcx, Address(rbx, in_bytes(Method::interpreter_entry_offset())));
__ jmp(rcx);
}
- static void range_check(MacroAssembler* masm, Register pc_reg, Register temp_reg,
- address code_start, address code_end,
- Label& L_ok) {
- Label L_fail;
- __ lea(temp_reg, AddressLiteral(code_start, relocInfo::none));
- __ cmpptr(pc_reg, temp_reg);
- __ jcc(Assembler::belowEqual, L_fail);
- __ lea(temp_reg, AddressLiteral(code_end, relocInfo::none));
- __ cmpptr(pc_reg, temp_reg);
- __ jcc(Assembler::below, L_ok);
- __ bind(L_fail);
- }
-
void SharedRuntime::gen_i2c_adapter(MacroAssembler *masm,
int total_args_passed,
int comp_args_on_stack,
const BasicType *sig_bt,
const VMRegPair *regs) {
// both caller and callee would be compiled methods, and neither would
// clean up the stack pointer changes performed by the two adapters.
// If this happens, control eventually transfers back to the compiled
// caller, but with an uncorrected stack, causing delayed havoc.
- if (VerifyAdapterCalls &&
- (Interpreter::code() != nullptr || StubRoutines::final_stubs_code() != nullptr)) {
- // So, let's test for cascading c2i/i2c adapters right now.
- // assert(Interpreter::contains($return_addr) ||
- // StubRoutines::contains($return_addr),
- // "i2c adapter must return to an interpreter frame");
- __ block_comment("verify_i2c { ");
- // Pick up the return address
- __ movptr(rax, Address(rsp, 0));
- Label L_ok;
- if (Interpreter::code() != nullptr) {
- range_check(masm, rax, r11,
- Interpreter::code()->code_start(),
- Interpreter::code()->code_end(),
- L_ok);
- }
- if (StubRoutines::initial_stubs_code() != nullptr) {
- range_check(masm, rax, r11,
- StubRoutines::initial_stubs_code()->code_begin(),
- StubRoutines::initial_stubs_code()->code_end(),
- L_ok);
- }
- if (StubRoutines::final_stubs_code() != nullptr) {
- range_check(masm, rax, r11,
- StubRoutines::final_stubs_code()->code_begin(),
- StubRoutines::final_stubs_code()->code_end(),
- L_ok);
- }
- const char* msg = "i2c adapter must return to an interpreter frame";
- __ block_comment(msg);
- __ stop(msg);
- __ bind(L_ok);
- __ block_comment("} verify_i2ce ");
- }
-
// Must preserve original SP for loading incoming arguments because
// we need to align the outgoing SP for compiled code.
__ movptr(r11, rsp);
// Pick up the return address
__ mov(rax, rbx);
__ jmp(r11);
}
// ---------------------------------------------------------------
! AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
! int total_args_passed,
! int comp_args_on_stack,
! const BasicType *sig_bt,
! const VMRegPair *regs,
! AdapterFingerPrint* fingerprint) {
address i2c_entry = __ pc();
gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
// -------------------------------------------------------------------------
__ mov(rax, rbx);
__ jmp(r11);
}
// ---------------------------------------------------------------
! void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
! int total_args_passed,
! int comp_args_on_stack,
! const BasicType *sig_bt,
! const VMRegPair *regs,
! AdapterHandlerEntry* handler) {
address i2c_entry = __ pc();
gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
// -------------------------------------------------------------------------
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->c2i_entry_barrier(masm);
gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
! return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry, c2i_no_clinit_check_entry);
}
int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
int total_args_passed) {
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->c2i_entry_barrier(masm);
gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
! handler->set_entry_points(i2c_entry, c2i_entry, c2i_unverified_entry, c2i_no_clinit_check_entry);
+ return;
}
int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
int total_args_passed) {
< prev index next >