@@ -851,18 +851,19 @@ void MacroAssembler::call_VM_helper(Register oop_result, address entry_point, in
851
851
852
852
// Maybe emit a call via a trampoline. If the code cache is small
853
853
// trampolines won't be emitted.
854
- address MacroAssembler::trampoline_call (Address entry, CodeBuffer* cbuf,
855
- bool check_emit_size) {
854
+ address MacroAssembler::trampoline_call (Address entry, CodeBuffer* cbuf) {
856
855
assert (entry.rspec ().type () == relocInfo::runtime_call_type
857
856
|| entry.rspec ().type () == relocInfo::opt_virtual_call_type
858
857
|| entry.rspec ().type () == relocInfo::static_call_type
859
858
|| entry.rspec ().type () == relocInfo::virtual_call_type, " wrong reloc type" );
860
859
860
+ address target = entry.target ();
861
+
862
+ // We might need a trampoline if branches are far.
861
863
bool need_trampoline = far_branches ();
862
- if (!need_trampoline && entry.rspec ().type () == relocInfo::runtime_call_type && !CodeCache::contains (entry. target () )) {
864
+ if (!need_trampoline && entry.rspec ().type () == relocInfo::runtime_call_type && !CodeCache::contains (target)) {
863
865
// If it is a runtime call of an address outside small CodeCache,
864
866
// we need to check whether it is in range.
865
- address target = entry.target ();
866
867
assert (target < CodeCache::low_bound () || target >= CodeCache::high_bound (), " target is inside CodeCache" );
867
868
// Case 1: -------T-------L====CodeCache====H-------
868
869
// ^-------longest branch---|
@@ -873,35 +874,23 @@ address MacroAssembler::trampoline_call(Address entry, CodeBuffer* cbuf,
873
874
need_trampoline = !reachable_from_branch_at (longest_branch_start, target);
874
875
}
875
876
876
- // We need a trampoline if branches are far.
877
877
if (need_trampoline) {
878
- bool in_scratch_emit_size = false ;
879
- #ifdef COMPILER2
880
- if (check_emit_size) {
878
+ if (!in_scratch_emit_size ()) {
881
879
// We don't want to emit a trampoline if C2 is generating dummy
882
880
// code during its branch shortening phase.
883
- CompileTask* task = ciEnv::current ()->task ();
884
- in_scratch_emit_size =
885
- (task != NULL && is_c2_compile (task->comp_level ()) &&
886
- Compile::current ()->output ()->in_scratch_emit_size ());
887
- }
888
- #endif
889
- if (!in_scratch_emit_size) {
890
- address stub = emit_trampoline_stub (offset (), entry.target ());
881
+ address stub = emit_trampoline_stub (offset (), target);
891
882
if (stub == NULL ) {
892
883
postcond (pc () == badAddress);
893
884
return NULL ; // CodeCache is full
894
885
}
895
886
}
887
+ target = pc ();
896
888
}
897
889
898
890
if (cbuf) cbuf->set_insts_mark ();
899
891
relocate (entry.rspec ());
900
- if (!need_trampoline) {
901
- bl (entry.target ());
902
- } else {
903
- bl (pc ());
904
- }
892
+ bl (target);
893
+
905
894
// just need to return a non-null address
906
895
postcond (pc () != badAddress);
907
896
return pc ();
0 commit comments