src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Cdiff src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp

src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 28,38 **** #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/sharedRuntime.hpp" #include "vmreg_aarch64.inline.hpp" ! 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)) { --- 28,38 ---- #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/sharedRuntime.hpp" #include "vmreg_aarch64.inline.hpp" ! jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, JVMCIObject method, JVMCI_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)) {
*** 41,89 **** } else { JVMCI_ERROR_0("unsupported type of instruction for call site"); } } ! void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle constant, TRAPS) { address pc = _instructions->start() + pc_offset; #ifdef ASSERT { NativeInstruction *insn = nativeInstruction_at(pc); ! if (HotSpotObjectConstantImpl::compressed(constant)) { // Mov narrow constant: movz n << 16, movk assert(Instruction_aarch64::extract(insn->encoding(), 31, 21) == 0b11010010101 && nativeInstruction_at(pc+4)->is_movk(), "wrong insn in patch"); } else { // Move wide constant: movz n, movk, movk. assert(nativeInstruction_at(pc+4)->is_movk() && nativeInstruction_at(pc+8)->is_movk(), "wrong insn in patch"); } } #endif // ASSERT ! Handle obj(THREAD, HotSpotObjectConstantImpl::object(constant)); jobject value = JNIHandles::make_local(obj()); MacroAssembler::patch_oop(pc, (address)obj()); int oop_index = _oop_recorder->find_index(value); RelocationHolder rspec = oop_Relocation::spec(oop_index); _instructions->relocate(pc, rspec); } ! void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) { address pc = _instructions->start() + pc_offset; ! if (HotSpotMetaspaceConstantImpl::compressed(constant)) { ! narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK); MacroAssembler::patch_narrow_klass(pc, narrowOop); TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop); } else { NativeMovConstReg* move = nativeMovConstReg_at(pc); ! void* reference = record_metadata_reference(_instructions, pc, constant, CHECK); move->set_data((intptr_t) reference); TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference)); } } ! 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; --- 41,89 ---- } else { JVMCI_ERROR_0("unsupported type of instruction for call site"); } } ! void CodeInstaller::pd_patch_OopConstant(int pc_offset, JVMCIObject constant, JVMCI_TRAPS) { address pc = _instructions->start() + pc_offset; #ifdef ASSERT { NativeInstruction *insn = nativeInstruction_at(pc); ! if (jvmci_env()->get_HotSpotObjectConstantImpl_compressed(constant)) { // Mov narrow constant: movz n << 16, movk assert(Instruction_aarch64::extract(insn->encoding(), 31, 21) == 0b11010010101 && nativeInstruction_at(pc+4)->is_movk(), "wrong insn in patch"); } else { // Move wide constant: movz n, movk, movk. assert(nativeInstruction_at(pc+4)->is_movk() && nativeInstruction_at(pc+8)->is_movk(), "wrong insn in patch"); } } #endif // ASSERT ! Handle obj = jvmci_env()->asConstant(constant, JVMCI_CHECK); jobject value = JNIHandles::make_local(obj()); MacroAssembler::patch_oop(pc, (address)obj()); int oop_index = _oop_recorder->find_index(value); RelocationHolder rspec = oop_Relocation::spec(oop_index); _instructions->relocate(pc, rspec); } ! void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, JVMCIObject constant, JVMCI_TRAPS) { address pc = _instructions->start() + pc_offset; ! if (jvmci_env()->get_HotSpotMetaspaceConstantImpl_compressed(constant)) { ! narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, JVMCI_CHECK); MacroAssembler::patch_narrow_klass(pc, narrowOop); TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop); } else { NativeMovConstReg* move = nativeMovConstReg_at(pc); ! void* reference = record_metadata_reference(_instructions, pc, constant, JVMCI_CHECK); move->set_data((intptr_t) reference); TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference)); } } ! void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset, JVMCI_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;
*** 92,102 **** } else { JVMCI_ERROR("unknown load or move instruction at " PTR_FORMAT, p2i(pc)); } } ! void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS) { address pc = (address) inst; if (inst->is_call()) { NativeCall* call = nativeCall_at(pc); call->set_destination((address) foreign_call_destination); _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec()); --- 92,102 ---- } else { JVMCI_ERROR("unknown load or move instruction at " PTR_FORMAT, p2i(pc)); } } ! void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, JVMCI_TRAPS) { address pc = (address) inst; if (inst->is_call()) { NativeCall* call = nativeCall_at(pc); call->set_destination((address) foreign_call_destination); _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec());
*** 116,131 **** JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc)); } TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst)); } ! void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle hotspot_method, jint pc_offset, TRAPS) { #ifdef ASSERT Method* method = NULL; // we need to check, this might also be an unresolved method ! if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) { ! method = getMethodFromHotSpotMethod(hotspot_method()); } #endif switch (_next_call_type) { case INLINE_INVOKE: break; --- 116,131 ---- JVMCI_ERROR("unknown call or jump instruction at " PTR_FORMAT, p2i(pc)); } TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst)); } ! void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, JVMCIObject hotspot_method, jint pc_offset, JVMCI_TRAPS) { #ifdef ASSERT Method* method = NULL; // we need to check, this might also be an unresolved method ! if (JVMCIENV->isa_HotSpotResolvedJavaMethodImpl(hotspot_method)) { ! method = JVMCIENV->asMethod(hotspot_method); } #endif switch (_next_call_type) { case INLINE_INVOKE: break;
*** 155,165 **** JVMCI_ERROR("invalid _next_call_type value"); break; } } ! void CodeInstaller::pd_relocate_poll(address pc, jint mark, TRAPS) { switch (mark) { case POLL_NEAR: JVMCI_ERROR("unimplemented"); break; case POLL_FAR: --- 155,165 ---- JVMCI_ERROR("invalid _next_call_type value"); break; } } ! void CodeInstaller::pd_relocate_poll(address pc, jint mark, JVMCI_TRAPS) { switch (mark) { case POLL_NEAR: JVMCI_ERROR("unimplemented"); break; case POLL_FAR:
*** 176,186 **** break; } } // convert JVMCI register indices (as used in oop maps) to HotSpot registers ! VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg, TRAPS) { if (jvmci_reg < RegisterImpl::number_of_registers) { return as_Register(jvmci_reg)->as_VMReg(); } else { jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers_for_jvmci; if (floatRegisterNumber >= 0 && floatRegisterNumber < FloatRegisterImpl::number_of_registers) { --- 176,186 ---- break; } } // convert JVMCI register indices (as used in oop maps) to HotSpot registers ! VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg, JVMCI_TRAPS) { if (jvmci_reg < RegisterImpl::number_of_registers) { return as_Register(jvmci_reg)->as_VMReg(); } else { jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers_for_jvmci; if (floatRegisterNumber >= 0 && floatRegisterNumber < FloatRegisterImpl::number_of_registers) {
src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File