Skip to content

Commit 9039022

Browse files
author
Evgeny Astigeevich
committed
8287394: AArch64: Remove cbuf parameter from far_call/far_jump/trampoline_call
Reviewed-by: aph
1 parent 1dc5039 commit 9039022

5 files changed

+18
-27
lines changed

src/hotspot/cpu/aarch64/aarch64.ad

+4-6
Original file line numberDiff line numberDiff line change
@@ -3622,7 +3622,7 @@ encode %{
36223622
address call;
36233623
if (!_method) {
36243624
// A call to a runtime wrapper, e.g. new, new_typeArray_Java, uncommon_trap.
3625-
call = __ trampoline_call(Address(addr, relocInfo::runtime_call_type), &cbuf);
3625+
call = __ trampoline_call(Address(addr, relocInfo::runtime_call_type));
36263626
if (call == NULL) {
36273627
ciEnv::current()->record_failure("CodeCache is full");
36283628
return;
@@ -3631,26 +3631,25 @@ encode %{
36313631
int method_index = resolved_method_index(cbuf);
36323632
RelocationHolder rspec = _optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
36333633
: static_call_Relocation::spec(method_index);
3634-
call = __ trampoline_call(Address(addr, rspec), &cbuf);
3634+
call = __ trampoline_call(Address(addr, rspec));
36353635
if (call == NULL) {
36363636
ciEnv::current()->record_failure("CodeCache is full");
36373637
return;
36383638
}
36393639
if (CodeBuffer::supports_shared_stubs() && _method->can_be_statically_bound()) {
36403640
// Calls of the same statically bound method can share
36413641
// a stub to the interpreter.
3642-
cbuf.shared_stub_to_interp_for(_method, cbuf.insts()->mark_off());
3642+
cbuf.shared_stub_to_interp_for(_method, call - cbuf.insts_begin());
36433643
} else {
36443644
// Emit stub for static call
3645-
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
3645+
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf, call);
36463646
if (stub == NULL) {
36473647
ciEnv::current()->record_failure("CodeCache is full");
36483648
return;
36493649
}
36503650
}
36513651
}
36523652

3653-
_masm.clear_inst_mark();
36543653
__ post_call_nop();
36553654

36563655
// Only non uncommon_trap calls need to reinitialize ptrue.
@@ -3697,7 +3696,6 @@ encode %{
36973696
ciEnv::current()->record_failure("CodeCache is full");
36983697
return;
36993698
}
3700-
_masm.clear_inst_mark();
37013699
__ post_call_nop();
37023700
} else {
37033701
Label retaddr;

src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
308308
if (_obj->is_cpu_register()) {
309309
__ mov(rscratch1, _obj->as_register());
310310
}
311-
__ far_call(RuntimeAddress(Runtime1::entry_for(_stub)), NULL, rscratch2);
311+
__ far_call(RuntimeAddress(Runtime1::entry_for(_stub)), rscratch2);
312312
ce->add_call_info_here(_info);
313313
debug_only(__ should_not_reach_here());
314314
}

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static inline bool target_needs_far_branch(address addr) {
684684
return !CodeCache::is_non_nmethod(addr);
685685
}
686686

687-
void MacroAssembler::far_call(Address entry, CodeBuffer *cbuf, Register tmp) {
687+
void MacroAssembler::far_call(Address entry, Register tmp) {
688688
assert(ReservedCodeCacheSize < 4*G, "branch out of range");
689689
assert(CodeCache::find_blob(entry.target()) != NULL,
690690
"destination of far call not found in code cache");
@@ -697,15 +697,13 @@ void MacroAssembler::far_call(Address entry, CodeBuffer *cbuf, Register tmp) {
697697
// the code cache cannot exceed 2Gb (ADRP limit is 4GB).
698698
adrp(tmp, entry, offset);
699699
add(tmp, tmp, offset);
700-
if (cbuf) cbuf->set_insts_mark();
701700
blr(tmp);
702701
} else {
703-
if (cbuf) cbuf->set_insts_mark();
704702
bl(entry);
705703
}
706704
}
707705

708-
int MacroAssembler::far_jump(Address entry, CodeBuffer *cbuf, Register tmp) {
706+
int MacroAssembler::far_jump(Address entry, Register tmp) {
709707
assert(ReservedCodeCacheSize < 4*G, "branch out of range");
710708
assert(CodeCache::find_blob(entry.target()) != NULL,
711709
"destination of far call not found in code cache");
@@ -719,10 +717,8 @@ int MacroAssembler::far_jump(Address entry, CodeBuffer *cbuf, Register tmp) {
719717
// the code cache cannot exceed 2Gb (ADRP limit is 4GB).
720718
adrp(tmp, entry, offset);
721719
add(tmp, tmp, offset);
722-
if (cbuf) cbuf->set_insts_mark();
723720
br(tmp);
724721
} else {
725-
if (cbuf) cbuf->set_insts_mark();
726722
b(entry);
727723
}
728724
return pc() - start;
@@ -882,7 +878,7 @@ static bool is_always_within_branch_range(Address entry) {
882878

883879
// Maybe emit a call via a trampoline. If the code cache is small
884880
// trampolines won't be emitted.
885-
address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf) {
881+
address MacroAssembler::trampoline_call(Address entry) {
886882
assert(entry.rspec().type() == relocInfo::runtime_call_type
887883
|| entry.rspec().type() == relocInfo::opt_virtual_call_type
888884
|| entry.rspec().type() == relocInfo::static_call_type
@@ -908,13 +904,12 @@ address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf) {
908904
target = pc();
909905
}
910906

911-
if (cbuf) cbuf->set_insts_mark();
907+
address call_pc = pc();
912908
relocate(entry.rspec());
913909
bl(target);
914910

915-
// just need to return a non-null address
916911
postcond(pc() != badAddress);
917-
return pc();
912+
return call_pc;
918913
}
919914

920915
// Emit a trampoline stub for a call to a target which is too far away.

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,8 @@ class MacroAssembler: public Assembler {
11781178
// - relocInfo::static_call_type
11791179
// - relocInfo::virtual_call_type
11801180
//
1181-
// Return: NULL if CodeCache is full.
1182-
address trampoline_call(Address entry, CodeBuffer* cbuf = NULL);
1181+
// Return: the call PC or NULL if CodeCache is full.
1182+
address trampoline_call(Address entry);
11831183

11841184
static bool far_branches() {
11851185
return ReservedCodeCacheSize > branch_range;
@@ -1201,8 +1201,8 @@ class MacroAssembler: public Assembler {
12011201
// The tmp register is invalidated.
12021202
//
12031203
// Far_jump returns the amount of the emitted code.
1204-
void far_call(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
1205-
int far_jump(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
1204+
void far_call(Address entry, Register tmp = rscratch1);
1205+
int far_jump(Address entry, Register tmp = rscratch1);
12061206

12071207
static int far_codestub_branch_size() {
12081208
if (codestub_branch_needs_far_jump()) {

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -1053,16 +1053,15 @@ static void gen_continuation_enter(MacroAssembler* masm,
10531053

10541054
__ cbnz(c_rarg2, call_thaw);
10551055

1056-
address mark = __ pc();
1057-
__ trampoline_call(resolve);
1056+
const address tr_call = __ trampoline_call(resolve);
10581057

10591058
oop_maps->add_gc_map(__ pc() - start, map);
10601059
__ post_call_nop();
10611060

10621061
__ b(exit);
10631062

10641063
CodeBuffer* cbuf = masm->code_section()->outer();
1065-
CompiledStaticCall::emit_to_interp_stub(*cbuf, mark);
1064+
CompiledStaticCall::emit_to_interp_stub(*cbuf, tr_call);
10661065
}
10671066

10681067
// compiled entry
@@ -1078,8 +1077,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
10781077

10791078
__ cbnz(c_rarg2, call_thaw);
10801079

1081-
address mark = __ pc();
1082-
__ trampoline_call(resolve);
1080+
const address tr_call = __ trampoline_call(resolve);
10831081

10841082
oop_maps->add_gc_map(__ pc() - start, map);
10851083
__ post_call_nop();
@@ -1121,7 +1119,7 @@ static void gen_continuation_enter(MacroAssembler* masm,
11211119
}
11221120

11231121
CodeBuffer* cbuf = masm->code_section()->outer();
1124-
CompiledStaticCall::emit_to_interp_stub(*cbuf, mark);
1122+
CompiledStaticCall::emit_to_interp_stub(*cbuf, tr_call);
11251123
}
11261124

11271125
static void gen_continuation_yield(MacroAssembler* masm,

0 commit comments

Comments
 (0)