8287394: AArch64: Remove cbuf parameter from far_call/far_jump/trampoline_call

Reviewed-by: aph
This commit is contained in:
Evgeny Astigeevich 2022-09-13 17:19:16 +00:00
parent 1dc5039fed
commit 90390222bd
5 changed files with 18 additions and 27 deletions

@ -3622,7 +3622,7 @@ encode %{
address call;
if (!_method) {
// A call to a runtime wrapper, e.g. new, new_typeArray_Java, uncommon_trap.
call = __ trampoline_call(Address(addr, relocInfo::runtime_call_type), &cbuf);
call = __ trampoline_call(Address(addr, relocInfo::runtime_call_type));
if (call == NULL) {
ciEnv::current()->record_failure("CodeCache is full");
return;
@ -3631,7 +3631,7 @@ encode %{
int method_index = resolved_method_index(cbuf);
RelocationHolder rspec = _optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
: static_call_Relocation::spec(method_index);
call = __ trampoline_call(Address(addr, rspec), &cbuf);
call = __ trampoline_call(Address(addr, rspec));
if (call == NULL) {
ciEnv::current()->record_failure("CodeCache is full");
return;
@ -3639,10 +3639,10 @@ encode %{
if (CodeBuffer::supports_shared_stubs() && _method->can_be_statically_bound()) {
// Calls of the same statically bound method can share
// a stub to the interpreter.
cbuf.shared_stub_to_interp_for(_method, cbuf.insts()->mark_off());
cbuf.shared_stub_to_interp_for(_method, call - cbuf.insts_begin());
} else {
// Emit stub for static call
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf, call);
if (stub == NULL) {
ciEnv::current()->record_failure("CodeCache is full");
return;
@ -3650,7 +3650,6 @@ encode %{
}
}
_masm.clear_inst_mark();
__ post_call_nop();
// Only non uncommon_trap calls need to reinitialize ptrue.
@ -3697,7 +3696,6 @@ encode %{
ciEnv::current()->record_failure("CodeCache is full");
return;
}
_masm.clear_inst_mark();
__ post_call_nop();
} else {
Label retaddr;

@ -308,7 +308,7 @@ void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
if (_obj->is_cpu_register()) {
__ mov(rscratch1, _obj->as_register());
}
__ far_call(RuntimeAddress(Runtime1::entry_for(_stub)), NULL, rscratch2);
__ far_call(RuntimeAddress(Runtime1::entry_for(_stub)), rscratch2);
ce->add_call_info_here(_info);
debug_only(__ should_not_reach_here());
}

@ -684,7 +684,7 @@ static inline bool target_needs_far_branch(address addr) {
return !CodeCache::is_non_nmethod(addr);
}
void MacroAssembler::far_call(Address entry, CodeBuffer *cbuf, Register tmp) {
void MacroAssembler::far_call(Address entry, Register tmp) {
assert(ReservedCodeCacheSize < 4*G, "branch out of range");
assert(CodeCache::find_blob(entry.target()) != NULL,
"destination of far call not found in code cache");
@ -697,15 +697,13 @@ void MacroAssembler::far_call(Address entry, CodeBuffer *cbuf, Register tmp) {
// the code cache cannot exceed 2Gb (ADRP limit is 4GB).
adrp(tmp, entry, offset);
add(tmp, tmp, offset);
if (cbuf) cbuf->set_insts_mark();
blr(tmp);
} else {
if (cbuf) cbuf->set_insts_mark();
bl(entry);
}
}
int MacroAssembler::far_jump(Address entry, CodeBuffer *cbuf, Register tmp) {
int MacroAssembler::far_jump(Address entry, Register tmp) {
assert(ReservedCodeCacheSize < 4*G, "branch out of range");
assert(CodeCache::find_blob(entry.target()) != NULL,
"destination of far call not found in code cache");
@ -719,10 +717,8 @@ int MacroAssembler::far_jump(Address entry, CodeBuffer *cbuf, Register tmp) {
// the code cache cannot exceed 2Gb (ADRP limit is 4GB).
adrp(tmp, entry, offset);
add(tmp, tmp, offset);
if (cbuf) cbuf->set_insts_mark();
br(tmp);
} else {
if (cbuf) cbuf->set_insts_mark();
b(entry);
}
return pc() - start;
@ -882,7 +878,7 @@ static bool is_always_within_branch_range(Address entry) {
// Maybe emit a call via a trampoline. If the code cache is small
// trampolines won't be emitted.
address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf) {
address MacroAssembler::trampoline_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
@ -908,13 +904,12 @@ address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf) {
target = pc();
}
if (cbuf) cbuf->set_insts_mark();
address call_pc = pc();
relocate(entry.rspec());
bl(target);
// just need to return a non-null address
postcond(pc() != badAddress);
return pc();
return call_pc;
}
// Emit a trampoline stub for a call to a target which is too far away.

@ -1178,8 +1178,8 @@ public:
// - relocInfo::static_call_type
// - relocInfo::virtual_call_type
//
// Return: NULL if CodeCache is full.
address trampoline_call(Address entry, CodeBuffer* cbuf = NULL);
// Return: the call PC or NULL if CodeCache is full.
address trampoline_call(Address entry);
static bool far_branches() {
return ReservedCodeCacheSize > branch_range;
@ -1201,8 +1201,8 @@ public:
// The tmp register is invalidated.
//
// Far_jump returns the amount of the emitted code.
void far_call(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
int far_jump(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
void far_call(Address entry, Register tmp = rscratch1);
int far_jump(Address entry, Register tmp = rscratch1);
static int far_codestub_branch_size() {
if (codestub_branch_needs_far_jump()) {

@ -1053,8 +1053,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
__ cbnz(c_rarg2, call_thaw);
address mark = __ pc();
__ trampoline_call(resolve);
const address tr_call = __ trampoline_call(resolve);
oop_maps->add_gc_map(__ pc() - start, map);
__ post_call_nop();
@ -1062,7 +1061,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
__ b(exit);
CodeBuffer* cbuf = masm->code_section()->outer();
CompiledStaticCall::emit_to_interp_stub(*cbuf, mark);
CompiledStaticCall::emit_to_interp_stub(*cbuf, tr_call);
}
// compiled entry
@ -1078,8 +1077,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
__ cbnz(c_rarg2, call_thaw);
address mark = __ pc();
__ trampoline_call(resolve);
const address tr_call = __ trampoline_call(resolve);
oop_maps->add_gc_map(__ pc() - start, map);
__ post_call_nop();
@ -1121,7 +1119,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
}
CodeBuffer* cbuf = masm->code_section()->outer();
CompiledStaticCall::emit_to_interp_stub(*cbuf, mark);
CompiledStaticCall::emit_to_interp_stub(*cbuf, tr_call);
}
static void gen_continuation_yield(MacroAssembler* masm,