From c29aa53d608b180fc628a8ede2b60cf7dcf49860 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Thu, 13 Jun 2024 09:28:43 +0200 Subject: [PATCH] Second relocator --- .../cpu/riscv/macroAssembler_riscv.cpp | 96 +++++++---- .../cpu/riscv/macroAssembler_riscv.hpp | 1 + src/hotspot/cpu/riscv/nativeInst_riscv.cpp | 151 ++++++++---------- src/hotspot/cpu/riscv/nativeInst_riscv.hpp | 4 +- src/hotspot/cpu/riscv/relocInfo_riscv.cpp | 6 +- src/hotspot/share/code/codeBlob.cpp | 4 +- src/hotspot/share/code/codeBlob.hpp | 6 +- src/hotspot/share/code/compiledIC.cpp | 9 +- src/hotspot/share/code/relocInfo.cpp | 2 +- src/hotspot/share/code/relocInfo.hpp | 16 +- src/hotspot/share/runtime/sharedRuntime.cpp | 10 +- 11 files changed, 175 insertions(+), 130 deletions(-) diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 6a59bfc0a7f27..f86e58cbb8a03 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -64,8 +64,6 @@ #define STOP(str) stop(str); #define BIND(label) bind(label); __ BLOCK_COMMENT(#label ":") - - Register MacroAssembler::extract_rs1(address instr) { assert_cond(instr != nullptr); return as_Register(Assembler::extract(Assembler::ld_instr(instr), 19, 15)); @@ -978,11 +976,11 @@ void MacroAssembler::li(Register Rd, int64_t imm) { } } -void MacroAssembler::load_link(const address source, Register temp) { +void MacroAssembler::load_link(const address target, Register temp) { assert(temp != noreg && temp != x0, "expecting a register"); assert(temp == x5, "expecting a register"); - assert_cond(source != nullptr); - int64_t distance = source - pc(); + assert_cond(target != nullptr); + int64_t distance = target - pc(); assert(is_simm32(distance), "Must be"); Assembler::auipc(temp, (int32_t)distance + 0x800); Assembler::_ld(temp, temp, ((int32_t)distance << 20) >> 20); @@ -1739,6 +1737,13 @@ address MacroAssembler::target_addr_for_insn(address insn_addr) { } else if (MacroAssembler::is_li32_at(insn_addr)) { // li32 return get_target_of_li32(insn_addr); } else { + /*CodeBlob* cb = CodeCache::find_blob(insn_addr); + if (insn_addr >= new_cb->content_begin() && + insn_addr < new_cb->content_end()) { + address ret = get_data64_at(insn_addr); + fprintf(stderr,"CALL (%s) CP AT: %p contains: %p\n", __func__, insn_addr, ); fflush(stderr); + return (address)get_data64_at(insn_addr); + }*/ ShouldNotReachHere(); } return address(((uintptr_t)insn_addr + offset)); @@ -3727,53 +3732,82 @@ void MacroAssembler::set_narrow_klass(Register dst, Klass* k) { zero_extend(dst, dst, 32); } -// Maybe emit a call via a trampoline. If the code cache is small -// trampolines won't be emitted. -address MacroAssembler::patchable_far_call(Address entry) { - assert(entry.rspec().type() == relocInfo::runtime_call_type || - entry.rspec().type() == relocInfo::opt_virtual_call_type || - entry.rspec().type() == relocInfo::static_call_type || - entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type"); - - address target = entry.target(); - +address MacroAssembler::patchable_far_call_trampoline(Address entry) { if (!in_scratch_emit_size()) { - if (entry.rspec().type() == relocInfo::runtime_call_type && UseTrampolines) { + if (entry.rspec().type() == relocInfo::runtime_call_type) { assert(CodeBuffer::supports_shared_stubs(), "must support shared stubs"); code()->share_trampoline_for(entry.target(), offset()); } else { - address stub = nullptr; - if (UseTrampolines) { - // We need a trampoline if branches are far. - stub = emit_trampoline_stub(offset(), target); - } else { - stub = emit_address_stub(offset(), target); - } + // We need a trampoline if branches are far. + address stub = emit_trampoline_stub(offset(), entry.target()); if (stub == nullptr) { postcond(pc() == badAddress); return nullptr; // CodeCache is full } } } - target = pc(); - address call_pc = pc(); + address target = pc(); #ifdef ASSERT if (entry.rspec().type() != relocInfo::runtime_call_type) { - assert_alignment(call_pc); + assert_alignment(target); } #endif relocate(entry.rspec(), [&] { - if (UseTrampolines) { - jump_link(target, t0); - } else { - load_link(target, t0); + jump_link(target, t0); + }); + + postcond(pc() != badAddress); + return target; +} + +// Maybe emit a call via a trampoline. If the code cache is small +// trampolines won't be emitted. +address MacroAssembler::patchable_far_call(Address entry) { + assert(entry.rspec().type() == relocInfo::runtime_call_type || + entry.rspec().type() == relocInfo::opt_virtual_call_type || + entry.rspec().type() == relocInfo::static_call_type || + entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type"); + + if (UseTrampolines) { + return patchable_far_call_trampoline(entry); + } + + address target = entry.target(); + address addr_to_cp_entry = nullptr; + + if (!in_scratch_emit_size()) { + addr_to_cp_entry = address_constant(target); + if (addr_to_cp_entry == nullptr) { + return nullptr; // CodeCache is full } + + RelocationHolder rh = section_word_Relocation::spec(addr_to_cp_entry, CodeBuffer::SECT_CONSTS); + relocate(rh); + } else { + addr_to_cp_entry = pc(); + } + + address call_at = pc(); + relocate(entry.rspec(), [&] { + load_link(addr_to_cp_entry, t0); }); + fprintf(stderr, "CALL (%s) %s AT: %p loads: %p contains: %p\n", __func__, in_scratch_emit_size() ? "SCRATCH" : "REAL" , call_at, addr_to_cp_entry, target); fflush(stderr); + postcond(pc() != badAddress); - return call_pc; + return call_at; } + + + +/* + RelocationHolder rh = entry.rspec(); + ((CallRelocation*)rh.reloc())->set_constant_pool_offset(cp_off); + + int offset_cp = ((CallRelocation*)rh.reloc())->get_constant_pool_offset(); + assert(offset_cp == cp_off, "Must be: %d == %d", offset_cp, cp_off); +*/ address MacroAssembler::ic_call(address entry, jint method_index) { RelocationHolder rh = virtual_call_Relocation::spec(pc(), method_index); diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index 65d423a134b82..29ddcfc1a8f5c 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -1246,6 +1246,7 @@ class MacroAssembler: public Assembler { // // Return: the call PC or null if CodeCache is full. address patchable_far_call(Address entry); + address patchable_far_call_trampoline(Address entry); address ic_call(address entry, jint method_index = 0); static int ic_check_size(); diff --git a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp index 6154365988655..5cfc0f6994294 100644 --- a/src/hotspot/cpu/riscv/nativeInst_riscv.cpp +++ b/src/hotspot/cpu/riscv/nativeInst_riscv.cpp @@ -248,7 +248,7 @@ bool NativeShortCall::set_destination_mt_safe(address dest, bool assert_lock) { bool NativeShortCall::reloc_set_destination(address dest) { address call_addr = addr_at(0); assert(NativeCall::is_at(call_addr), "unexpected code at call site"); - + // Patch the constant in the call's trampoline stub. address trampoline_stub_addr = get_trampoline(); if (trampoline_stub_addr != nullptr) { @@ -338,7 +338,7 @@ class NativeFarCall: public NativeInstruction { address next_instruction_address() const { return addr_at(return_address_offset); } address return_address() const { return addr_at(return_address_offset); } address destination() const; - address reloc_destination(address orig_address); + address reloc_destination(address orig_address, int cp_offset); void set_destination(address dest); void verify_alignment() {} // do nothing on riscv @@ -346,16 +346,7 @@ class NativeFarCall: public NativeInstruction { void print(); bool set_destination_mt_safe(address dest, bool assert_lock = true); - bool reloc_set_destination(address dest); - - private: - address stub_address(); - address stub_address_destination(); - bool has_address_stub(); - - static void set_stub_address_destination_at(address dest, address value); - static address stub_address_destination_at(address src); - public: + bool reloc_set_destination(address dest, int cp_offset); static NativeFarCall* at(address addr); static bool is_at(address addr); @@ -367,29 +358,40 @@ class NativeFarCall: public NativeInstruction { address NativeFarCall::destination() const { address addr = addr_at(0); assert(NativeFarCall::is_at(addr), "unexpected code at call site"); - address destination = MacroAssembler::target_addr_for_insn(addr); + address dest = (address)get_data64_at(destination); - CodeBlob* cb = CodeCache::find_blob(addr); - assert(cb && cb->is_nmethod(), "sanity"); - nmethod *nm = (nmethod *)cb; - assert(nm != nullptr, "Sanity"); - assert(nm->stub_contains(destination), "Sanity"); - assert(destination != nullptr, "Sanity"); - return stub_address_destination_at(destination); -} + fprintf(stderr,"CALL (%s) AT: %p loads: %p contains: %p\n", __func__, addr, destination, dest); fflush(stderr); -address NativeFarCall::reloc_destination(address orig_address) { - address call_addr = addr_at(0); + return dest; +} - CodeBlob *code = CodeCache::find_blob(call_addr); - assert(code != nullptr, "Could not find the containing code blob"); - address stub_addr = trampoline_stub_Relocation::get_trampoline_for(call_addr, (nmethod*)code); +address NativeFarCall::reloc_destination(address orig_address, int cp_offset) { + address new_addr = addr_at(0); + assert(NativeFarCall::is_at(new_addr), "unexpected code at call site"); - if (stub_addr != nullptr) { - stub_addr = MacroAssembler::target_addr_for_insn(call_addr); + if (orig_address != nullptr) { + assert(NativeFarCall::is_at(orig_address), "unexpected code at call site"); + + CodeBlob* old_cb = CodeCache::find_blob(orig_address); + assert(old_cb != nullptr, "Could not find code blob"); + + address old_ctable = old_cb->content_begin(); + address old_cp_dest = MacroAssembler::target_addr_for_insn(orig_address); + address old_dest = (address)get_data64_at(old_cp_dest); + + fprintf(stderr,"CALL ORIG (%s) AT: %p loads: %p (%p) contains: %p\n", __func__, orig_address, old_cp_dest, old_ctable, old_dest); fflush(stderr); + return old_dest; + } else { + CodeBlob* new_cb = CodeCache::find_blob(new_addr); + assert(new_cb != nullptr, "Could not find code blob"); + + address new_ctable = new_cb->content_begin(); + address new_cp_dest = MacroAssembler::target_addr_for_insn(new_addr); + address new_dest = (address)get_data64_at(new_cp_dest); + fprintf(stderr,"CALL NEW (%s) AT: %p loads: %p (%p) contains: %p\n", __func__, new_addr, new_cp_dest, new_ctable, new_dest); fflush(stderr); + return new_dest; } - return stub_addr; } void NativeFarCall::set_destination(address dest) { @@ -415,65 +417,54 @@ bool NativeFarCall::set_destination_mt_safe(address dest, bool assert_lock) { "concurrent code patching"); address call_addr = addr_at(0); - assert(NativeFarCall::is_at(call_addr), "unexpected code at call site"); - - address stub_addr = stub_address(); - - if (stub_addr != nullptr) { - set_stub_address_destination_at(stub_addr, dest); + address cp_pool_addr = MacroAssembler::target_addr_for_insn(call_addr); + + if (cp_pool_addr != nullptr) { + address dest_old = (address)get_data64_at(cp_pool_addr); + fprintf(stderr,"CALL (%s) OLD AT: %p loads: %p contains: %p\n", __func__, call_addr, cp_pool_addr, dest_old); fflush(stderr); + set_data64_at(cp_pool_addr, (uint64_t)dest); + fprintf(stderr,"CALL (%s) NEW AT: %p loads: %p contains: %p\n", __func__, call_addr, cp_pool_addr, dest); fflush(stderr); + OrderAccess::release(); return true; + } else { + fprintf(stderr,"CALL cp poll nullptr (%s) AT: %p loads: %p contains: %p\n", __func__, call_addr, cp_pool_addr, dest); fflush(stderr); } return false; } -bool NativeFarCall::reloc_set_destination(address dest) { +bool NativeFarCall::reloc_set_destination(address dest, int cp_offset) { address call_addr = addr_at(0); - assert(NativeFarCall::is_at(call_addr), "unexpected code at call site"); - - CodeBlob *code = CodeCache::find_blob(call_addr); - assert(code != nullptr, "Could not find the containing code blob"); - address stub_addr = trampoline_stub_Relocation::get_trampoline_for(call_addr, (nmethod*)code); - - if (stub_addr != nullptr) { - MacroAssembler::pd_patch_instruction_size(call_addr, stub_addr); + + CodeBlob* cb = CodeCache::find_blob(call_addr); + assert(cb != nullptr, "Could not find code blob"); + nmethod* nm = cb->as_nmethod_or_null(); + address ctable = cb->ctable_begin(); + + address cp_entry_addr = nullptr; + if (nm != nullptr) { + RelocIterator iter(nm, instruction_address(), next_instruction_address()); + while (iter.next()) { + if (iter.type() == relocInfo::section_word_type) { + cp_entry_addr = iter.section_word_reloc()->target(); + break; + } + } } - return true; -} - -void NativeFarCall::set_stub_address_destination_at(address dest, address value) { - assert_cond(dest != nullptr); - assert_cond(value != nullptr); - - set_data64_at(dest, (uint64_t)value); - OrderAccess::release(); -} - -address NativeFarCall::stub_address_destination_at(address src) { - assert_cond(src != nullptr); - address dest = (address)get_data64_at(src); - return dest; -} - -address NativeFarCall::stub_address() { - address call_addr = addr_at(0); - - CodeBlob *code = CodeCache::find_blob(call_addr); - assert(code != nullptr, "Could not find the containing code blob"); - - address dest = MacroAssembler::pd_call_destination(call_addr); - assert(code->contains(dest), "Sanity"); - return dest; + if (cp_entry_addr != nullptr) { + fprintf(stderr,"CALL (%s) (%p) patching to: %p\n", __func__, ctable, cp_entry_addr); fflush(stderr); + MacroAssembler::pd_patch_instruction_size(call_addr, cp_entry_addr); + } else { + cp_entry_addr = MacroAssembler::target_addr_for_insn(call_addr); + } -} + assert(MacroAssembler::target_addr_for_insn(call_addr) == cp_entry_addr, "Must be"); -bool NativeFarCall::has_address_stub() { - return stub_address() != nullptr; -} + set_data64_at(cp_entry_addr, (uint64_t)dest); -address NativeFarCall::stub_address_destination() { - return stub_address_destination_at(stub_address()); + fprintf(stderr,"CALL (%s) SET AT: %p loads: %p (%p) contains: %p\n", __func__, call_addr, cp_entry_addr, ctable, dest); fflush(stderr); + return true; } NativeFarCall* NativeFarCall::at(address addr) { @@ -547,9 +538,9 @@ address NativeCall::destination() const { } } -address NativeCall::reloc_destination(address orig_address) { +address NativeCall::reloc_destination(address orig_address, int cp_offset) { if (!UseTrampolines) { - return NativeFarCall::at(addr_at(0))->reloc_destination(orig_address); + return NativeFarCall::at(addr_at(0))->reloc_destination(orig_address, cp_offset); } else { return NativeShortCall::at(addr_at(0))->reloc_destination(orig_address); } @@ -587,9 +578,9 @@ bool NativeCall::set_destination_mt_safe(address dest, bool assert_lock) { } } -bool NativeCall::reloc_set_destination(address dest) { +bool NativeCall::reloc_set_destination(address dest, int cp_offset) { if (!UseTrampolines) { - return NativeFarCall::at(addr_at(0))->reloc_set_destination(dest); + return NativeFarCall::at(addr_at(0))->reloc_set_destination(dest, cp_offset); } else { return NativeShortCall::at(addr_at(0))->reloc_set_destination(dest); } diff --git a/src/hotspot/cpu/riscv/nativeInst_riscv.hpp b/src/hotspot/cpu/riscv/nativeInst_riscv.hpp index 72b57376ecedc..187d2ea973c64 100644 --- a/src/hotspot/cpu/riscv/nativeInst_riscv.hpp +++ b/src/hotspot/cpu/riscv/nativeInst_riscv.hpp @@ -138,7 +138,7 @@ class NativeCall: private NativeInstruction { address next_instruction_address() const; address return_address() const; address destination() const; - address reloc_destination(address orig_address); + address reloc_destination(address orig_address, int cp_offset); void verify_alignment() {} // do nothing on riscv void verify(); @@ -146,7 +146,7 @@ class NativeCall: private NativeInstruction { void set_destination(address dest); bool set_destination_mt_safe(address dest, bool assert_lock = true); - bool reloc_set_destination(address dest); + bool reloc_set_destination(address dest, int cp_offset); static bool is_at(address addr); static bool is_call_before(address return_address); diff --git a/src/hotspot/cpu/riscv/relocInfo_riscv.cpp b/src/hotspot/cpu/riscv/relocInfo_riscv.cpp index d0903c96e2271..104775751d5f1 100644 --- a/src/hotspot/cpu/riscv/relocInfo_riscv.cpp +++ b/src/hotspot/cpu/riscv/relocInfo_riscv.cpp @@ -61,7 +61,8 @@ void Relocation::pd_set_data_value(address x, bool verify_only) { address Relocation::pd_call_destination(address orig_addr) { assert(is_call(), "should be an address instruction here"); if (NativeCall::is_at(addr())) { - return nativeCall_at(addr())->reloc_destination(orig_addr); + int cp_offset = ((CallRelocation*)this)->get_constant_pool_offset(); + return nativeCall_at(addr())->reloc_destination(orig_addr, cp_offset); } // Non call reloc if (orig_addr != nullptr) { @@ -81,7 +82,8 @@ void Relocation::pd_set_call_destination(address x) { assert(is_call(), "should be an address instruction here"); if (NativeCall::is_at(addr())) { NativeCall* nc = nativeCall_at(addr()); - if (nc->reloc_set_destination(x)) { + int cp_offset = ((CallRelocation*)this)->get_constant_pool_offset(); + if (nc->reloc_set_destination(x, cp_offset)) { return; } } diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 81c4d001078cb..00a6e21cd7cad 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -83,7 +83,7 @@ CodeBlob::CodeBlob(const char* name, CodeBlobKind kind, CodeBuffer* cb, int size _code_offset(_content_offset + cb->total_offset_of(cb->insts())), _data_offset(_content_offset + align_up(cb->total_content_size(), oopSize)), _frame_size(frame_size), - S390_ONLY(_ctable_offset(0) COMMA) + _ctable_offset(0), _header_size(header_size), _frame_complete_offset(frame_complete_offset), _kind(kind), @@ -112,7 +112,7 @@ CodeBlob::CodeBlob(const char* name, CodeBlobKind kind, int size, uint16_t heade _code_offset(_content_offset), _data_offset(size), _frame_size(0), - S390_ONLY(_ctable_offset(0) COMMA) + _ctable_offset(0), _header_size(header_size), _frame_complete_offset(CodeOffsets::frame_never_safe), _kind(kind), diff --git a/src/hotspot/share/code/codeBlob.hpp b/src/hotspot/share/code/codeBlob.hpp index 26ae5f7df5941..a572fd2b6283a 100644 --- a/src/hotspot/share/code/codeBlob.hpp +++ b/src/hotspot/share/code/codeBlob.hpp @@ -112,7 +112,7 @@ class CodeBlob { int _data_offset; // offset to where data region begins int _frame_size; // size of stack frame in words (NOT slots. On x64 these are 64bit words) - S390_ONLY(int _ctable_offset;) + int _ctable_offset; uint16_t _header_size; // size of header (depends on subclass) int16_t _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have @@ -191,8 +191,8 @@ class CodeBlob { // This field holds the beginning of the const section in the old code buffer. // It is needed to fix relocations of pc-relative loads when resizing the // the constant pool or moving it. - S390_ONLY(address ctable_begin() const { return header_begin() + _ctable_offset; }) - void set_ctable_begin(address ctable) { S390_ONLY(_ctable_offset = ctable - header_begin();) } + address ctable_begin() const { return header_begin() + _ctable_offset; } + void set_ctable_begin(address ctable) { _ctable_offset = ctable - header_begin(); } // Sizes int size() const { return _size; } diff --git a/src/hotspot/share/code/compiledIC.cpp b/src/hotspot/share/code/compiledIC.cpp index 079c8199b1870..f91ae0914ad4b 100644 --- a/src/hotspot/share/code/compiledIC.cpp +++ b/src/hotspot/share/code/compiledIC.cpp @@ -174,7 +174,11 @@ CompiledIC* CompiledIC_before(nmethod* nm, address return_addr) { CompiledIC* CompiledIC_at(nmethod* nm, address call_site) { RelocIterator iter(nm, call_site, call_site + 1); - iter.next(); + while (iter.next()) { + if (iter.reloc()->type() == relocInfo::virtual_call_type) { + break; + } + } return CompiledIC_at(&iter); } @@ -402,7 +406,10 @@ address CompiledDirectCall::find_stub_for(address instruction) { // from the CompiledIC implementation case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->static_stub(); + case relocInfo::section_word_type: + break; default: + assert(false, "Type: %d", iter.type()); ShouldNotReachHere(); } } diff --git a/src/hotspot/share/code/relocInfo.cpp b/src/hotspot/share/code/relocInfo.cpp index 5527436413cee..57d204f1be532 100644 --- a/src/hotspot/share/code/relocInfo.cpp +++ b/src/hotspot/share/code/relocInfo.cpp @@ -342,7 +342,7 @@ address Relocation::new_addr_for(address olda, sect = src->section_index_of(olda); if (sect != CodeBuffer::SECT_NONE) break; } - guarantee(sect != CodeBuffer::SECT_NONE, "lost track of this address"); + guarantee(sect != CodeBuffer::SECT_NONE, "lost track of this address: %p src: %p dest: %p", olda, src, dest); address ostart = src->code_section(sect)->start(); address nstart = dest->code_section(sect)->start(); return nstart + (olda - ostart); diff --git a/src/hotspot/share/code/relocInfo.hpp b/src/hotspot/share/code/relocInfo.hpp index 6d0907d97dedc..01a30e766efb2 100644 --- a/src/hotspot/share/code/relocInfo.hpp +++ b/src/hotspot/share/code/relocInfo.hpp @@ -940,8 +940,13 @@ class entry_guard_Relocation : public Relocation { // A CallRelocation always points at a call instruction. // It is PC-relative on most machines. class CallRelocation : public Relocation { + int _offset; public: - CallRelocation(relocInfo::relocType type) : Relocation(type) { } + CallRelocation(relocInfo::relocType type) : Relocation(type), + _offset(-4) /* <0 = invalid */ { } + + void set_constant_pool_offset(int offset) { _offset = offset; } + int get_constant_pool_offset() { return _offset; } bool is_call() override { return true; } @@ -1223,8 +1228,9 @@ class runtime_call_Relocation : public CallRelocation { class runtime_call_w_cp_Relocation : public CallRelocation { public: - static RelocationHolder spec() { - return RelocationHolder::construct(); + + static RelocationHolder spec(int offset = -4) { + return RelocationHolder::construct(offset); } void copy_into(RelocationHolder& holder) const override; @@ -1235,6 +1241,10 @@ class runtime_call_w_cp_Relocation : public CallRelocation { : CallRelocation(relocInfo::runtime_call_w_cp_type), _offset(-4) /* <0 = invalid */ { } + runtime_call_w_cp_Relocation(int offset) + : CallRelocation(relocInfo::runtime_call_w_cp_type), + _offset(offset) { } + // On z/Architecture, runtime calls are either a sequence // of two instructions (load destination of call from constant pool + do call) // or a pc-relative call. The pc-relative call is faster, but it can only diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index 0a7f5c5467668..48091e1b7675d 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -2742,16 +2742,16 @@ void AdapterHandlerLibrary::create_native_wrapper(const methodHandle& method) { struct { double data[20]; } locs_buf; struct { double data[20]; } stubs_locs_buf; buffer.insts()->initialize_shared_locs((relocInfo*)&locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); -#if defined(AARCH64) || defined(PPC64) +//#if defined(AARCH64) || defined(PPC64) // On AArch64 with ZGC and nmethod entry barriers, we need all oops to be // in the constant pool to ensure ordering between the barrier and oops // accesses. For native_wrappers we need a constant. // On PPC64 the continuation enter intrinsic needs the constant pool for the compiled // static java call that is resolved in the runtime. - if (PPC64_ONLY(method->is_continuation_enter_intrinsic() &&) true) { - buffer.initialize_consts_size(8 PPC64_ONLY(+ 24)); - } -#endif +// if (PPC64_ONLY(method->is_continuation_enter_intrinsic() &&) true) { + buffer.initialize_consts_size(32); // PPC64_ONLY(+ 24)); +// } +//#endif buffer.stubs()->initialize_shared_locs((relocInfo*)&stubs_locs_buf, sizeof(stubs_locs_buf) / sizeof(relocInfo)); MacroAssembler _masm(&buffer);