< prev index next >
src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
Print this page
*** 32,41 ****
--- 32,44 ----
jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, Handle method, TRAPS) {
if (inst->is_call() || inst->is_jump() || inst->is_blr()) {
return pc_offset + NativeCall::instruction_size;
} else if (inst->is_general_jump()) {
return pc_offset + NativeGeneralJump::instruction_size;
+ } else if (NativeInstruction::is_adrp_at((address)inst)) {
+ // adrp; add; blr
+ return pc_offset + 3 * NativeInstruction::instruction_size;
} else {
JVMCI_ERROR_0("unsupported type of instruction for call site");
}
}
*** 78,88 ****
}
void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) {
address pc = _instructions->start() + pc_offset;
NativeInstruction* inst = nativeInstruction_at(pc);
! if (inst->is_adr_aligned() || inst->is_ldr_literal()) {
address dest = _constants->start() + data_offset;
_instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS));
TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
} else {
JVMCI_ERROR("unknown load or move instruction at " PTR_FORMAT, p2i(pc));
--- 81,92 ----
}
void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS) {
address pc = _instructions->start() + pc_offset;
NativeInstruction* inst = nativeInstruction_at(pc);
! if (inst->is_adr_aligned() || inst->is_ldr_literal()
! || (NativeInstruction::maybe_cpool_ref(pc))) {
address dest = _constants->start() + data_offset;
_instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS));
TRACE_jvmci_3("relocating at " PTR_FORMAT " (+%d) with destination at %d", p2i(pc), pc_offset, data_offset);
} else {
JVMCI_ERROR("unknown load or move instruction at " PTR_FORMAT, p2i(pc));
*** 101,110 ****
--- 105,118 ----
_instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec());
} else if (inst->is_general_jump()) {
NativeGeneralJump* jump = nativeGeneralJump_at(pc);
jump->set_jump_destination((address) foreign_call_destination);
_instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec());
+ } else if (NativeInstruction::is_adrp_at((address)inst)) {
+ // adrp; add; blr
+ MacroAssembler::pd_patch_instruction_size((address)inst,
+ (address)foreign_call_destination);
} else {
JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc));
}
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
*** 123,147 ****
--- 131,164 ----
case INVOKEVIRTUAL:
case INVOKEINTERFACE: {
assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
_instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
+ // Don't create trampolines for immutable PIC.
+ if (!_immutable_pic_compilation) {
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_virtual_call_stub());
+ }
break;
}
case INVOKESTATIC: {
assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
_instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
+ // Don't create trampolines for immutable PIC.
+ if (!_immutable_pic_compilation) {
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_static_call_stub());
+ }
break;
}
case INVOKESPECIAL: {
assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
_instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
+ // Don't create trampolines for immutable PIC.
+ if (!_immutable_pic_compilation) {
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_opt_virtual_call_stub());
+ }
break;
}
default:
JVMCI_ERROR("invalid _next_call_type value");
break;
< prev index next >