@@ -60,13 +60,13 @@ class NativeFarCall: public NativeInstruction {
60
60
address next_instruction_address () const { return addr_at (return_address_offset); }
61
61
address return_address () const { return addr_at (return_address_offset); }
62
62
address destination () const ;
63
- address reloc_destination (address orig_address );
63
+ address reloc_destination ();
64
64
65
65
void set_destination (address dest);
66
66
void verify ();
67
67
void print ();
68
68
69
- bool set_destination_mt_safe (address dest, bool assert_lock = true );
69
+ bool set_destination_mt_safe (address dest);
70
70
bool reloc_set_destination (address dest);
71
71
72
72
private:
@@ -88,28 +88,30 @@ address NativeFarCall::destination() const {
88
88
address destination = MacroAssembler::target_addr_for_insn (addr);
89
89
90
90
CodeBlob* cb = CodeCache::find_blob (addr);
91
- assert (cb && cb->is_nmethod (), " sanity " );
91
+ assert (cb != nullptr && cb->is_nmethod (), " nmethod expected " );
92
92
nmethod *nm = (nmethod *)cb;
93
93
assert (nm != nullptr , " Sanity" );
94
94
assert (nm->stub_contains (destination), " Sanity" );
95
95
assert (destination != nullptr , " Sanity" );
96
96
return stub_address_destination_at (destination);
97
97
}
98
98
99
- address NativeFarCall::reloc_destination (address orig_address ) {
99
+ address NativeFarCall::reloc_destination () {
100
100
address call_addr = instruction_address ();
101
+ assert (NativeFarCall::is_at (call_addr), " unexpected code at call site" );
101
102
102
103
CodeBlob *code = CodeCache::find_blob (call_addr);
103
104
assert (code != nullptr , " Could not find the containing code blob" );
104
105
105
106
address stub_addr = nullptr ;
106
- if (code != nullptr && code ->is_nmethod ()) {
107
- stub_addr = trampoline_stub_Relocation::get_trampoline_for (call_addr, (nmethod*)code );
107
+ if (code->is_nmethod ()) {
108
+ stub_addr = trampoline_stub_Relocation::get_trampoline_for (call_addr, code-> as_nmethod () );
108
109
}
109
110
110
111
if (stub_addr != nullptr ) {
111
112
stub_addr = MacroAssembler::target_addr_for_insn (call_addr);
112
113
}
114
+
113
115
return stub_addr;
114
116
}
115
117
@@ -128,18 +130,13 @@ void NativeFarCall::print() {
128
130
tty->print_cr (PTR_FORMAT " : auipc,ld,jalr x1, offset/reg, " , p2i (addr_at (0 )));
129
131
}
130
132
131
- bool NativeFarCall::set_destination_mt_safe (address dest, bool assert_lock ) {
133
+ bool NativeFarCall::set_destination_mt_safe (address dest) {
132
134
assert (NativeFarCall::is_at (addr_at (0 )), " unexpected code at call site" );
133
- assert (!assert_lock ||
134
- (CodeCache_lock->is_locked () || SafepointSynchronize::is_at_safepoint ()) ||
135
+ assert ((CodeCache_lock->is_locked () || SafepointSynchronize::is_at_safepoint ()) ||
135
136
CompiledICLocker::is_safe (addr_at (0 )),
136
137
" concurrent code patching" );
137
138
138
- address call_addr = addr_at (0 );
139
- assert (NativeFarCall::is_at (call_addr), " unexpected code at call site" );
140
-
141
139
address stub_addr = stub_address ();
142
-
143
140
if (stub_addr != nullptr ) {
144
141
set_stub_address_destination_at (stub_addr, dest);
145
142
return true ;
@@ -156,10 +153,9 @@ bool NativeFarCall::reloc_set_destination(address dest) {
156
153
assert (code != nullptr , " Could not find the containing code blob" );
157
154
158
155
address stub_addr = nullptr ;
159
- if (code != nullptr && code ->is_nmethod ()) {
160
- stub_addr = trampoline_stub_Relocation::get_trampoline_for (call_addr, (nmethod*)code );
156
+ if (code->is_nmethod ()) {
157
+ stub_addr = trampoline_stub_Relocation::get_trampoline_for (call_addr, code-> as_nmethod () );
161
158
}
162
-
163
159
if (stub_addr != nullptr ) {
164
160
MacroAssembler::pd_patch_instruction_size (call_addr, stub_addr);
165
161
}
@@ -209,7 +205,7 @@ bool NativeFarCall::is_at(address addr) {
209
205
(MacroAssembler::extract_rd (addr + instr_size) == x6) &&
210
206
(MacroAssembler::extract_rs1 (addr + instr_size) == x6) &&
211
207
(MacroAssembler::extract_rs1 (addr + 2 * instr_size) == x6) &&
212
- (MacroAssembler::extract_rd (addr + 2 * instr_size) == x1)) {
208
+ (MacroAssembler::extract_rd (addr + 2 * instr_size) == x1)) {
213
209
return true ;
214
210
}
215
211
return false ;
@@ -238,8 +234,8 @@ address NativeCall::destination() const {
238
234
return NativeFarCall::at (addr_at (0 ))->destination ();
239
235
}
240
236
241
- address NativeCall::reloc_destination (address orig_address ) {
242
- return NativeFarCall::at (addr_at (0 ))->reloc_destination (orig_address );
237
+ address NativeCall::reloc_destination () {
238
+ return NativeFarCall::at (addr_at (0 ))->reloc_destination ();
243
239
}
244
240
245
241
void NativeCall::set_destination (address dest) {
@@ -254,8 +250,8 @@ void NativeCall::print() {
254
250
NativeFarCall::at (addr_at (0 ))->print ();;
255
251
}
256
252
257
- bool NativeCall::set_destination_mt_safe (address dest, bool assert_lock ) {
258
- return NativeFarCall::at (addr_at (0 ))->set_destination_mt_safe (dest, assert_lock );
253
+ bool NativeCall::set_destination_mt_safe (address dest) {
254
+ return NativeFarCall::at (addr_at (0 ))->set_destination_mt_safe (dest);
259
255
}
260
256
261
257
bool NativeCall::reloc_set_destination (address dest) {
0 commit comments