8291752: AArch64: Remove check_emit_size parameter from trampoline_call
Reviewed-by: kvn, aph
This commit is contained in:
parent
37d3146cca
commit
cb37282a12
@ -26,6 +26,7 @@
|
|||||||
#include "asm/assembler.hpp"
|
#include "asm/assembler.hpp"
|
||||||
#include "asm/assembler.inline.hpp"
|
#include "asm/assembler.inline.hpp"
|
||||||
#include "opto/c2_MacroAssembler.hpp"
|
#include "opto/c2_MacroAssembler.hpp"
|
||||||
|
#include "opto/compile.hpp"
|
||||||
#include "opto/intrinsicnode.hpp"
|
#include "opto/intrinsicnode.hpp"
|
||||||
#include "opto/matcher.hpp"
|
#include "opto/matcher.hpp"
|
||||||
#include "opto/output.hpp"
|
#include "opto/output.hpp"
|
||||||
@ -1654,3 +1655,14 @@ void C2_MacroAssembler::vector_round_sve(FloatRegister dst, FloatRegister src, F
|
|||||||
sve_fcvtzs(dst, T, ptrue, dst, T);
|
sve_fcvtzs(dst, T, ptrue, dst, T);
|
||||||
// result in dst
|
// result in dst
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool C2_MacroAssembler::in_scratch_emit_size() {
|
||||||
|
if (ciEnv::current()->task() != NULL) {
|
||||||
|
PhaseOutput* phase_output = Compile::current()->output();
|
||||||
|
if (phase_output != NULL && phase_output->in_scratch_emit_size()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MacroAssembler::in_scratch_emit_size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
|
|
||||||
// C2_MacroAssembler contains high-level macros for C2
|
// C2_MacroAssembler contains high-level macros for C2
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Return true if the phase output is in the scratch emit size mode.
|
||||||
|
virtual bool in_scratch_emit_size() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void emit_entry_barrier_stub(C2EntryBarrierStub* stub);
|
void emit_entry_barrier_stub(C2EntryBarrierStub* stub);
|
||||||
static int entry_barrier_stub_size();
|
static int entry_barrier_stub_size();
|
||||||
|
@ -851,18 +851,19 @@ void MacroAssembler::call_VM_helper(Register oop_result, address entry_point, in
|
|||||||
|
|
||||||
// Maybe emit a call via a trampoline. If the code cache is small
|
// Maybe emit a call via a trampoline. If the code cache is small
|
||||||
// trampolines won't be emitted.
|
// trampolines won't be emitted.
|
||||||
address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf,
|
address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf) {
|
||||||
bool check_emit_size) {
|
|
||||||
assert(entry.rspec().type() == relocInfo::runtime_call_type
|
assert(entry.rspec().type() == relocInfo::runtime_call_type
|
||||||
|| entry.rspec().type() == relocInfo::opt_virtual_call_type
|
|| entry.rspec().type() == relocInfo::opt_virtual_call_type
|
||||||
|| entry.rspec().type() == relocInfo::static_call_type
|
|| entry.rspec().type() == relocInfo::static_call_type
|
||||||
|| entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type");
|
|| entry.rspec().type() == relocInfo::virtual_call_type, "wrong reloc type");
|
||||||
|
|
||||||
|
address target = entry.target();
|
||||||
|
|
||||||
|
// We might need a trampoline if branches are far.
|
||||||
bool need_trampoline = far_branches();
|
bool need_trampoline = far_branches();
|
||||||
if (!need_trampoline && entry.rspec().type() == relocInfo::runtime_call_type && !CodeCache::contains(entry.target())) {
|
if (!need_trampoline && entry.rspec().type() == relocInfo::runtime_call_type && !CodeCache::contains(target)) {
|
||||||
// If it is a runtime call of an address outside small CodeCache,
|
// If it is a runtime call of an address outside small CodeCache,
|
||||||
// we need to check whether it is in range.
|
// we need to check whether it is in range.
|
||||||
address target = entry.target();
|
|
||||||
assert(target < CodeCache::low_bound() || target >= CodeCache::high_bound(), "target is inside CodeCache");
|
assert(target < CodeCache::low_bound() || target >= CodeCache::high_bound(), "target is inside CodeCache");
|
||||||
// Case 1: -------T-------L====CodeCache====H-------
|
// Case 1: -------T-------L====CodeCache====H-------
|
||||||
// ^-------longest branch---|
|
// ^-------longest branch---|
|
||||||
@ -873,35 +874,23 @@ address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf,
|
|||||||
need_trampoline = !reachable_from_branch_at(longest_branch_start, target);
|
need_trampoline = !reachable_from_branch_at(longest_branch_start, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need a trampoline if branches are far.
|
|
||||||
if (need_trampoline) {
|
if (need_trampoline) {
|
||||||
bool in_scratch_emit_size = false;
|
if (!in_scratch_emit_size()) {
|
||||||
#ifdef COMPILER2
|
|
||||||
if (check_emit_size) {
|
|
||||||
// We don't want to emit a trampoline if C2 is generating dummy
|
// We don't want to emit a trampoline if C2 is generating dummy
|
||||||
// code during its branch shortening phase.
|
// code during its branch shortening phase.
|
||||||
CompileTask* task = ciEnv::current()->task();
|
address stub = emit_trampoline_stub(offset(), target);
|
||||||
in_scratch_emit_size =
|
|
||||||
(task != NULL && is_c2_compile(task->comp_level()) &&
|
|
||||||
Compile::current()->output()->in_scratch_emit_size());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!in_scratch_emit_size) {
|
|
||||||
address stub = emit_trampoline_stub(offset(), entry.target());
|
|
||||||
if (stub == NULL) {
|
if (stub == NULL) {
|
||||||
postcond(pc() == badAddress);
|
postcond(pc() == badAddress);
|
||||||
return NULL; // CodeCache is full
|
return NULL; // CodeCache is full
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
target = pc();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cbuf) cbuf->set_insts_mark();
|
if (cbuf) cbuf->set_insts_mark();
|
||||||
relocate(entry.rspec());
|
relocate(entry.rspec());
|
||||||
if (!need_trampoline) {
|
bl(target);
|
||||||
bl(entry.target());
|
|
||||||
} else {
|
|
||||||
bl(pc());
|
|
||||||
}
|
|
||||||
// just need to return a non-null address
|
// just need to return a non-null address
|
||||||
postcond(pc() != badAddress);
|
postcond(pc() != badAddress);
|
||||||
return pc();
|
return pc();
|
||||||
|
@ -633,6 +633,10 @@ public:
|
|||||||
static int patch_oop(address insn_addr, address o);
|
static int patch_oop(address insn_addr, address o);
|
||||||
static int patch_narrow_klass(address insn_addr, narrowKlass n);
|
static int patch_narrow_klass(address insn_addr, narrowKlass n);
|
||||||
|
|
||||||
|
// Return whether code is emitted to a scratch blob.
|
||||||
|
virtual bool in_scratch_emit_size() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
address emit_trampoline_stub(int insts_call_instruction_offset, address target);
|
address emit_trampoline_stub(int insts_call_instruction_offset, address target);
|
||||||
void emit_static_call_stub();
|
void emit_static_call_stub();
|
||||||
|
|
||||||
@ -1175,7 +1179,7 @@ public:
|
|||||||
// - relocInfo::virtual_call_type
|
// - relocInfo::virtual_call_type
|
||||||
//
|
//
|
||||||
// Return: NULL if CodeCache is full.
|
// Return: NULL if CodeCache is full.
|
||||||
address trampoline_call(Address entry, CodeBuffer* cbuf = NULL, bool check_emit_size = true);
|
address trampoline_call(Address entry, CodeBuffer* cbuf = NULL);
|
||||||
|
|
||||||
static bool far_branches() {
|
static bool far_branches() {
|
||||||
return ReservedCodeCacheSize > branch_range;
|
return ReservedCodeCacheSize > branch_range;
|
||||||
|
@ -1054,7 +1054,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
|
|||||||
__ br(Assembler::NE, call_thaw);
|
__ br(Assembler::NE, call_thaw);
|
||||||
|
|
||||||
address mark = __ pc();
|
address mark = __ pc();
|
||||||
__ trampoline_call(resolve, /*cbuf=*/ NULL, /*check_emit_size=*/ false);
|
__ trampoline_call(resolve);
|
||||||
|
|
||||||
oop_maps->add_gc_map(__ pc() - start, map);
|
oop_maps->add_gc_map(__ pc() - start, map);
|
||||||
__ post_call_nop();
|
__ post_call_nop();
|
||||||
@ -1080,7 +1080,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
|
|||||||
__ br(Assembler::NE, call_thaw);
|
__ br(Assembler::NE, call_thaw);
|
||||||
|
|
||||||
address mark = __ pc();
|
address mark = __ pc();
|
||||||
__ trampoline_call(resolve, /*cbuf=*/ NULL, /*check_emit_size=*/ false);
|
__ trampoline_call(resolve);
|
||||||
|
|
||||||
oop_maps->add_gc_map(__ pc() - start, map);
|
oop_maps->add_gc_map(__ pc() - start, map);
|
||||||
__ post_call_nop();
|
__ post_call_nop();
|
||||||
|
Loading…
Reference in New Issue
Block a user