author | jwilhelm |
Thu, 12 Sep 2019 03:21:11 +0200 | |
changeset 58094 | 0f6c749acd15 |
parent 57811 | 947252a54b98 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
42664 | 1 |
/* |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47765
diff
changeset
|
2 |
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. |
42664 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47216
diff
changeset
|
26 |
#include "jvm.h" |
50380
bec342339138
8204195: Clean up macroAssembler.inline.hpp and other inline.hpp files included in .hpp files
coleenp
parents:
49982
diff
changeset
|
27 |
#include "asm/macroAssembler.inline.hpp" |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49480
diff
changeset
|
28 |
#include "gc/shared/barrierSet.hpp" |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
47765
diff
changeset
|
29 |
#include "gc/shared/cardTable.hpp" |
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49347
diff
changeset
|
30 |
#include "gc/shared/cardTableBarrierSet.inline.hpp" |
42664 | 31 |
#include "gc/shared/collectedHeap.hpp" |
32 |
#include "interp_masm_arm.hpp" |
|
33 |
#include "interpreter/interpreter.hpp" |
|
34 |
#include "interpreter/interpreterRuntime.hpp" |
|
35 |
#include "logging/log.hpp" |
|
36 |
#include "oops/arrayOop.hpp" |
|
57811 | 37 |
#include "oops/markWord.hpp" |
42664 | 38 |
#include "oops/method.hpp" |
39 |
#include "oops/methodData.hpp" |
|
40 |
#include "prims/jvmtiExport.hpp" |
|
41 |
#include "prims/jvmtiThreadState.hpp" |
|
42 |
#include "runtime/basicLock.hpp" |
|
43 |
#include "runtime/biasedLocking.hpp" |
|
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49455
diff
changeset
|
44 |
#include "runtime/frame.inline.hpp" |
42664 | 45 |
#include "runtime/sharedRuntime.hpp" |
46 |
||
47 |
//-------------------------------------------------------------------- |
|
48 |
// Implementation of InterpreterMacroAssembler |
|
49 |
||
50 |
||
51 |
||
52 |
||
53 |
InterpreterMacroAssembler::InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) { |
|
54 |
} |
|
55 |
||
56 |
void InterpreterMacroAssembler::call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions) { |
|
52351 | 57 |
#ifdef ASSERT |
42664 | 58 |
// Ensure that last_sp is not filled. |
59 |
{ Label L; |
|
60 |
ldr(Rtemp, Address(FP, frame::interpreter_frame_last_sp_offset * wordSize)); |
|
61 |
cbz(Rtemp, L); |
|
62 |
stop("InterpreterMacroAssembler::call_VM_helper: last_sp != NULL"); |
|
63 |
bind(L); |
|
64 |
} |
|
52351 | 65 |
#endif // ASSERT |
42664 | 66 |
|
67 |
// Rbcp must be saved/restored since it may change due to GC. |
|
68 |
save_bcp(); |
|
69 |
||
70 |
||
71 |
// super call |
|
72 |
MacroAssembler::call_VM_helper(oop_result, entry_point, number_of_arguments, check_exceptions); |
|
73 |
||
74 |
||
75 |
// Restore interpreter specific registers. |
|
76 |
restore_bcp(); |
|
77 |
restore_method(); |
|
78 |
} |
|
79 |
||
80 |
void InterpreterMacroAssembler::jump_to_entry(address entry) { |
|
81 |
assert(entry, "Entry must have been generated by now"); |
|
82 |
b(entry); |
|
83 |
} |
|
84 |
||
85 |
void InterpreterMacroAssembler::check_and_handle_popframe() { |
|
86 |
if (can_pop_frame()) { |
|
87 |
Label L; |
|
88 |
const Register popframe_cond = R2_tmp; |
|
89 |
||
90 |
// Initiate popframe handling only if it is not already being processed. If the flag |
|
91 |
// has the popframe_processing bit set, it means that this code is called *during* popframe |
|
92 |
// handling - we don't want to reenter. |
|
93 |
||
94 |
ldr_s32(popframe_cond, Address(Rthread, JavaThread::popframe_condition_offset())); |
|
95 |
tbz(popframe_cond, exact_log2(JavaThread::popframe_pending_bit), L); |
|
96 |
tbnz(popframe_cond, exact_log2(JavaThread::popframe_processing_bit), L); |
|
97 |
||
98 |
// Call Interpreter::remove_activation_preserving_args_entry() to get the |
|
99 |
// address of the same-named entrypoint in the generated interpreter code. |
|
100 |
call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry)); |
|
101 |
||
102 |
// Call indirectly to avoid generation ordering problem. |
|
103 |
jump(R0); |
|
104 |
||
105 |
bind(L); |
|
106 |
} |
|
107 |
} |
|
108 |
||
109 |
||
110 |
// Blows R2, Rtemp. Sets TOS cached value. |
|
111 |
void InterpreterMacroAssembler::load_earlyret_value(TosState state) { |
|
112 |
const Register thread_state = R2_tmp; |
|
113 |
||
114 |
ldr(thread_state, Address(Rthread, JavaThread::jvmti_thread_state_offset())); |
|
115 |
||
116 |
const Address tos_addr(thread_state, JvmtiThreadState::earlyret_tos_offset()); |
|
117 |
const Address oop_addr(thread_state, JvmtiThreadState::earlyret_oop_offset()); |
|
118 |
const Address val_addr(thread_state, JvmtiThreadState::earlyret_value_offset()); |
|
119 |
const Address val_addr_hi(thread_state, JvmtiThreadState::earlyret_value_offset() |
|
120 |
+ in_ByteSize(wordSize)); |
|
121 |
||
122 |
Register zero = zero_register(Rtemp); |
|
123 |
||
124 |
switch (state) { |
|
125 |
case atos: ldr(R0_tos, oop_addr); |
|
126 |
str(zero, oop_addr); |
|
127 |
interp_verify_oop(R0_tos, state, __FILE__, __LINE__); |
|
128 |
break; |
|
129 |
||
130 |
case ltos: ldr(R1_tos_hi, val_addr_hi); // fall through |
|
131 |
case btos: // fall through |
|
132 |
case ztos: // fall through |
|
133 |
case ctos: // fall through |
|
134 |
case stos: // fall through |
|
135 |
case itos: ldr_s32(R0_tos, val_addr); break; |
|
136 |
#ifdef __SOFTFP__ |
|
137 |
case dtos: ldr(R1_tos_hi, val_addr_hi); // fall through |
|
138 |
case ftos: ldr(R0_tos, val_addr); break; |
|
139 |
#else |
|
140 |
case ftos: ldr_float (S0_tos, val_addr); break; |
|
141 |
case dtos: ldr_double(D0_tos, val_addr); break; |
|
142 |
#endif // __SOFTFP__ |
|
143 |
case vtos: /* nothing to do */ break; |
|
144 |
default : ShouldNotReachHere(); |
|
145 |
} |
|
146 |
// Clean up tos value in the thread object |
|
147 |
str(zero, val_addr); |
|
148 |
str(zero, val_addr_hi); |
|
149 |
||
150 |
mov(Rtemp, (int) ilgl); |
|
151 |
str_32(Rtemp, tos_addr); |
|
152 |
} |
|
153 |
||
154 |
||
155 |
// Blows R2, Rtemp. |
|
156 |
void InterpreterMacroAssembler::check_and_handle_earlyret() { |
|
157 |
if (can_force_early_return()) { |
|
158 |
Label L; |
|
159 |
const Register thread_state = R2_tmp; |
|
160 |
||
161 |
ldr(thread_state, Address(Rthread, JavaThread::jvmti_thread_state_offset())); |
|
162 |
cbz(thread_state, L); // if (thread->jvmti_thread_state() == NULL) exit; |
|
163 |
||
164 |
// Initiate earlyret handling only if it is not already being processed. |
|
165 |
// If the flag has the earlyret_processing bit set, it means that this code |
|
166 |
// is called *during* earlyret handling - we don't want to reenter. |
|
167 |
||
168 |
ldr_s32(Rtemp, Address(thread_state, JvmtiThreadState::earlyret_state_offset())); |
|
169 |
cmp(Rtemp, JvmtiThreadState::earlyret_pending); |
|
170 |
b(L, ne); |
|
171 |
||
172 |
// Call Interpreter::remove_activation_early_entry() to get the address of the |
|
173 |
// same-named entrypoint in the generated interpreter code. |
|
174 |
||
175 |
ldr_s32(R0, Address(thread_state, JvmtiThreadState::earlyret_tos_offset())); |
|
176 |
call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), R0); |
|
177 |
||
178 |
jump(R0); |
|
179 |
||
180 |
bind(L); |
|
181 |
} |
|
182 |
} |
|
183 |
||
184 |
||
185 |
// Sets reg. Blows Rtemp. |
|
186 |
void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) { |
|
187 |
assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); |
|
188 |
assert(reg != Rtemp, "should be different registers"); |
|
189 |
||
190 |
ldrb(Rtemp, Address(Rbcp, bcp_offset)); |
|
191 |
ldrb(reg, Address(Rbcp, bcp_offset+1)); |
|
192 |
orr(reg, reg, AsmOperand(Rtemp, lsl, BitsPerByte)); |
|
193 |
} |
|
194 |
||
195 |
void InterpreterMacroAssembler::get_index_at_bcp(Register index, int bcp_offset, Register tmp_reg, size_t index_size) { |
|
196 |
assert_different_registers(index, tmp_reg); |
|
197 |
if (index_size == sizeof(u2)) { |
|
198 |
// load bytes of index separately to avoid unaligned access |
|
199 |
ldrb(index, Address(Rbcp, bcp_offset+1)); |
|
200 |
ldrb(tmp_reg, Address(Rbcp, bcp_offset)); |
|
201 |
orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte)); |
|
202 |
} else if (index_size == sizeof(u4)) { |
|
203 |
ldrb(index, Address(Rbcp, bcp_offset+3)); |
|
204 |
ldrb(tmp_reg, Address(Rbcp, bcp_offset+2)); |
|
205 |
orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte)); |
|
206 |
ldrb(tmp_reg, Address(Rbcp, bcp_offset+1)); |
|
207 |
orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte)); |
|
208 |
ldrb(tmp_reg, Address(Rbcp, bcp_offset)); |
|
209 |
orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte)); |
|
210 |
// Check if the secondary index definition is still ~x, otherwise |
|
211 |
// we have to change the following assembler code to calculate the |
|
212 |
// plain index. |
|
213 |
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line"); |
|
214 |
mvn_32(index, index); // convert to plain index |
|
215 |
} else if (index_size == sizeof(u1)) { |
|
216 |
ldrb(index, Address(Rbcp, bcp_offset)); |
|
217 |
} else { |
|
218 |
ShouldNotReachHere(); |
|
219 |
} |
|
220 |
} |
|
221 |
||
222 |
// Sets cache, index. |
|
223 |
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, Register index, int bcp_offset, size_t index_size) { |
|
224 |
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
|
225 |
assert_different_registers(cache, index); |
|
226 |
||
227 |
get_index_at_bcp(index, bcp_offset, cache, index_size); |
|
228 |
||
229 |
// load constant pool cache pointer |
|
230 |
ldr(cache, Address(FP, frame::interpreter_frame_cache_offset * wordSize)); |
|
231 |
||
232 |
// convert from field index to ConstantPoolCacheEntry index |
|
233 |
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below"); |
|
234 |
logical_shift_left(index, index, 2); |
|
235 |
} |
|
236 |
||
237 |
// Sets cache, index, bytecode. |
|
238 |
void InterpreterMacroAssembler::get_cache_and_index_and_bytecode_at_bcp(Register cache, Register index, Register bytecode, int byte_no, int bcp_offset, size_t index_size) { |
|
239 |
get_cache_and_index_at_bcp(cache, index, bcp_offset, index_size); |
|
240 |
// caution index and bytecode can be the same |
|
241 |
add(bytecode, cache, AsmOperand(index, lsl, LogBytesPerWord)); |
|
242 |
ldrb(bytecode, Address(bytecode, (1 + byte_no) + in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::indices_offset()))); |
|
243 |
TemplateTable::volatile_barrier(MacroAssembler::LoadLoad, noreg, true); |
|
244 |
} |
|
245 |
||
246 |
// Sets cache. Blows reg_tmp. |
|
247 |
void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, Register reg_tmp, int bcp_offset, size_t index_size) { |
|
248 |
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
|
249 |
assert_different_registers(cache, reg_tmp); |
|
250 |
||
251 |
get_index_at_bcp(reg_tmp, bcp_offset, cache, index_size); |
|
252 |
||
253 |
// load constant pool cache pointer |
|
254 |
ldr(cache, Address(FP, frame::interpreter_frame_cache_offset * wordSize)); |
|
255 |
||
256 |
// skip past the header |
|
257 |
add(cache, cache, in_bytes(ConstantPoolCache::base_offset())); |
|
258 |
// convert from field index to ConstantPoolCacheEntry index |
|
259 |
// and from word offset to byte offset |
|
260 |
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below"); |
|
261 |
add(cache, cache, AsmOperand(reg_tmp, lsl, 2 + LogBytesPerWord)); |
|
262 |
} |
|
263 |
||
264 |
// Load object from cpool->resolved_references(index) |
|
265 |
void InterpreterMacroAssembler::load_resolved_reference_at_index( |
|
266 |
Register result, Register index) { |
|
267 |
assert_different_registers(result, index); |
|
268 |
get_constant_pool(result); |
|
269 |
||
270 |
Register cache = result; |
|
271 |
// load pointer for resolved_references[] objArray |
|
46427
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
272 |
ldr(cache, Address(result, ConstantPool::cache_offset_in_bytes())); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
273 |
ldr(cache, Address(result, ConstantPoolCache::resolved_references_offset_in_bytes())); |
46961
c9094b1e5f87
8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents:
46427
diff
changeset
|
274 |
resolve_oop_handle(cache); |
42664 | 275 |
// Add in the index |
276 |
// convert from field index to resolved_references() index and from |
|
277 |
// word index to byte offset. Since this is a java object, it can be compressed |
|
51620
4871c2d2e97e
8209408: Primitive heap access for interpreter BarrierSetAssembler/arm32
bulasevich
parents:
50380
diff
changeset
|
278 |
logical_shift_left(index, index, LogBytesPerHeapOop); |
4871c2d2e97e
8209408: Primitive heap access for interpreter BarrierSetAssembler/arm32
bulasevich
parents:
50380
diff
changeset
|
279 |
add(index, index, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); |
4871c2d2e97e
8209408: Primitive heap access for interpreter BarrierSetAssembler/arm32
bulasevich
parents:
50380
diff
changeset
|
280 |
load_heap_oop(result, Address(cache, index)); |
42664 | 281 |
} |
282 |
||
46427
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
283 |
void InterpreterMacroAssembler::load_resolved_klass_at_offset( |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
284 |
Register Rcpool, Register Rindex, Register Rklass) { |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
285 |
add(Rtemp, Rcpool, AsmOperand(Rindex, lsl, LogBytesPerWord)); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
286 |
ldrh(Rtemp, Address(Rtemp, sizeof(ConstantPool))); // Rtemp = resolved_klass_index |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
287 |
ldr(Rklass, Address(Rcpool, ConstantPool::resolved_klasses_offset_in_bytes())); // Rklass = cpool->_resolved_klasses |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
288 |
add(Rklass, Rklass, AsmOperand(Rtemp, lsl, LogBytesPerWord)); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
289 |
ldr(Rklass, Address(Rklass, Array<Klass*>::base_offset_in_bytes())); |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
290 |
} |
54713555867e
8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents:
46369
diff
changeset
|
291 |
|
42664 | 292 |
// Generate a subtype check: branch to not_subtype if sub_klass is |
293 |
// not a subtype of super_klass. |
|
294 |
// Profiling code for the subtype check failure (profile_typecheck_failed) |
|
295 |
// should be explicitly generated by the caller in the not_subtype case. |
|
296 |
// Blows Rtemp, tmp1, tmp2. |
|
297 |
void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, |
|
298 |
Register Rsuper_klass, |
|
299 |
Label ¬_subtype, |
|
300 |
Register tmp1, |
|
301 |
Register tmp2) { |
|
302 |
||
303 |
assert_different_registers(Rsub_klass, Rsuper_klass, tmp1, tmp2, Rtemp); |
|
304 |
Label ok_is_subtype, loop, update_cache; |
|
305 |
||
306 |
const Register super_check_offset = tmp1; |
|
307 |
const Register cached_super = tmp2; |
|
308 |
||
309 |
// Profile the not-null value's klass. |
|
310 |
profile_typecheck(tmp1, Rsub_klass); |
|
311 |
||
312 |
// Load the super-klass's check offset into |
|
313 |
ldr_u32(super_check_offset, Address(Rsuper_klass, Klass::super_check_offset_offset())); |
|
314 |
||
315 |
// Check for self |
|
316 |
cmp(Rsub_klass, Rsuper_klass); |
|
317 |
||
318 |
// Load from the sub-klass's super-class display list, or a 1-word cache of |
|
319 |
// the secondary superclass list, or a failing value with a sentinel offset |
|
320 |
// if the super-klass is an interface or exceptionally deep in the Java |
|
321 |
// hierarchy and we have to scan the secondary superclass list the hard way. |
|
322 |
// See if we get an immediate positive hit |
|
323 |
ldr(cached_super, Address(Rsub_klass, super_check_offset)); |
|
324 |
||
325 |
cond_cmp(Rsuper_klass, cached_super, ne); |
|
326 |
b(ok_is_subtype, eq); |
|
327 |
||
328 |
// Check for immediate negative hit |
|
329 |
cmp(super_check_offset, in_bytes(Klass::secondary_super_cache_offset())); |
|
330 |
b(not_subtype, ne); |
|
331 |
||
332 |
// Now do a linear scan of the secondary super-klass chain. |
|
333 |
const Register supers_arr = tmp1; |
|
334 |
const Register supers_cnt = tmp2; |
|
335 |
const Register cur_super = Rtemp; |
|
336 |
||
337 |
// Load objArrayOop of secondary supers. |
|
338 |
ldr(supers_arr, Address(Rsub_klass, Klass::secondary_supers_offset())); |
|
339 |
||
340 |
ldr_u32(supers_cnt, Address(supers_arr, Array<Klass*>::length_offset_in_bytes())); // Load the array length |
|
341 |
cmp(supers_cnt, 0); |
|
342 |
||
343 |
// Skip to the start of array elements and prefetch the first super-klass. |
|
344 |
ldr(cur_super, Address(supers_arr, Array<Klass*>::base_offset_in_bytes(), pre_indexed), ne); |
|
345 |
b(not_subtype, eq); |
|
346 |
||
347 |
bind(loop); |
|
348 |
||
349 |
||
350 |
cmp(cur_super, Rsuper_klass); |
|
351 |
b(update_cache, eq); |
|
352 |
||
353 |
subs(supers_cnt, supers_cnt, 1); |
|
354 |
||
355 |
ldr(cur_super, Address(supers_arr, wordSize, pre_indexed), ne); |
|
356 |
||
357 |
b(loop, ne); |
|
358 |
||
359 |
b(not_subtype); |
|
360 |
||
361 |
bind(update_cache); |
|
362 |
// Must be equal but missed in cache. Update cache. |
|
363 |
str(Rsuper_klass, Address(Rsub_klass, Klass::secondary_super_cache_offset())); |
|
364 |
||
365 |
bind(ok_is_subtype); |
|
366 |
} |
|
367 |
||
368 |
||
369 |
////////////////////////////////////////////////////////////////////////////////// |
|
370 |
||
371 |
||
372 |
// Java Expression Stack |
|
373 |
||
374 |
void InterpreterMacroAssembler::pop_ptr(Register r) { |
|
375 |
assert(r != Rstack_top, "unpredictable instruction"); |
|
376 |
ldr(r, Address(Rstack_top, wordSize, post_indexed)); |
|
377 |
} |
|
378 |
||
379 |
void InterpreterMacroAssembler::pop_i(Register r) { |
|
380 |
assert(r != Rstack_top, "unpredictable instruction"); |
|
381 |
ldr_s32(r, Address(Rstack_top, wordSize, post_indexed)); |
|
382 |
zap_high_non_significant_bits(r); |
|
383 |
} |
|
384 |
||
385 |
void InterpreterMacroAssembler::pop_l(Register lo, Register hi) { |
|
386 |
assert_different_registers(lo, hi); |
|
387 |
assert(lo < hi, "lo must be < hi"); |
|
388 |
pop(RegisterSet(lo) | RegisterSet(hi)); |
|
389 |
} |
|
390 |
||
391 |
void InterpreterMacroAssembler::pop_f(FloatRegister fd) { |
|
392 |
fpops(fd); |
|
393 |
} |
|
394 |
||
395 |
void InterpreterMacroAssembler::pop_d(FloatRegister fd) { |
|
396 |
fpopd(fd); |
|
397 |
} |
|
398 |
||
399 |
||
400 |
// Transition vtos -> state. Blows R0, R1. Sets TOS cached value. |
|
401 |
void InterpreterMacroAssembler::pop(TosState state) { |
|
402 |
switch (state) { |
|
403 |
case atos: pop_ptr(R0_tos); break; |
|
404 |
case btos: // fall through |
|
405 |
case ztos: // fall through |
|
406 |
case ctos: // fall through |
|
407 |
case stos: // fall through |
|
408 |
case itos: pop_i(R0_tos); break; |
|
409 |
case ltos: pop_l(R0_tos_lo, R1_tos_hi); break; |
|
410 |
#ifdef __SOFTFP__ |
|
411 |
case ftos: pop_i(R0_tos); break; |
|
412 |
case dtos: pop_l(R0_tos_lo, R1_tos_hi); break; |
|
413 |
#else |
|
414 |
case ftos: pop_f(S0_tos); break; |
|
415 |
case dtos: pop_d(D0_tos); break; |
|
416 |
#endif // __SOFTFP__ |
|
417 |
case vtos: /* nothing to do */ break; |
|
418 |
default : ShouldNotReachHere(); |
|
419 |
} |
|
420 |
interp_verify_oop(R0_tos, state, __FILE__, __LINE__); |
|
421 |
} |
|
422 |
||
423 |
void InterpreterMacroAssembler::push_ptr(Register r) { |
|
424 |
assert(r != Rstack_top, "unpredictable instruction"); |
|
425 |
str(r, Address(Rstack_top, -wordSize, pre_indexed)); |
|
426 |
check_stack_top_on_expansion(); |
|
427 |
} |
|
428 |
||
429 |
void InterpreterMacroAssembler::push_i(Register r) { |
|
430 |
assert(r != Rstack_top, "unpredictable instruction"); |
|
431 |
str_32(r, Address(Rstack_top, -wordSize, pre_indexed)); |
|
432 |
check_stack_top_on_expansion(); |
|
433 |
} |
|
434 |
||
435 |
void InterpreterMacroAssembler::push_l(Register lo, Register hi) { |
|
436 |
assert_different_registers(lo, hi); |
|
437 |
assert(lo < hi, "lo must be < hi"); |
|
438 |
push(RegisterSet(lo) | RegisterSet(hi)); |
|
439 |
} |
|
440 |
||
441 |
void InterpreterMacroAssembler::push_f() { |
|
442 |
fpushs(S0_tos); |
|
443 |
} |
|
444 |
||
445 |
void InterpreterMacroAssembler::push_d() { |
|
446 |
fpushd(D0_tos); |
|
447 |
} |
|
448 |
||
449 |
// Transition state -> vtos. Blows Rtemp. |
|
450 |
void InterpreterMacroAssembler::push(TosState state) { |
|
451 |
interp_verify_oop(R0_tos, state, __FILE__, __LINE__); |
|
452 |
switch (state) { |
|
453 |
case atos: push_ptr(R0_tos); break; |
|
454 |
case btos: // fall through |
|
455 |
case ztos: // fall through |
|
456 |
case ctos: // fall through |
|
457 |
case stos: // fall through |
|
458 |
case itos: push_i(R0_tos); break; |
|
459 |
case ltos: push_l(R0_tos_lo, R1_tos_hi); break; |
|
460 |
#ifdef __SOFTFP__ |
|
461 |
case ftos: push_i(R0_tos); break; |
|
462 |
case dtos: push_l(R0_tos_lo, R1_tos_hi); break; |
|
463 |
#else |
|
464 |
case ftos: push_f(); break; |
|
465 |
case dtos: push_d(); break; |
|
466 |
#endif // __SOFTFP__ |
|
467 |
case vtos: /* nothing to do */ break; |
|
468 |
default : ShouldNotReachHere(); |
|
469 |
} |
|
470 |
} |
|
471 |
||
472 |
||
473 |
||
474 |
// Converts return value in R0/R1 (interpreter calling conventions) to TOS cached value. |
|
475 |
void InterpreterMacroAssembler::convert_retval_to_tos(TosState state) { |
|
476 |
#if (!defined __SOFTFP__ && !defined __ABI_HARD__) |
|
477 |
// According to interpreter calling conventions, result is returned in R0/R1, |
|
478 |
// but templates expect ftos in S0, and dtos in D0. |
|
479 |
if (state == ftos) { |
|
480 |
fmsr(S0_tos, R0); |
|
481 |
} else if (state == dtos) { |
|
482 |
fmdrr(D0_tos, R0, R1); |
|
483 |
} |
|
484 |
#endif // !__SOFTFP__ && !__ABI_HARD__ |
|
485 |
} |
|
486 |
||
487 |
// Converts TOS cached value to return value in R0/R1 (according to interpreter calling conventions). |
|
488 |
void InterpreterMacroAssembler::convert_tos_to_retval(TosState state) { |
|
489 |
#if (!defined __SOFTFP__ && !defined __ABI_HARD__) |
|
490 |
// According to interpreter calling conventions, result is returned in R0/R1, |
|
491 |
// so ftos (S0) and dtos (D0) are moved to R0/R1. |
|
492 |
if (state == ftos) { |
|
493 |
fmrs(R0, S0_tos); |
|
494 |
} else if (state == dtos) { |
|
495 |
fmrrd(R0, R1, D0_tos); |
|
496 |
} |
|
497 |
#endif // !__SOFTFP__ && !__ABI_HARD__ |
|
498 |
} |
|
499 |
||
500 |
||
501 |
||
502 |
// Helpers for swap and dup |
|
503 |
void InterpreterMacroAssembler::load_ptr(int n, Register val) { |
|
504 |
ldr(val, Address(Rstack_top, Interpreter::expr_offset_in_bytes(n))); |
|
505 |
} |
|
506 |
||
507 |
void InterpreterMacroAssembler::store_ptr(int n, Register val) { |
|
508 |
str(val, Address(Rstack_top, Interpreter::expr_offset_in_bytes(n))); |
|
509 |
} |
|
510 |
||
511 |
||
512 |
void InterpreterMacroAssembler::prepare_to_jump_from_interpreted() { |
|
513 |
||
514 |
// set sender sp |
|
515 |
mov(Rsender_sp, SP); |
|
516 |
||
517 |
// record last_sp |
|
518 |
str(Rsender_sp, Address(FP, frame::interpreter_frame_last_sp_offset * wordSize)); |
|
519 |
} |
|
520 |
||
521 |
// Jump to from_interpreted entry of a call unless single stepping is possible |
|
522 |
// in this thread in which case we must call the i2i entry |
|
523 |
void InterpreterMacroAssembler::jump_from_interpreted(Register method) { |
|
524 |
assert_different_registers(method, Rtemp); |
|
525 |
||
526 |
prepare_to_jump_from_interpreted(); |
|
527 |
||
528 |
if (can_post_interpreter_events()) { |
|
529 |
// JVMTI events, such as single-stepping, are implemented partly by avoiding running |
|
530 |
// compiled code in threads for which the event is enabled. Check here for |
|
531 |
// interp_only_mode if these events CAN be enabled. |
|
532 |
||
533 |
ldr_s32(Rtemp, Address(Rthread, JavaThread::interp_only_mode_offset())); |
|
534 |
cmp(Rtemp, 0); |
|
535 |
ldr(PC, Address(method, Method::interpreter_entry_offset()), ne); |
|
536 |
} |
|
537 |
||
538 |
indirect_jump(Address(method, Method::from_interpreted_offset()), Rtemp); |
|
539 |
} |
|
540 |
||
541 |
||
542 |
void InterpreterMacroAssembler::restore_dispatch() { |
|
543 |
mov_slow(RdispatchTable, (address)Interpreter::dispatch_table(vtos)); |
|
544 |
} |
|
545 |
||
546 |
||
547 |
// The following two routines provide a hook so that an implementation |
|
548 |
// can schedule the dispatch in two parts. |
|
549 |
void InterpreterMacroAssembler::dispatch_prolog(TosState state, int step) { |
|
550 |
// Nothing ARM-specific to be done here. |
|
551 |
} |
|
552 |
||
553 |
void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) { |
|
554 |
dispatch_next(state, step); |
|
555 |
} |
|
556 |
||
557 |
void InterpreterMacroAssembler::dispatch_base(TosState state, |
|
558 |
DispatchTableMode table_mode, |
|
559 |
bool verifyoop) { |
|
560 |
if (VerifyActivationFrameSize) { |
|
561 |
Label L; |
|
562 |
sub(Rtemp, FP, SP); |
|
563 |
int min_frame_size = (frame::link_offset - frame::interpreter_frame_initial_sp_offset) * wordSize; |
|
564 |
cmp(Rtemp, min_frame_size); |
|
565 |
b(L, ge); |
|
566 |
stop("broken stack frame"); |
|
567 |
bind(L); |
|
568 |
} |
|
569 |
||
570 |
if (verifyoop) { |
|
571 |
interp_verify_oop(R0_tos, state, __FILE__, __LINE__); |
|
572 |
} |
|
573 |
||
574 |
if((state == itos) || (state == btos) || (state == ztos) || (state == ctos) || (state == stos)) { |
|
575 |
zap_high_non_significant_bits(R0_tos); |
|
576 |
} |
|
577 |
||
578 |
#ifdef ASSERT |
|
579 |
Label L; |
|
580 |
mov_slow(Rtemp, (address)Interpreter::dispatch_table(vtos)); |
|
581 |
cmp(Rtemp, RdispatchTable); |
|
582 |
b(L, eq); |
|
583 |
stop("invalid RdispatchTable"); |
|
584 |
bind(L); |
|
585 |
#endif |
|
586 |
||
587 |
if (table_mode == DispatchDefault) { |
|
588 |
if (state == vtos) { |
|
589 |
indirect_jump(Address::indexed_ptr(RdispatchTable, R3_bytecode), Rtemp); |
|
590 |
} else { |
|
591 |
// on 32-bit ARM this method is faster than the one above. |
|
592 |
sub(Rtemp, RdispatchTable, (Interpreter::distance_from_dispatch_table(vtos) - |
|
593 |
Interpreter::distance_from_dispatch_table(state)) * wordSize); |
|
594 |
indirect_jump(Address::indexed_ptr(Rtemp, R3_bytecode), Rtemp); |
|
595 |
} |
|
596 |
} else { |
|
597 |
assert(table_mode == DispatchNormal, "invalid dispatch table mode"); |
|
598 |
address table = (address) Interpreter::normal_table(state); |
|
599 |
mov_slow(Rtemp, table); |
|
600 |
indirect_jump(Address::indexed_ptr(Rtemp, R3_bytecode), Rtemp); |
|
601 |
} |
|
602 |
||
603 |
nop(); // to avoid filling CPU pipeline with invalid instructions |
|
604 |
nop(); |
|
605 |
} |
|
606 |
||
607 |
void InterpreterMacroAssembler::dispatch_only(TosState state) { |
|
608 |
dispatch_base(state, DispatchDefault); |
|
609 |
} |
|
610 |
||
611 |
||
612 |
void InterpreterMacroAssembler::dispatch_only_normal(TosState state) { |
|
613 |
dispatch_base(state, DispatchNormal); |
|
614 |
} |
|
615 |
||
616 |
void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) { |
|
617 |
dispatch_base(state, DispatchNormal, false); |
|
618 |
} |
|
619 |
||
620 |
void InterpreterMacroAssembler::dispatch_next(TosState state, int step) { |
|
621 |
// load next bytecode and advance Rbcp |
|
622 |
ldrb(R3_bytecode, Address(Rbcp, step, pre_indexed)); |
|
623 |
dispatch_base(state, DispatchDefault); |
|
624 |
} |
|
625 |
||
626 |
void InterpreterMacroAssembler::narrow(Register result) { |
|
627 |
// mask integer result to narrower return type. |
|
628 |
const Register Rtmp = R2; |
|
629 |
||
630 |
// get method type |
|
631 |
ldr(Rtmp, Address(Rmethod, Method::const_offset())); |
|
632 |
ldrb(Rtmp, Address(Rtmp, ConstMethod::result_type_offset())); |
|
633 |
||
634 |
Label notBool, notByte, notChar, done; |
|
635 |
cmp(Rtmp, T_INT); |
|
636 |
b(done, eq); |
|
637 |
||
638 |
cmp(Rtmp, T_BOOLEAN); |
|
639 |
b(notBool, ne); |
|
640 |
and_32(result, result, 1); |
|
641 |
b(done); |
|
642 |
||
643 |
bind(notBool); |
|
644 |
cmp(Rtmp, T_BYTE); |
|
645 |
b(notByte, ne); |
|
646 |
sign_extend(result, result, 8); |
|
647 |
b(done); |
|
648 |
||
649 |
bind(notByte); |
|
650 |
cmp(Rtmp, T_CHAR); |
|
651 |
b(notChar, ne); |
|
652 |
zero_extend(result, result, 16); |
|
653 |
b(done); |
|
654 |
||
655 |
bind(notChar); |
|
656 |
// cmp(Rtmp, T_SHORT); |
|
657 |
// b(done, ne); |
|
658 |
sign_extend(result, result, 16); |
|
659 |
||
660 |
// Nothing to do |
|
661 |
bind(done); |
|
662 |
} |
|
663 |
||
664 |
// remove activation |
|
665 |
// |
|
666 |
// Unlock the receiver if this is a synchronized method. |
|
667 |
// Unlock any Java monitors from syncronized blocks. |
|
668 |
// Remove the activation from the stack. |
|
669 |
// |
|
670 |
// If there are locked Java monitors |
|
671 |
// If throw_monitor_exception |
|
672 |
// throws IllegalMonitorStateException |
|
673 |
// Else if install_monitor_exception |
|
674 |
// installs IllegalMonitorStateException |
|
675 |
// Else |
|
676 |
// no error processing |
|
677 |
void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_addr, |
|
678 |
bool throw_monitor_exception, |
|
679 |
bool install_monitor_exception, |
|
680 |
bool notify_jvmdi) { |
|
681 |
Label unlock, unlocked, no_unlock; |
|
682 |
||
683 |
// Note: Registers R0, R1, S0 and D0 (TOS cached value) may be in use for the result. |
|
684 |
||
685 |
const Address do_not_unlock_if_synchronized(Rthread, |
|
686 |
JavaThread::do_not_unlock_if_synchronized_offset()); |
|
687 |
||
688 |
const Register Rflag = R2; |
|
689 |
const Register Raccess_flags = R3; |
|
690 |
||
691 |
restore_method(); |
|
692 |
||
693 |
ldrb(Rflag, do_not_unlock_if_synchronized); |
|
694 |
||
695 |
// get method access flags |
|
696 |
ldr_u32(Raccess_flags, Address(Rmethod, Method::access_flags_offset())); |
|
697 |
||
698 |
strb(zero_register(Rtemp), do_not_unlock_if_synchronized); // reset the flag |
|
699 |
||
700 |
// check if method is synchronized |
|
701 |
||
702 |
tbz(Raccess_flags, JVM_ACC_SYNCHRONIZED_BIT, unlocked); |
|
703 |
||
704 |
// Don't unlock anything if the _do_not_unlock_if_synchronized flag is set. |
|
705 |
cbnz(Rflag, no_unlock); |
|
706 |
||
707 |
// unlock monitor |
|
708 |
push(state); // save result |
|
709 |
||
710 |
// BasicObjectLock will be first in list, since this is a synchronized method. However, need |
|
711 |
// to check that the object has not been unlocked by an explicit monitorexit bytecode. |
|
712 |
||
713 |
const Register Rmonitor = R1; // fixed in unlock_object() |
|
714 |
const Register Robj = R2; |
|
715 |
||
716 |
// address of first monitor |
|
717 |
sub(Rmonitor, FP, - frame::interpreter_frame_monitor_block_bottom_offset * wordSize + (int)sizeof(BasicObjectLock)); |
|
718 |
||
719 |
ldr(Robj, Address(Rmonitor, BasicObjectLock::obj_offset_in_bytes())); |
|
720 |
cbnz(Robj, unlock); |
|
721 |
||
722 |
pop(state); |
|
723 |
||
724 |
if (throw_monitor_exception) { |
|
725 |
// Entry already unlocked, need to throw exception |
|
726 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); |
|
727 |
should_not_reach_here(); |
|
728 |
} else { |
|
729 |
// Monitor already unlocked during a stack unroll. |
|
730 |
// If requested, install an illegal_monitor_state_exception. |
|
731 |
// Continue with stack unrolling. |
|
732 |
if (install_monitor_exception) { |
|
733 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); |
|
734 |
} |
|
735 |
b(unlocked); |
|
736 |
} |
|
737 |
||
738 |
||
739 |
// Exception case for the check that all monitors are unlocked. |
|
740 |
const Register Rcur = R2; |
|
741 |
Label restart_check_monitors_unlocked, exception_monitor_is_still_locked; |
|
742 |
||
743 |
bind(exception_monitor_is_still_locked); |
|
744 |
// Monitor entry is still locked, need to throw exception. |
|
745 |
// Rcur: monitor entry. |
|
746 |
||
747 |
if (throw_monitor_exception) { |
|
748 |
// Throw exception |
|
749 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); |
|
750 |
should_not_reach_here(); |
|
751 |
} else { |
|
752 |
// Stack unrolling. Unlock object and install illegal_monitor_exception |
|
753 |
// Unlock does not block, so don't have to worry about the frame |
|
754 |
||
755 |
push(state); |
|
756 |
mov(R1, Rcur); |
|
757 |
unlock_object(R1); |
|
758 |
||
759 |
if (install_monitor_exception) { |
|
760 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); |
|
761 |
} |
|
762 |
||
763 |
pop(state); |
|
764 |
b(restart_check_monitors_unlocked); |
|
765 |
} |
|
766 |
||
767 |
bind(unlock); |
|
768 |
unlock_object(Rmonitor); |
|
769 |
pop(state); |
|
770 |
||
771 |
// Check that for block-structured locking (i.e., that all locked objects has been unlocked) |
|
772 |
bind(unlocked); |
|
773 |
||
774 |
// Check that all monitors are unlocked |
|
775 |
{ |
|
776 |
Label loop; |
|
777 |
||
778 |
const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; |
|
779 |
const Register Rbottom = R3; |
|
780 |
const Register Rcur_obj = Rtemp; |
|
781 |
||
782 |
bind(restart_check_monitors_unlocked); |
|
783 |
||
784 |
ldr(Rcur, Address(FP, frame::interpreter_frame_monitor_block_top_offset * wordSize)); |
|
785 |
// points to current entry, starting with top-most entry |
|
786 |
sub(Rbottom, FP, -frame::interpreter_frame_monitor_block_bottom_offset * wordSize); |
|
787 |
// points to word before bottom of monitor block |
|
788 |
||
789 |
cmp(Rcur, Rbottom); // check if there are no monitors |
|
790 |
ldr(Rcur_obj, Address(Rcur, BasicObjectLock::obj_offset_in_bytes()), ne); |
|
791 |
// prefetch monitor's object |
|
792 |
b(no_unlock, eq); |
|
793 |
||
794 |
bind(loop); |
|
795 |
// check if current entry is used |
|
796 |
cbnz(Rcur_obj, exception_monitor_is_still_locked); |
|
797 |
||
798 |
add(Rcur, Rcur, entry_size); // otherwise advance to next entry |
|
799 |
cmp(Rcur, Rbottom); // check if bottom reached |
|
800 |
ldr(Rcur_obj, Address(Rcur, BasicObjectLock::obj_offset_in_bytes()), ne); |
|
801 |
// prefetch monitor's object |
|
802 |
b(loop, ne); // if not at bottom then check this entry |
|
803 |
} |
|
804 |
||
805 |
bind(no_unlock); |
|
806 |
||
807 |
// jvmti support |
|
808 |
if (notify_jvmdi) { |
|
809 |
notify_method_exit(state, NotifyJVMTI); // preserve TOSCA |
|
810 |
} else { |
|
811 |
notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA |
|
812 |
} |
|
813 |
||
814 |
// remove activation |
|
815 |
mov(Rtemp, FP); |
|
816 |
ldmia(FP, RegisterSet(FP) | RegisterSet(LR)); |
|
817 |
ldr(SP, Address(Rtemp, frame::interpreter_frame_sender_sp_offset * wordSize)); |
|
818 |
||
819 |
if (ret_addr != LR) { |
|
820 |
mov(ret_addr, LR); |
|
821 |
} |
|
822 |
} |
|
823 |
||
824 |
||
825 |
// At certain points in the method invocation the monitor of |
|
826 |
// synchronized methods hasn't been entered yet. |
|
827 |
// To correctly handle exceptions at these points, we set the thread local |
|
828 |
// variable _do_not_unlock_if_synchronized to true. The remove_activation will |
|
829 |
// check this flag. |
|
830 |
void InterpreterMacroAssembler::set_do_not_unlock_if_synchronized(bool flag, Register tmp) { |
|
831 |
const Address do_not_unlock_if_synchronized(Rthread, |
|
832 |
JavaThread::do_not_unlock_if_synchronized_offset()); |
|
833 |
if (flag) { |
|
834 |
mov(tmp, 1); |
|
835 |
strb(tmp, do_not_unlock_if_synchronized); |
|
836 |
} else { |
|
837 |
strb(zero_register(tmp), do_not_unlock_if_synchronized); |
|
838 |
} |
|
839 |
} |
|
840 |
||
841 |
// Lock object |
|
842 |
// |
|
843 |
// Argument: R1 : Points to BasicObjectLock to be used for locking. |
|
844 |
// Must be initialized with object to lock. |
|
52351 | 845 |
// Blows volatile registers R0-R3, Rtemp, LR. Calls VM. |
42664 | 846 |
void InterpreterMacroAssembler::lock_object(Register Rlock) { |
847 |
assert(Rlock == R1, "the second argument"); |
|
848 |
||
849 |
if (UseHeavyMonitors) { |
|
850 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), Rlock); |
|
851 |
} else { |
|
852 |
Label done; |
|
853 |
||
854 |
const Register Robj = R2; |
|
855 |
const Register Rmark = R3; |
|
856 |
assert_different_registers(Robj, Rmark, Rlock, R0, Rtemp); |
|
857 |
||
858 |
const int obj_offset = BasicObjectLock::obj_offset_in_bytes(); |
|
859 |
const int lock_offset = BasicObjectLock::lock_offset_in_bytes (); |
|
860 |
const int mark_offset = lock_offset + BasicLock::displaced_header_offset_in_bytes(); |
|
861 |
||
862 |
Label already_locked, slow_case; |
|
863 |
||
864 |
// Load object pointer |
|
865 |
ldr(Robj, Address(Rlock, obj_offset)); |
|
866 |
||
867 |
if (UseBiasedLocking) { |
|
868 |
biased_locking_enter(Robj, Rmark/*scratched*/, R0, false, Rtemp, done, slow_case); |
|
869 |
} |
|
870 |
||
871 |
||
872 |
// On MP platforms the next load could return a 'stale' value if the memory location has been modified by another thread. |
|
873 |
// That would be acceptable as ether CAS or slow case path is taken in that case. |
|
874 |
// Exception to that is if the object is locked by the calling thread, then the recursive test will pass (guaranteed as |
|
875 |
// loads are satisfied from a store queue if performed on the same processor). |
|
876 |
||
877 |
assert(oopDesc::mark_offset_in_bytes() == 0, "must be"); |
|
878 |
ldr(Rmark, Address(Robj, oopDesc::mark_offset_in_bytes())); |
|
879 |
||
880 |
// Test if object is already locked |
|
57777
90ead0febf56
8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents:
52351
diff
changeset
|
881 |
tst(Rmark, markWord::unlocked_value); |
42664 | 882 |
b(already_locked, eq); |
883 |
||
884 |
// Save old object->mark() into BasicLock's displaced header |
|
885 |
str(Rmark, Address(Rlock, mark_offset)); |
|
886 |
||
887 |
cas_for_lock_acquire(Rmark, Rlock, Robj, Rtemp, slow_case); |
|
888 |
||
889 |
#ifndef PRODUCT |
|
890 |
if (PrintBiasedLockingStatistics) { |
|
891 |
cond_atomic_inc32(al, BiasedLocking::fast_path_entry_count_addr()); |
|
892 |
} |
|
893 |
#endif //!PRODUCT |
|
894 |
||
895 |
b(done); |
|
896 |
||
897 |
// If we got here that means the object is locked by ether calling thread or another thread. |
|
898 |
bind(already_locked); |
|
899 |
// Handling of locked objects: recursive locks and slow case. |
|
900 |
||
901 |
// Fast check for recursive lock. |
|
902 |
// |
|
903 |
// Can apply the optimization only if this is a stack lock |
|
904 |
// allocated in this thread. For efficiency, we can focus on |
|
905 |
// recently allocated stack locks (instead of reading the stack |
|
906 |
// base and checking whether 'mark' points inside the current |
|
907 |
// thread stack): |
|
908 |
// 1) (mark & 3) == 0 |
|
909 |
// 2) SP <= mark < SP + os::pagesize() |
|
910 |
// |
|
911 |
// Warning: SP + os::pagesize can overflow the stack base. We must |
|
912 |
// neither apply the optimization for an inflated lock allocated |
|
913 |
// just above the thread stack (this is why condition 1 matters) |
|
914 |
// nor apply the optimization if the stack lock is inside the stack |
|
915 |
// of another thread. The latter is avoided even in case of overflow |
|
916 |
// because we have guard pages at the end of all stacks. Hence, if |
|
917 |
// we go over the stack base and hit the stack of another thread, |
|
918 |
// this should not be in a writeable area that could contain a |
|
919 |
// stack lock allocated by that thread. As a consequence, a stack |
|
920 |
// lock less than page size away from SP is guaranteed to be |
|
921 |
// owned by the current thread. |
|
922 |
// |
|
923 |
// Note: assuming SP is aligned, we can check the low bits of |
|
924 |
// (mark-SP) instead of the low bits of mark. In that case, |
|
925 |
// assuming page size is a power of 2, we can merge the two |
|
926 |
// conditions into a single test: |
|
927 |
// => ((mark - SP) & (3 - os::pagesize())) == 0 |
|
928 |
||
929 |
// (3 - os::pagesize()) cannot be encoded as an ARM immediate operand. |
|
930 |
// Check independently the low bits and the distance to SP. |
|
931 |
// -1- test low 2 bits |
|
932 |
movs(R0, AsmOperand(Rmark, lsl, 30)); |
|
933 |
// -2- test (mark - SP) if the low two bits are 0 |
|
934 |
sub(R0, Rmark, SP, eq); |
|
935 |
movs(R0, AsmOperand(R0, lsr, exact_log2(os::vm_page_size())), eq); |
|
936 |
// If still 'eq' then recursive locking OK: store 0 into lock record |
|
937 |
str(R0, Address(Rlock, mark_offset), eq); |
|
938 |
||
939 |
||
940 |
#ifndef PRODUCT |
|
941 |
if (PrintBiasedLockingStatistics) { |
|
942 |
cond_atomic_inc32(eq, BiasedLocking::fast_path_entry_count_addr()); |
|
943 |
} |
|
944 |
#endif // !PRODUCT |
|
945 |
||
946 |
b(done, eq); |
|
947 |
||
948 |
bind(slow_case); |
|
949 |
||
950 |
// Call the runtime routine for slow case |
|
951 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), Rlock); |
|
952 |
||
953 |
bind(done); |
|
954 |
} |
|
955 |
} |
|
956 |
||
957 |
||
958 |
// Unlocks an object. Used in monitorexit bytecode and remove_activation. |
|
959 |
// |
|
960 |
// Argument: R1: Points to BasicObjectLock structure for lock |
|
961 |
// Throw an IllegalMonitorException if object is not locked by current thread |
|
52351 | 962 |
// Blows volatile registers R0-R3, Rtemp, LR. Calls VM. |
42664 | 963 |
void InterpreterMacroAssembler::unlock_object(Register Rlock) { |
964 |
assert(Rlock == R1, "the second argument"); |
|
965 |
||
966 |
if (UseHeavyMonitors) { |
|
967 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), Rlock); |
|
968 |
} else { |
|
969 |
Label done, slow_case; |
|
970 |
||
971 |
const Register Robj = R2; |
|
972 |
const Register Rmark = R3; |
|
973 |
const Register Rresult = R0; |
|
974 |
assert_different_registers(Robj, Rmark, Rlock, R0, Rtemp); |
|
975 |
||
976 |
const int obj_offset = BasicObjectLock::obj_offset_in_bytes(); |
|
977 |
const int lock_offset = BasicObjectLock::lock_offset_in_bytes (); |
|
978 |
const int mark_offset = lock_offset + BasicLock::displaced_header_offset_in_bytes(); |
|
979 |
||
980 |
const Register Rzero = zero_register(Rtemp); |
|
981 |
||
982 |
// Load oop into Robj |
|
983 |
ldr(Robj, Address(Rlock, obj_offset)); |
|
984 |
||
985 |
// Free entry |
|
986 |
str(Rzero, Address(Rlock, obj_offset)); |
|
987 |
||
988 |
if (UseBiasedLocking) { |
|
989 |
biased_locking_exit(Robj, Rmark, done); |
|
990 |
} |
|
991 |
||
992 |
// Load the old header from BasicLock structure |
|
993 |
ldr(Rmark, Address(Rlock, mark_offset)); |
|
994 |
||
995 |
// Test for recursion (zero mark in BasicLock) |
|
996 |
cbz(Rmark, done); |
|
997 |
||
998 |
bool allow_fallthrough_on_failure = true; |
|
999 |
||
1000 |
cas_for_lock_release(Rlock, Rmark, Robj, Rtemp, slow_case, allow_fallthrough_on_failure); |
|
1001 |
||
1002 |
b(done, eq); |
|
1003 |
||
1004 |
bind(slow_case); |
|
1005 |
||
1006 |
// Call the runtime routine for slow case. |
|
1007 |
str(Robj, Address(Rlock, obj_offset)); // restore obj |
|
1008 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), Rlock); |
|
1009 |
||
1010 |
bind(done); |
|
1011 |
} |
|
1012 |
} |
|
1013 |
||
1014 |
||
1015 |
// Test ImethodDataPtr. If it is null, continue at the specified label |
|
1016 |
void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) { |
|
1017 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1018 |
ldr(mdp, Address(FP, frame::interpreter_frame_mdp_offset * wordSize)); |
|
1019 |
cbz(mdp, zero_continue); |
|
1020 |
} |
|
1021 |
||
1022 |
||
1023 |
// Set the method data pointer for the current bcp. |
|
52351 | 1024 |
// Blows volatile registers R0-R3, Rtemp, LR. |
42664 | 1025 |
void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { |
1026 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1027 |
Label set_mdp; |
|
1028 |
||
1029 |
// Test MDO to avoid the call if it is NULL. |
|
1030 |
ldr(Rtemp, Address(Rmethod, Method::method_data_offset())); |
|
1031 |
cbz(Rtemp, set_mdp); |
|
1032 |
||
1033 |
mov(R0, Rmethod); |
|
1034 |
mov(R1, Rbcp); |
|
1035 |
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), R0, R1); |
|
1036 |
// R0/W0: mdi |
|
1037 |
||
1038 |
// mdo is guaranteed to be non-zero here, we checked for it before the call. |
|
1039 |
ldr(Rtemp, Address(Rmethod, Method::method_data_offset())); |
|
1040 |
add(Rtemp, Rtemp, in_bytes(MethodData::data_offset())); |
|
1041 |
add_ptr_scaled_int32(Rtemp, Rtemp, R0, 0); |
|
1042 |
||
1043 |
bind(set_mdp); |
|
1044 |
str(Rtemp, Address(FP, frame::interpreter_frame_mdp_offset * wordSize)); |
|
1045 |
} |
|
1046 |
||
1047 |
||
1048 |
void InterpreterMacroAssembler::verify_method_data_pointer() { |
|
1049 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1050 |
#ifdef ASSERT |
|
1051 |
Label verify_continue; |
|
1052 |
save_caller_save_registers(); |
|
1053 |
||
1054 |
const Register Rmdp = R2; |
|
1055 |
test_method_data_pointer(Rmdp, verify_continue); // If mdp is zero, continue |
|
1056 |
||
1057 |
// If the mdp is valid, it will point to a DataLayout header which is |
|
1058 |
// consistent with the bcp. The converse is highly probable also. |
|
1059 |
||
1060 |
ldrh(R3, Address(Rmdp, DataLayout::bci_offset())); |
|
1061 |
ldr(Rtemp, Address(Rmethod, Method::const_offset())); |
|
1062 |
add(R3, R3, Rtemp); |
|
1063 |
add(R3, R3, in_bytes(ConstMethod::codes_offset())); |
|
1064 |
cmp(R3, Rbcp); |
|
1065 |
b(verify_continue, eq); |
|
1066 |
||
1067 |
mov(R0, Rmethod); |
|
1068 |
mov(R1, Rbcp); |
|
1069 |
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp), R0, R1, Rmdp); |
|
1070 |
||
1071 |
bind(verify_continue); |
|
1072 |
restore_caller_save_registers(); |
|
1073 |
#endif // ASSERT |
|
1074 |
} |
|
1075 |
||
1076 |
||
1077 |
void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in, int offset, Register value) { |
|
1078 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1079 |
assert_different_registers(mdp_in, value); |
|
1080 |
str(value, Address(mdp_in, offset)); |
|
1081 |
} |
|
1082 |
||
1083 |
||
1084 |
// Increments mdp data. Sets bumped_count register to adjusted counter. |
|
1085 |
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, |
|
1086 |
int offset, |
|
1087 |
Register bumped_count, |
|
1088 |
bool decrement) { |
|
1089 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1090 |
||
1091 |
// Counter address |
|
1092 |
Address data(mdp_in, offset); |
|
1093 |
assert_different_registers(mdp_in, bumped_count); |
|
1094 |
||
1095 |
increment_mdp_data_at(data, bumped_count, decrement); |
|
1096 |
} |
|
1097 |
||
1098 |
void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in, int flag_byte_constant) { |
|
1099 |
assert_different_registers(mdp_in, Rtemp); |
|
1100 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1101 |
assert((0 < flag_byte_constant) && (flag_byte_constant < (1 << BitsPerByte)), "flag mask is out of range"); |
|
1102 |
||
1103 |
// Set the flag |
|
1104 |
ldrb(Rtemp, Address(mdp_in, in_bytes(DataLayout::flags_offset()))); |
|
1105 |
orr(Rtemp, Rtemp, (unsigned)flag_byte_constant); |
|
1106 |
strb(Rtemp, Address(mdp_in, in_bytes(DataLayout::flags_offset()))); |
|
1107 |
} |
|
1108 |
||
1109 |
||
1110 |
// Increments mdp data. Sets bumped_count register to adjusted counter. |
|
1111 |
void InterpreterMacroAssembler::increment_mdp_data_at(Address data, |
|
1112 |
Register bumped_count, |
|
1113 |
bool decrement) { |
|
1114 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1115 |
||
1116 |
ldr(bumped_count, data); |
|
1117 |
if (decrement) { |
|
1118 |
// Decrement the register. Set condition codes. |
|
1119 |
subs(bumped_count, bumped_count, DataLayout::counter_increment); |
|
1120 |
// Avoid overflow. |
|
1121 |
add(bumped_count, bumped_count, DataLayout::counter_increment, pl); |
|
1122 |
} else { |
|
1123 |
// Increment the register. Set condition codes. |
|
1124 |
adds(bumped_count, bumped_count, DataLayout::counter_increment); |
|
1125 |
// Avoid overflow. |
|
1126 |
sub(bumped_count, bumped_count, DataLayout::counter_increment, mi); |
|
1127 |
} |
|
1128 |
str(bumped_count, data); |
|
1129 |
} |
|
1130 |
||
1131 |
||
1132 |
void InterpreterMacroAssembler::test_mdp_data_at(Register mdp_in, |
|
1133 |
int offset, |
|
1134 |
Register value, |
|
1135 |
Register test_value_out, |
|
1136 |
Label& not_equal_continue) { |
|
1137 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1138 |
assert_different_registers(mdp_in, test_value_out, value); |
|
1139 |
||
1140 |
ldr(test_value_out, Address(mdp_in, offset)); |
|
1141 |
cmp(test_value_out, value); |
|
1142 |
||
1143 |
b(not_equal_continue, ne); |
|
1144 |
} |
|
1145 |
||
1146 |
||
1147 |
void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, int offset_of_disp, Register reg_temp) { |
|
1148 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1149 |
assert_different_registers(mdp_in, reg_temp); |
|
1150 |
||
1151 |
ldr(reg_temp, Address(mdp_in, offset_of_disp)); |
|
1152 |
add(mdp_in, mdp_in, reg_temp); |
|
1153 |
str(mdp_in, Address(FP, frame::interpreter_frame_mdp_offset * wordSize)); |
|
1154 |
} |
|
1155 |
||
1156 |
||
1157 |
void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, Register reg_offset, Register reg_tmp) { |
|
1158 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1159 |
assert_different_registers(mdp_in, reg_offset, reg_tmp); |
|
1160 |
||
1161 |
ldr(reg_tmp, Address(mdp_in, reg_offset)); |
|
1162 |
add(mdp_in, mdp_in, reg_tmp); |
|
1163 |
str(mdp_in, Address(FP, frame::interpreter_frame_mdp_offset * wordSize)); |
|
1164 |
} |
|
1165 |
||
1166 |
||
1167 |
void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) { |
|
1168 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1169 |
add(mdp_in, mdp_in, constant); |
|
1170 |
str(mdp_in, Address(FP, frame::interpreter_frame_mdp_offset * wordSize)); |
|
1171 |
} |
|
1172 |
||
1173 |
||
52351 | 1174 |
// Blows volatile registers R0-R3, Rtemp, LR). |
42664 | 1175 |
void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) { |
1176 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1177 |
assert_different_registers(return_bci, R0, R1, R2, R3, Rtemp); |
|
1178 |
||
1179 |
mov(R1, return_bci); |
|
1180 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), R1); |
|
1181 |
} |
|
1182 |
||
1183 |
||
1184 |
// Sets mdp, bumped_count registers, blows Rtemp. |
|
1185 |
void InterpreterMacroAssembler::profile_taken_branch(Register mdp, Register bumped_count) { |
|
1186 |
assert_different_registers(mdp, bumped_count); |
|
1187 |
||
1188 |
if (ProfileInterpreter) { |
|
1189 |
Label profile_continue; |
|
1190 |
||
1191 |
// If no method data exists, go to profile_continue. |
|
1192 |
// Otherwise, assign to mdp |
|
1193 |
test_method_data_pointer(mdp, profile_continue); |
|
1194 |
||
1195 |
// We are taking a branch. Increment the taken count. |
|
1196 |
increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()), bumped_count); |
|
1197 |
||
1198 |
// The method data pointer needs to be updated to reflect the new target. |
|
1199 |
update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset()), Rtemp); |
|
1200 |
||
1201 |
bind (profile_continue); |
|
1202 |
} |
|
1203 |
} |
|
1204 |
||
1205 |
||
1206 |
// Sets mdp, blows Rtemp. |
|
1207 |
void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) { |
|
1208 |
assert_different_registers(mdp, Rtemp); |
|
1209 |
||
1210 |
if (ProfileInterpreter) { |
|
1211 |
Label profile_continue; |
|
1212 |
||
1213 |
// If no method data exists, go to profile_continue. |
|
1214 |
test_method_data_pointer(mdp, profile_continue); |
|
1215 |
||
1216 |
// We are taking a branch. Increment the not taken count. |
|
1217 |
increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()), Rtemp); |
|
1218 |
||
1219 |
// The method data pointer needs to be updated to correspond to the next bytecode |
|
1220 |
update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); |
|
1221 |
||
1222 |
bind (profile_continue); |
|
1223 |
} |
|
1224 |
} |
|
1225 |
||
1226 |
||
1227 |
// Sets mdp, blows Rtemp. |
|
1228 |
void InterpreterMacroAssembler::profile_call(Register mdp) { |
|
1229 |
assert_different_registers(mdp, Rtemp); |
|
1230 |
||
1231 |
if (ProfileInterpreter) { |
|
1232 |
Label profile_continue; |
|
1233 |
||
1234 |
// If no method data exists, go to profile_continue. |
|
1235 |
test_method_data_pointer(mdp, profile_continue); |
|
1236 |
||
1237 |
// We are making a call. Increment the count. |
|
1238 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), Rtemp); |
|
1239 |
||
1240 |
// The method data pointer needs to be updated to reflect the new target. |
|
1241 |
update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size())); |
|
1242 |
||
1243 |
bind (profile_continue); |
|
1244 |
} |
|
1245 |
} |
|
1246 |
||
1247 |
||
1248 |
// Sets mdp, blows Rtemp. |
|
1249 |
void InterpreterMacroAssembler::profile_final_call(Register mdp) { |
|
1250 |
if (ProfileInterpreter) { |
|
1251 |
Label profile_continue; |
|
1252 |
||
1253 |
// If no method data exists, go to profile_continue. |
|
1254 |
test_method_data_pointer(mdp, profile_continue); |
|
1255 |
||
1256 |
// We are making a call. Increment the count. |
|
1257 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), Rtemp); |
|
1258 |
||
1259 |
// The method data pointer needs to be updated to reflect the new target. |
|
1260 |
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size())); |
|
1261 |
||
1262 |
bind (profile_continue); |
|
1263 |
} |
|
1264 |
} |
|
1265 |
||
1266 |
||
1267 |
// Sets mdp, blows Rtemp. |
|
1268 |
void InterpreterMacroAssembler::profile_virtual_call(Register mdp, Register receiver, bool receiver_can_be_null) { |
|
1269 |
assert_different_registers(mdp, receiver, Rtemp); |
|
1270 |
||
1271 |
if (ProfileInterpreter) { |
|
1272 |
Label profile_continue; |
|
1273 |
||
1274 |
// If no method data exists, go to profile_continue. |
|
1275 |
test_method_data_pointer(mdp, profile_continue); |
|
1276 |
||
1277 |
Label skip_receiver_profile; |
|
1278 |
if (receiver_can_be_null) { |
|
1279 |
Label not_null; |
|
1280 |
cbnz(receiver, not_null); |
|
1281 |
// We are making a call. Increment the count for null receiver. |
|
1282 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), Rtemp); |
|
1283 |
b(skip_receiver_profile); |
|
1284 |
bind(not_null); |
|
1285 |
} |
|
1286 |
||
1287 |
// Record the receiver type. |
|
1288 |
record_klass_in_profile(receiver, mdp, Rtemp, true); |
|
1289 |
bind(skip_receiver_profile); |
|
1290 |
||
1291 |
// The method data pointer needs to be updated to reflect the new target. |
|
1292 |
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size())); |
|
1293 |
bind(profile_continue); |
|
1294 |
} |
|
1295 |
} |
|
1296 |
||
1297 |
||
1298 |
void InterpreterMacroAssembler::record_klass_in_profile_helper( |
|
1299 |
Register receiver, Register mdp, |
|
1300 |
Register reg_tmp, |
|
1301 |
int start_row, Label& done, bool is_virtual_call) { |
|
1302 |
if (TypeProfileWidth == 0) |
|
1303 |
return; |
|
1304 |
||
1305 |
assert_different_registers(receiver, mdp, reg_tmp); |
|
1306 |
||
1307 |
int last_row = VirtualCallData::row_limit() - 1; |
|
1308 |
assert(start_row <= last_row, "must be work left to do"); |
|
1309 |
// Test this row for both the receiver and for null. |
|
1310 |
// Take any of three different outcomes: |
|
1311 |
// 1. found receiver => increment count and goto done |
|
1312 |
// 2. found null => keep looking for case 1, maybe allocate this cell |
|
1313 |
// 3. found something else => keep looking for cases 1 and 2 |
|
1314 |
// Case 3 is handled by a recursive call. |
|
1315 |
for (int row = start_row; row <= last_row; row++) { |
|
1316 |
Label next_test; |
|
1317 |
||
1318 |
// See if the receiver is receiver[n]. |
|
1319 |
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row)); |
|
1320 |
||
1321 |
test_mdp_data_at(mdp, recvr_offset, receiver, reg_tmp, next_test); |
|
1322 |
||
1323 |
// The receiver is receiver[n]. Increment count[n]. |
|
1324 |
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row)); |
|
1325 |
increment_mdp_data_at(mdp, count_offset, reg_tmp); |
|
1326 |
b(done); |
|
1327 |
||
1328 |
bind(next_test); |
|
1329 |
// reg_tmp now contains the receiver from the CallData. |
|
1330 |
||
1331 |
if (row == start_row) { |
|
1332 |
Label found_null; |
|
1333 |
// Failed the equality check on receiver[n]... Test for null. |
|
1334 |
if (start_row == last_row) { |
|
1335 |
// The only thing left to do is handle the null case. |
|
1336 |
if (is_virtual_call) { |
|
1337 |
cbz(reg_tmp, found_null); |
|
1338 |
// Receiver did not match any saved receiver and there is no empty row for it. |
|
1339 |
// Increment total counter to indicate polymorphic case. |
|
1340 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), reg_tmp); |
|
1341 |
b(done); |
|
1342 |
bind(found_null); |
|
1343 |
} else { |
|
1344 |
cbnz(reg_tmp, done); |
|
1345 |
} |
|
1346 |
break; |
|
1347 |
} |
|
1348 |
// Since null is rare, make it be the branch-taken case. |
|
1349 |
cbz(reg_tmp, found_null); |
|
1350 |
||
1351 |
// Put all the "Case 3" tests here. |
|
1352 |
record_klass_in_profile_helper(receiver, mdp, reg_tmp, start_row + 1, done, is_virtual_call); |
|
1353 |
||
1354 |
// Found a null. Keep searching for a matching receiver, |
|
1355 |
// but remember that this is an empty (unused) slot. |
|
1356 |
bind(found_null); |
|
1357 |
} |
|
1358 |
} |
|
1359 |
||
1360 |
// In the fall-through case, we found no matching receiver, but we |
|
1361 |
// observed the receiver[start_row] is NULL. |
|
1362 |
||
1363 |
// Fill in the receiver field and increment the count. |
|
1364 |
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row)); |
|
1365 |
set_mdp_data_at(mdp, recvr_offset, receiver); |
|
1366 |
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); |
|
1367 |
mov(reg_tmp, DataLayout::counter_increment); |
|
1368 |
set_mdp_data_at(mdp, count_offset, reg_tmp); |
|
1369 |
if (start_row > 0) { |
|
1370 |
b(done); |
|
1371 |
} |
|
1372 |
} |
|
1373 |
||
1374 |
void InterpreterMacroAssembler::record_klass_in_profile(Register receiver, |
|
1375 |
Register mdp, |
|
1376 |
Register reg_tmp, |
|
1377 |
bool is_virtual_call) { |
|
1378 |
assert(ProfileInterpreter, "must be profiling"); |
|
1379 |
assert_different_registers(receiver, mdp, reg_tmp); |
|
1380 |
||
1381 |
Label done; |
|
1382 |
||
1383 |
record_klass_in_profile_helper(receiver, mdp, reg_tmp, 0, done, is_virtual_call); |
|
1384 |
||
1385 |
bind (done); |
|
1386 |
} |
|
1387 |
||
52351 | 1388 |
// Sets mdp, blows volatile registers R0-R3, Rtemp, LR). |
42664 | 1389 |
void InterpreterMacroAssembler::profile_ret(Register mdp, Register return_bci) { |
1390 |
assert_different_registers(mdp, return_bci, Rtemp, R0, R1, R2, R3); |
|
1391 |
||
1392 |
if (ProfileInterpreter) { |
|
1393 |
Label profile_continue; |
|
1394 |
uint row; |
|
1395 |
||
1396 |
// If no method data exists, go to profile_continue. |
|
1397 |
test_method_data_pointer(mdp, profile_continue); |
|
1398 |
||
1399 |
// Update the total ret count. |
|
1400 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()), Rtemp); |
|
1401 |
||
1402 |
for (row = 0; row < RetData::row_limit(); row++) { |
|
1403 |
Label next_test; |
|
1404 |
||
1405 |
// See if return_bci is equal to bci[n]: |
|
1406 |
test_mdp_data_at(mdp, in_bytes(RetData::bci_offset(row)), return_bci, |
|
1407 |
Rtemp, next_test); |
|
1408 |
||
1409 |
// return_bci is equal to bci[n]. Increment the count. |
|
1410 |
increment_mdp_data_at(mdp, in_bytes(RetData::bci_count_offset(row)), Rtemp); |
|
1411 |
||
1412 |
// The method data pointer needs to be updated to reflect the new target. |
|
1413 |
update_mdp_by_offset(mdp, in_bytes(RetData::bci_displacement_offset(row)), Rtemp); |
|
1414 |
b(profile_continue); |
|
1415 |
bind(next_test); |
|
1416 |
} |
|
1417 |
||
1418 |
update_mdp_for_ret(return_bci); |
|
1419 |
||
1420 |
bind(profile_continue); |
|
1421 |
} |
|
1422 |
} |
|
1423 |
||
1424 |
||
1425 |
// Sets mdp. |
|
1426 |
void InterpreterMacroAssembler::profile_null_seen(Register mdp) { |
|
1427 |
if (ProfileInterpreter) { |
|
1428 |
Label profile_continue; |
|
1429 |
||
1430 |
// If no method data exists, go to profile_continue. |
|
1431 |
test_method_data_pointer(mdp, profile_continue); |
|
1432 |
||
1433 |
set_mdp_flag_at(mdp, BitData::null_seen_byte_constant()); |
|
1434 |
||
1435 |
// The method data pointer needs to be updated. |
|
1436 |
int mdp_delta = in_bytes(BitData::bit_data_size()); |
|
1437 |
if (TypeProfileCasts) { |
|
1438 |
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1439 |
} |
|
1440 |
update_mdp_by_constant(mdp, mdp_delta); |
|
1441 |
||
1442 |
bind (profile_continue); |
|
1443 |
} |
|
1444 |
} |
|
1445 |
||
1446 |
||
1447 |
// Sets mdp, blows Rtemp. |
|
1448 |
void InterpreterMacroAssembler::profile_typecheck_failed(Register mdp) { |
|
1449 |
assert_different_registers(mdp, Rtemp); |
|
1450 |
||
1451 |
if (ProfileInterpreter && TypeProfileCasts) { |
|
1452 |
Label profile_continue; |
|
1453 |
||
1454 |
// If no method data exists, go to profile_continue. |
|
1455 |
test_method_data_pointer(mdp, profile_continue); |
|
1456 |
||
1457 |
int count_offset = in_bytes(CounterData::count_offset()); |
|
1458 |
// Back up the address, since we have already bumped the mdp. |
|
1459 |
count_offset -= in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1460 |
||
1461 |
// *Decrement* the counter. We expect to see zero or small negatives. |
|
1462 |
increment_mdp_data_at(mdp, count_offset, Rtemp, true); |
|
1463 |
||
1464 |
bind (profile_continue); |
|
1465 |
} |
|
1466 |
} |
|
1467 |
||
1468 |
||
1469 |
// Sets mdp, blows Rtemp. |
|
1470 |
void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass) |
|
1471 |
{ |
|
1472 |
assert_different_registers(mdp, klass, Rtemp); |
|
1473 |
||
1474 |
if (ProfileInterpreter) { |
|
1475 |
Label profile_continue; |
|
1476 |
||
1477 |
// If no method data exists, go to profile_continue. |
|
1478 |
test_method_data_pointer(mdp, profile_continue); |
|
1479 |
||
1480 |
// The method data pointer needs to be updated. |
|
1481 |
int mdp_delta = in_bytes(BitData::bit_data_size()); |
|
1482 |
if (TypeProfileCasts) { |
|
1483 |
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1484 |
||
1485 |
// Record the object type. |
|
1486 |
record_klass_in_profile(klass, mdp, Rtemp, false); |
|
1487 |
} |
|
1488 |
update_mdp_by_constant(mdp, mdp_delta); |
|
1489 |
||
1490 |
bind(profile_continue); |
|
1491 |
} |
|
1492 |
} |
|
1493 |
||
1494 |
||
1495 |
// Sets mdp, blows Rtemp. |
|
1496 |
void InterpreterMacroAssembler::profile_switch_default(Register mdp) { |
|
1497 |
assert_different_registers(mdp, Rtemp); |
|
1498 |
||
1499 |
if (ProfileInterpreter) { |
|
1500 |
Label profile_continue; |
|
1501 |
||
1502 |
// If no method data exists, go to profile_continue. |
|
1503 |
test_method_data_pointer(mdp, profile_continue); |
|
1504 |
||
1505 |
// Update the default case count |
|
1506 |
increment_mdp_data_at(mdp, in_bytes(MultiBranchData::default_count_offset()), Rtemp); |
|
1507 |
||
1508 |
// The method data pointer needs to be updated. |
|
1509 |
update_mdp_by_offset(mdp, in_bytes(MultiBranchData::default_displacement_offset()), Rtemp); |
|
1510 |
||
1511 |
bind(profile_continue); |
|
1512 |
} |
|
1513 |
} |
|
1514 |
||
1515 |
||
1516 |
// Sets mdp. Blows reg_tmp1, reg_tmp2. Index could be the same as reg_tmp2. |
|
1517 |
void InterpreterMacroAssembler::profile_switch_case(Register mdp, Register index, Register reg_tmp1, Register reg_tmp2) { |
|
1518 |
assert_different_registers(mdp, reg_tmp1, reg_tmp2); |
|
1519 |
assert_different_registers(mdp, reg_tmp1, index); |
|
1520 |
||
1521 |
if (ProfileInterpreter) { |
|
1522 |
Label profile_continue; |
|
1523 |
||
1524 |
const int count_offset = in_bytes(MultiBranchData::case_array_offset()) + |
|
1525 |
in_bytes(MultiBranchData::relative_count_offset()); |
|
1526 |
||
1527 |
const int displacement_offset = in_bytes(MultiBranchData::case_array_offset()) + |
|
1528 |
in_bytes(MultiBranchData::relative_displacement_offset()); |
|
1529 |
||
1530 |
// If no method data exists, go to profile_continue. |
|
1531 |
test_method_data_pointer(mdp, profile_continue); |
|
1532 |
||
1533 |
// Build the base (index * per_case_size_in_bytes()) |
|
1534 |
logical_shift_left(reg_tmp1, index, exact_log2(in_bytes(MultiBranchData::per_case_size()))); |
|
1535 |
||
1536 |
// Update the case count |
|
1537 |
add(reg_tmp1, reg_tmp1, count_offset); |
|
1538 |
increment_mdp_data_at(Address(mdp, reg_tmp1), reg_tmp2); |
|
1539 |
||
1540 |
// The method data pointer needs to be updated. |
|
1541 |
add(reg_tmp1, reg_tmp1, displacement_offset - count_offset); |
|
1542 |
update_mdp_by_offset(mdp, reg_tmp1, reg_tmp2); |
|
1543 |
||
1544 |
bind (profile_continue); |
|
1545 |
} |
|
1546 |
} |
|
1547 |
||
1548 |
||
1549 |
void InterpreterMacroAssembler::byteswap_u32(Register r, Register rtmp1, Register rtmp2) { |
|
1550 |
if (VM_Version::supports_rev()) { |
|
1551 |
rev(r, r); |
|
1552 |
} else { |
|
1553 |
eor(rtmp1, r, AsmOperand(r, ror, 16)); |
|
1554 |
mvn(rtmp2, 0x0000ff00); |
|
1555 |
andr(rtmp1, rtmp2, AsmOperand(rtmp1, lsr, 8)); |
|
1556 |
eor(r, rtmp1, AsmOperand(r, ror, 8)); |
|
1557 |
} |
|
1558 |
} |
|
1559 |
||
1560 |
||
1561 |
void InterpreterMacroAssembler::inc_global_counter(address address_of_counter, int offset, Register tmp1, Register tmp2, bool avoid_overflow) { |
|
1562 |
const intx addr = (intx) (address_of_counter + offset); |
|
1563 |
||
1564 |
assert ((addr & 0x3) == 0, "address of counter should be aligned"); |
|
52351 | 1565 |
const intx offset_mask = right_n_bits(12); |
42664 | 1566 |
|
1567 |
const address base = (address) (addr & ~offset_mask); |
|
1568 |
const int offs = (int) (addr & offset_mask); |
|
1569 |
||
1570 |
const Register addr_base = tmp1; |
|
1571 |
const Register val = tmp2; |
|
1572 |
||
1573 |
mov_slow(addr_base, base); |
|
1574 |
ldr_s32(val, Address(addr_base, offs)); |
|
1575 |
||
1576 |
if (avoid_overflow) { |
|
1577 |
adds_32(val, val, 1); |
|
1578 |
str(val, Address(addr_base, offs), pl); |
|
1579 |
} else { |
|
1580 |
add_32(val, val, 1); |
|
1581 |
str_32(val, Address(addr_base, offs)); |
|
1582 |
} |
|
1583 |
} |
|
1584 |
||
1585 |
void InterpreterMacroAssembler::interp_verify_oop(Register reg, TosState state, const char *file, int line) { |
|
1586 |
if (state == atos) { MacroAssembler::_verify_oop(reg, "broken oop", file, line); } |
|
1587 |
} |
|
1588 |
||
1589 |
// Inline assembly for: |
|
1590 |
// |
|
1591 |
// if (thread is in interp_only_mode) { |
|
1592 |
// InterpreterRuntime::post_method_entry(); |
|
1593 |
// } |
|
1594 |
// if (DTraceMethodProbes) { |
|
1595 |
// SharedRuntime::dtrace_method_entry(method, receiver); |
|
1596 |
// } |
|
1597 |
// if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { |
|
1598 |
// SharedRuntime::rc_trace_method_entry(method, receiver); |
|
1599 |
// } |
|
1600 |
||
1601 |
void InterpreterMacroAssembler::notify_method_entry() { |
|
1602 |
// Whenever JVMTI is interp_only_mode, method entry/exit events are sent to |
|
1603 |
// track stack depth. If it is possible to enter interp_only_mode we add |
|
1604 |
// the code to check if the event should be sent. |
|
1605 |
if (can_post_interpreter_events()) { |
|
1606 |
Label L; |
|
1607 |
||
1608 |
ldr_s32(Rtemp, Address(Rthread, JavaThread::interp_only_mode_offset())); |
|
1609 |
cbz(Rtemp, L); |
|
1610 |
||
1611 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry)); |
|
1612 |
||
1613 |
bind(L); |
|
1614 |
} |
|
1615 |
||
1616 |
// Note: Disable DTrace runtime check for now to eliminate overhead on each method entry |
|
1617 |
if (DTraceMethodProbes) { |
|
1618 |
Label Lcontinue; |
|
1619 |
||
1620 |
ldrb_global(Rtemp, (address)&DTraceMethodProbes); |
|
1621 |
cbz(Rtemp, Lcontinue); |
|
1622 |
||
1623 |
mov(R0, Rthread); |
|
1624 |
mov(R1, Rmethod); |
|
1625 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), R0, R1); |
|
1626 |
||
1627 |
bind(Lcontinue); |
|
1628 |
} |
|
1629 |
// RedefineClasses() tracing support for obsolete method entry |
|
1630 |
if (log_is_enabled(Trace, redefine, class, obsolete)) { |
|
1631 |
mov(R0, Rthread); |
|
1632 |
mov(R1, Rmethod); |
|
1633 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), |
|
1634 |
R0, R1); |
|
1635 |
} |
|
1636 |
} |
|
1637 |
||
1638 |
||
1639 |
void InterpreterMacroAssembler::notify_method_exit( |
|
1640 |
TosState state, NotifyMethodExitMode mode, |
|
1641 |
bool native, Register result_lo, Register result_hi, FloatRegister result_fp) { |
|
1642 |
// Whenever JVMTI is interp_only_mode, method entry/exit events are sent to |
|
1643 |
// track stack depth. If it is possible to enter interp_only_mode we add |
|
1644 |
// the code to check if the event should be sent. |
|
1645 |
if (mode == NotifyJVMTI && can_post_interpreter_events()) { |
|
1646 |
Label L; |
|
1647 |
// Note: frame::interpreter_frame_result has a dependency on how the |
|
1648 |
// method result is saved across the call to post_method_exit. If this |
|
1649 |
// is changed then the interpreter_frame_result implementation will |
|
1650 |
// need to be updated too. |
|
1651 |
||
1652 |
ldr_s32(Rtemp, Address(Rthread, JavaThread::interp_only_mode_offset())); |
|
1653 |
cbz(Rtemp, L); |
|
1654 |
||
1655 |
if (native) { |
|
1656 |
// For c++ and template interpreter push both result registers on the |
|
1657 |
// stack in native, we don't know the state. |
|
1658 |
// See frame::interpreter_frame_result for code that gets the result values from here. |
|
1659 |
assert(result_lo != noreg, "result registers should be defined"); |
|
1660 |
||
1661 |
assert(result_hi != noreg, "result registers should be defined"); |
|
1662 |
||
1663 |
#ifdef __ABI_HARD__ |
|
1664 |
assert(result_fp != fnoreg, "FP result register must be defined"); |
|
1665 |
sub(SP, SP, 2 * wordSize); |
|
1666 |
fstd(result_fp, Address(SP)); |
|
1667 |
#endif // __ABI_HARD__ |
|
1668 |
||
1669 |
push(RegisterSet(result_lo) | RegisterSet(result_hi)); |
|
1670 |
||
1671 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit)); |
|
1672 |
||
1673 |
pop(RegisterSet(result_lo) | RegisterSet(result_hi)); |
|
1674 |
#ifdef __ABI_HARD__ |
|
1675 |
fldd(result_fp, Address(SP)); |
|
1676 |
add(SP, SP, 2 * wordSize); |
|
1677 |
#endif // __ABI_HARD__ |
|
1678 |
||
1679 |
} else { |
|
1680 |
// For the template interpreter, the value on tos is the size of the |
|
1681 |
// state. (c++ interpreter calls jvmti somewhere else). |
|
1682 |
push(state); |
|
1683 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit)); |
|
1684 |
pop(state); |
|
1685 |
} |
|
1686 |
||
1687 |
bind(L); |
|
1688 |
} |
|
1689 |
||
1690 |
// Note: Disable DTrace runtime check for now to eliminate overhead on each method exit |
|
1691 |
if (DTraceMethodProbes) { |
|
1692 |
Label Lcontinue; |
|
1693 |
||
1694 |
ldrb_global(Rtemp, (address)&DTraceMethodProbes); |
|
1695 |
cbz(Rtemp, Lcontinue); |
|
1696 |
||
1697 |
push(state); |
|
1698 |
||
1699 |
mov(R0, Rthread); |
|
1700 |
mov(R1, Rmethod); |
|
1701 |
||
1702 |
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), R0, R1); |
|
1703 |
||
1704 |
pop(state); |
|
1705 |
||
1706 |
bind(Lcontinue); |
|
1707 |
} |
|
1708 |
} |
|
1709 |
||
1710 |
||
1711 |
#ifndef PRODUCT |
|
1712 |
||
1713 |
void InterpreterMacroAssembler::trace_state(const char* msg) { |
|
1714 |
int push_size = save_caller_save_registers(); |
|
1715 |
||
1716 |
Label Lcontinue; |
|
1717 |
InlinedString Lmsg0("%s: FP=" INTPTR_FORMAT ", SP=" INTPTR_FORMAT "\n"); |
|
1718 |
InlinedString Lmsg(msg); |
|
1719 |
InlinedAddress Lprintf((address)printf); |
|
1720 |
||
1721 |
ldr_literal(R0, Lmsg0); |
|
1722 |
ldr_literal(R1, Lmsg); |
|
1723 |
mov(R2, FP); |
|
1724 |
add(R3, SP, push_size); // original SP (without saved registers) |
|
1725 |
ldr_literal(Rtemp, Lprintf); |
|
1726 |
call(Rtemp); |
|
1727 |
||
1728 |
b(Lcontinue); |
|
1729 |
||
1730 |
bind_literal(Lmsg0); |
|
1731 |
bind_literal(Lmsg); |
|
1732 |
bind_literal(Lprintf); |
|
1733 |
||
1734 |
||
1735 |
bind(Lcontinue); |
|
1736 |
||
1737 |
restore_caller_save_registers(); |
|
1738 |
} |
|
1739 |
||
1740 |
#endif |
|
1741 |
||
1742 |
// Jump if ((*counter_addr += increment) & mask) satisfies the condition. |
|
1743 |
void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, |
|
1744 |
int increment, Address mask_addr, |
|
1745 |
Register scratch, Register scratch2, |
|
1746 |
AsmCondition cond, Label* where) { |
|
1747 |
// caution: scratch2 and base address of counter_addr can be the same |
|
1748 |
assert_different_registers(scratch, scratch2); |
|
1749 |
ldr_u32(scratch, counter_addr); |
|
1750 |
add(scratch, scratch, increment); |
|
1751 |
str_32(scratch, counter_addr); |
|
1752 |
||
1753 |
ldr(scratch2, mask_addr); |
|
1754 |
andrs(scratch, scratch, scratch2); |
|
1755 |
b(*where, cond); |
|
1756 |
} |
|
1757 |
||
1758 |
void InterpreterMacroAssembler::get_method_counters(Register method, |
|
1759 |
Register Rcounters, |
|
46300
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1760 |
Label& skip, |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1761 |
bool saveRegs, |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1762 |
Register reg1, |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1763 |
Register reg2, |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1764 |
Register reg3) { |
42664 | 1765 |
const Address method_counters(method, Method::method_counters_offset()); |
1766 |
Label has_counters; |
|
1767 |
||
1768 |
ldr(Rcounters, method_counters); |
|
1769 |
cbnz(Rcounters, has_counters); |
|
1770 |
||
46300
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1771 |
if (saveRegs) { |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1772 |
// Save and restore in use caller-saved registers since they will be trashed by call_VM |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1773 |
assert(reg1 != noreg, "must specify reg1"); |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1774 |
assert(reg2 != noreg, "must specify reg2"); |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1775 |
assert(reg3 == noreg, "must not specify reg3"); |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1776 |
push(RegisterSet(reg1) | RegisterSet(reg2)); |
42664 | 1777 |
} |
1778 |
||
1779 |
mov(R1, method); |
|
46300
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1780 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::build_method_counters), R1); |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1781 |
|
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1782 |
if (saveRegs) { |
b8c77e61e99e
8155980: ARM InterpreterMacroAssembler::get_method_counters() should not be saving caller saved registers
cjplummer
parents:
42664
diff
changeset
|
1783 |
pop(RegisterSet(reg1) | RegisterSet(reg2)); |
42664 | 1784 |
} |
1785 |
||
1786 |
ldr(Rcounters, method_counters); |
|
1787 |
cbz(Rcounters, skip); // No MethodCounters created, OutOfMemory |
|
1788 |
||
1789 |
bind(has_counters); |
|
1790 |
} |