Mercurial > hg > truffle
annotate src/cpu/x86/vm/interp_masm_x86_32.cpp @ 819:c6386080541b
6849574: VM crash using NonBlockingHashMap (high_scale_lib)
Reviewed-by: kvn
author | never |
---|---|
date | Wed, 10 Jun 2009 12:19:48 -0700 |
parents | be93aad57795 |
children | 3f06f139ef53 |
rev | line source |
---|---|
0 | 1 /* |
579 | 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_interp_masm_x86_32.cpp.incl" | |
27 | |
28 | |
29 // Implementation of InterpreterMacroAssembler | |
30 #ifdef CC_INTERP | |
31 void InterpreterMacroAssembler::get_method(Register reg) { | |
304 | 32 movptr(reg, Address(rbp, -(sizeof(BytecodeInterpreter) + 2 * wordSize))); |
33 movptr(reg, Address(reg, byte_offset_of(BytecodeInterpreter, _method))); | |
0 | 34 } |
35 #endif // CC_INTERP | |
36 | |
37 | |
38 #ifndef CC_INTERP | |
39 void InterpreterMacroAssembler::call_VM_leaf_base( | |
40 address entry_point, | |
41 int number_of_arguments | |
42 ) { | |
43 // interpreter specific | |
44 // | |
45 // Note: No need to save/restore bcp & locals (rsi & rdi) pointer | |
46 // since these are callee saved registers and no blocking/ | |
47 // GC can happen in leaf calls. | |
48 // Further Note: DO NOT save/restore bcp/locals. If a caller has | |
49 // already saved them so that it can use rsi/rdi as temporaries | |
50 // then a save/restore here will DESTROY the copy the caller | |
51 // saved! There used to be a save_bcp() that only happened in | |
52 // the ASSERT path (no restore_bcp). Which caused bizarre failures | |
53 // when jvm built with ASSERTs. | |
54 #ifdef ASSERT | |
55 { Label L; | |
304 | 56 cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); |
0 | 57 jcc(Assembler::equal, L); |
58 stop("InterpreterMacroAssembler::call_VM_leaf_base: last_sp != NULL"); | |
59 bind(L); | |
60 } | |
61 #endif | |
62 // super call | |
63 MacroAssembler::call_VM_leaf_base(entry_point, number_of_arguments); | |
64 // interpreter specific | |
65 | |
66 // Used to ASSERT that rsi/rdi were equal to frame's bcp/locals | |
67 // but since they may not have been saved (and we don't want to | |
68 // save them here (see note above) the assert is invalid. | |
69 } | |
70 | |
71 | |
72 void InterpreterMacroAssembler::call_VM_base( | |
73 Register oop_result, | |
74 Register java_thread, | |
75 Register last_java_sp, | |
76 address entry_point, | |
77 int number_of_arguments, | |
78 bool check_exceptions | |
79 ) { | |
80 #ifdef ASSERT | |
81 { Label L; | |
304 | 82 cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); |
0 | 83 jcc(Assembler::equal, L); |
84 stop("InterpreterMacroAssembler::call_VM_base: last_sp != NULL"); | |
85 bind(L); | |
86 } | |
87 #endif /* ASSERT */ | |
88 // interpreter specific | |
89 // | |
90 // Note: Could avoid restoring locals ptr (callee saved) - however doesn't | |
91 // really make a difference for these runtime calls, since they are | |
92 // slow anyway. Btw., bcp must be saved/restored since it may change | |
93 // due to GC. | |
94 assert(java_thread == noreg , "not expecting a precomputed java thread"); | |
95 save_bcp(); | |
96 // super call | |
97 MacroAssembler::call_VM_base(oop_result, java_thread, last_java_sp, entry_point, number_of_arguments, check_exceptions); | |
98 // interpreter specific | |
99 restore_bcp(); | |
100 restore_locals(); | |
101 } | |
102 | |
103 | |
104 void InterpreterMacroAssembler::check_and_handle_popframe(Register java_thread) { | |
105 if (JvmtiExport::can_pop_frame()) { | |
106 Label L; | |
107 // Initiate popframe handling only if it is not already being processed. If the flag | |
108 // has the popframe_processing bit set, it means that this code is called *during* popframe | |
109 // handling - we don't want to reenter. | |
110 Register pop_cond = java_thread; // Not clear if any other register is available... | |
111 movl(pop_cond, Address(java_thread, JavaThread::popframe_condition_offset())); | |
112 testl(pop_cond, JavaThread::popframe_pending_bit); | |
113 jcc(Assembler::zero, L); | |
114 testl(pop_cond, JavaThread::popframe_processing_bit); | |
115 jcc(Assembler::notZero, L); | |
116 // Call Interpreter::remove_activation_preserving_args_entry() to get the | |
117 // address of the same-named entrypoint in the generated interpreter code. | |
118 call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry)); | |
119 jmp(rax); | |
120 bind(L); | |
121 get_thread(java_thread); | |
122 } | |
123 } | |
124 | |
125 | |
126 void InterpreterMacroAssembler::load_earlyret_value(TosState state) { | |
127 get_thread(rcx); | |
128 movl(rcx, Address(rcx, JavaThread::jvmti_thread_state_offset())); | |
129 const Address tos_addr (rcx, JvmtiThreadState::earlyret_tos_offset()); | |
130 const Address oop_addr (rcx, JvmtiThreadState::earlyret_oop_offset()); | |
131 const Address val_addr (rcx, JvmtiThreadState::earlyret_value_offset()); | |
132 const Address val_addr1(rcx, JvmtiThreadState::earlyret_value_offset() | |
133 + in_ByteSize(wordSize)); | |
134 switch (state) { | |
304 | 135 case atos: movptr(rax, oop_addr); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
337
diff
changeset
|
136 movptr(oop_addr, NULL_WORD); |
0 | 137 verify_oop(rax, state); break; |
304 | 138 case ltos: |
139 movl(rdx, val_addr1); // fall through | |
0 | 140 case btos: // fall through |
141 case ctos: // fall through | |
142 case stos: // fall through | |
143 case itos: movl(rax, val_addr); break; | |
144 case ftos: fld_s(val_addr); break; | |
145 case dtos: fld_d(val_addr); break; | |
146 case vtos: /* nothing to do */ break; | |
147 default : ShouldNotReachHere(); | |
148 } | |
149 // Clean up tos value in the thread object | |
304 | 150 movl(tos_addr, (int32_t) ilgl); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
337
diff
changeset
|
151 movptr(val_addr, NULL_WORD); |
533
dc3ad84615cf
6795913: A few remaining wrong casts need to be fixed for building hotspot successfully on Mac OS.
xlu
parents:
512
diff
changeset
|
152 NOT_LP64(movptr(val_addr1, NULL_WORD)); |
0 | 153 } |
154 | |
155 | |
156 void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread) { | |
157 if (JvmtiExport::can_force_early_return()) { | |
158 Label L; | |
159 Register tmp = java_thread; | |
304 | 160 movptr(tmp, Address(tmp, JavaThread::jvmti_thread_state_offset())); |
161 testptr(tmp, tmp); | |
0 | 162 jcc(Assembler::zero, 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 movl(tmp, Address(tmp, JvmtiThreadState::earlyret_state_offset())); | |
168 cmpl(tmp, JvmtiThreadState::earlyret_pending); | |
169 jcc(Assembler::notEqual, L); | |
170 | |
171 // Call Interpreter::remove_activation_early_entry() to get the address of the | |
172 // same-named entrypoint in the generated interpreter code. | |
173 get_thread(java_thread); | |
304 | 174 movptr(tmp, Address(java_thread, JavaThread::jvmti_thread_state_offset())); |
0 | 175 pushl(Address(tmp, JvmtiThreadState::earlyret_tos_offset())); |
176 call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), 1); | |
177 jmp(rax); | |
178 bind(L); | |
179 get_thread(java_thread); | |
180 } | |
181 } | |
182 | |
183 | |
184 void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) { | |
185 assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); | |
186 movl(reg, Address(rsi, bcp_offset)); | |
304 | 187 bswapl(reg); |
0 | 188 shrl(reg, 16); |
189 } | |
190 | |
191 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
192 void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_offset, bool giant_index) { |
0 | 193 assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
194 if (!giant_index) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
195 load_unsigned_short(reg, Address(rsi, bcp_offset)); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
196 } else { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
197 assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
198 movl(reg, Address(rsi, bcp_offset)); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
199 assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
200 notl(reg); // convert to plain index |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
201 } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
202 } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
203 |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
204 |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
205 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, Register index, |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
206 int bcp_offset, bool giant_index) { |
0 | 207 assert(cache != index, "must use different registers"); |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
208 get_cache_index_at_bcp(index, bcp_offset, giant_index); |
304 | 209 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
0 | 210 assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below"); |
304 | 211 shlptr(index, 2); // convert from field index to ConstantPoolCacheEntry index |
0 | 212 } |
213 | |
214 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
215 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, Register tmp, |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
216 int bcp_offset, bool giant_index) { |
0 | 217 assert(cache != tmp, "must use different register"); |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
218 get_cache_index_at_bcp(tmp, bcp_offset, giant_index); |
0 | 219 assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below"); |
220 // convert from field index to ConstantPoolCacheEntry index | |
221 // and from word offset to byte offset | |
222 shll(tmp, 2 + LogBytesPerWord); | |
304 | 223 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
0 | 224 // skip past the header |
304 | 225 addptr(cache, in_bytes(constantPoolCacheOopDesc::base_offset())); |
226 addptr(cache, tmp); // construct pointer to cache entry | |
0 | 227 } |
228 | |
229 | |
230 // Generate a subtype check: branch to ok_is_subtype if sub_klass is | |
231 // a subtype of super_klass. EAX holds the super_klass. Blows ECX. | |
232 // Resets EDI to locals. Register sub_klass cannot be any of the above. | |
233 void InterpreterMacroAssembler::gen_subtype_check( Register Rsub_klass, Label &ok_is_subtype ) { | |
234 assert( Rsub_klass != rax, "rax, holds superklass" ); | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
625
diff
changeset
|
235 assert( Rsub_klass != rcx, "used as a temp" ); |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
625
diff
changeset
|
236 assert( Rsub_klass != rdi, "used as a temp, restored from locals" ); |
0 | 237 |
238 // Profile the not-null value's klass. | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
625
diff
changeset
|
239 profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi |
0 | 240 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
625
diff
changeset
|
241 // Do the check. |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
625
diff
changeset
|
242 check_klass_subtype(Rsub_klass, rax, rcx, ok_is_subtype); // blows rcx |
0 | 243 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
625
diff
changeset
|
244 // Profile the failure of the check. |
0 | 245 profile_typecheck_failed(rcx); // blows rcx |
246 } | |
247 | |
248 void InterpreterMacroAssembler::f2ieee() { | |
249 if (IEEEPrecision) { | |
250 fstp_s(Address(rsp, 0)); | |
251 fld_s(Address(rsp, 0)); | |
252 } | |
253 } | |
254 | |
255 | |
256 void InterpreterMacroAssembler::d2ieee() { | |
257 if (IEEEPrecision) { | |
258 fstp_d(Address(rsp, 0)); | |
259 fld_d(Address(rsp, 0)); | |
260 } | |
261 } | |
262 | |
263 // Java Expression Stack | |
264 | |
265 #ifdef ASSERT | |
266 void InterpreterMacroAssembler::verify_stack_tag(frame::Tag t) { | |
267 if (TaggedStackInterpreter) { | |
268 Label okay; | |
304 | 269 cmpptr(Address(rsp, wordSize), (int32_t)t); |
0 | 270 jcc(Assembler::equal, okay); |
271 // Also compare if the stack value is zero, then the tag might | |
272 // not have been set coming from deopt. | |
304 | 273 cmpptr(Address(rsp, 0), 0); |
0 | 274 jcc(Assembler::equal, okay); |
275 stop("Java Expression stack tag value is bad"); | |
276 bind(okay); | |
277 } | |
278 } | |
279 #endif // ASSERT | |
280 | |
281 void InterpreterMacroAssembler::pop_ptr(Register r) { | |
282 debug_only(verify_stack_tag(frame::TagReference)); | |
304 | 283 pop(r); |
284 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
0 | 285 } |
286 | |
287 void InterpreterMacroAssembler::pop_ptr(Register r, Register tag) { | |
304 | 288 pop(r); |
0 | 289 // Tag may not be reference for jsr, can be returnAddress |
304 | 290 if (TaggedStackInterpreter) pop(tag); |
0 | 291 } |
292 | |
293 void InterpreterMacroAssembler::pop_i(Register r) { | |
294 debug_only(verify_stack_tag(frame::TagValue)); | |
304 | 295 pop(r); |
296 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
0 | 297 } |
298 | |
299 void InterpreterMacroAssembler::pop_l(Register lo, Register hi) { | |
300 debug_only(verify_stack_tag(frame::TagValue)); | |
304 | 301 pop(lo); |
302 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
0 | 303 debug_only(verify_stack_tag(frame::TagValue)); |
304 | 304 pop(hi); |
305 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
0 | 306 } |
307 | |
308 void InterpreterMacroAssembler::pop_f() { | |
309 debug_only(verify_stack_tag(frame::TagValue)); | |
310 fld_s(Address(rsp, 0)); | |
304 | 311 addptr(rsp, 1 * wordSize); |
312 if (TaggedStackInterpreter) addptr(rsp, 1 * wordSize); | |
0 | 313 } |
314 | |
315 void InterpreterMacroAssembler::pop_d() { | |
316 // Write double to stack contiguously and load into ST0 | |
317 pop_dtos_to_rsp(); | |
318 fld_d(Address(rsp, 0)); | |
304 | 319 addptr(rsp, 2 * wordSize); |
0 | 320 } |
321 | |
322 | |
323 // Pop the top of the java expression stack to execution stack (which | |
324 // happens to be the same place). | |
325 void InterpreterMacroAssembler::pop_dtos_to_rsp() { | |
326 if (TaggedStackInterpreter) { | |
327 // Pop double value into scratch registers | |
328 debug_only(verify_stack_tag(frame::TagValue)); | |
304 | 329 pop(rax); |
330 addptr(rsp, 1* wordSize); | |
0 | 331 debug_only(verify_stack_tag(frame::TagValue)); |
304 | 332 pop(rdx); |
333 addptr(rsp, 1* wordSize); | |
334 push(rdx); | |
335 push(rax); | |
0 | 336 } |
337 } | |
338 | |
339 void InterpreterMacroAssembler::pop_ftos_to_rsp() { | |
340 if (TaggedStackInterpreter) { | |
341 debug_only(verify_stack_tag(frame::TagValue)); | |
304 | 342 pop(rax); |
343 addptr(rsp, 1 * wordSize); | |
344 push(rax); // ftos is at rsp | |
0 | 345 } |
346 } | |
347 | |
348 void InterpreterMacroAssembler::pop(TosState state) { | |
349 switch (state) { | |
350 case atos: pop_ptr(rax); break; | |
351 case btos: // fall through | |
352 case ctos: // fall through | |
353 case stos: // fall through | |
354 case itos: pop_i(rax); break; | |
355 case ltos: pop_l(rax, rdx); break; | |
356 case ftos: pop_f(); break; | |
357 case dtos: pop_d(); break; | |
358 case vtos: /* nothing to do */ break; | |
359 default : ShouldNotReachHere(); | |
360 } | |
361 verify_oop(rax, state); | |
362 } | |
363 | |
364 void InterpreterMacroAssembler::push_ptr(Register r) { | |
304 | 365 if (TaggedStackInterpreter) push(frame::TagReference); |
366 push(r); | |
0 | 367 } |
368 | |
369 void InterpreterMacroAssembler::push_ptr(Register r, Register tag) { | |
304 | 370 if (TaggedStackInterpreter) push(tag); // tag first |
371 push(r); | |
0 | 372 } |
373 | |
374 void InterpreterMacroAssembler::push_i(Register r) { | |
304 | 375 if (TaggedStackInterpreter) push(frame::TagValue); |
376 push(r); | |
0 | 377 } |
378 | |
379 void InterpreterMacroAssembler::push_l(Register lo, Register hi) { | |
304 | 380 if (TaggedStackInterpreter) push(frame::TagValue); |
381 push(hi); | |
382 if (TaggedStackInterpreter) push(frame::TagValue); | |
383 push(lo); | |
0 | 384 } |
385 | |
386 void InterpreterMacroAssembler::push_f() { | |
304 | 387 if (TaggedStackInterpreter) push(frame::TagValue); |
0 | 388 // Do not schedule for no AGI! Never write beyond rsp! |
304 | 389 subptr(rsp, 1 * wordSize); |
0 | 390 fstp_s(Address(rsp, 0)); |
391 } | |
392 | |
393 void InterpreterMacroAssembler::push_d(Register r) { | |
394 if (TaggedStackInterpreter) { | |
395 // Double values are stored as: | |
396 // tag | |
397 // high | |
398 // tag | |
399 // low | |
304 | 400 push(frame::TagValue); |
401 subptr(rsp, 3 * wordSize); | |
0 | 402 fstp_d(Address(rsp, 0)); |
403 // move high word up to slot n-1 | |
404 movl(r, Address(rsp, 1*wordSize)); | |
405 movl(Address(rsp, 2*wordSize), r); | |
406 // move tag | |
407 movl(Address(rsp, 1*wordSize), frame::TagValue); | |
408 } else { | |
409 // Do not schedule for no AGI! Never write beyond rsp! | |
304 | 410 subptr(rsp, 2 * wordSize); |
0 | 411 fstp_d(Address(rsp, 0)); |
412 } | |
413 } | |
414 | |
415 | |
416 void InterpreterMacroAssembler::push(TosState state) { | |
417 verify_oop(rax, state); | |
418 switch (state) { | |
419 case atos: push_ptr(rax); break; | |
420 case btos: // fall through | |
421 case ctos: // fall through | |
422 case stos: // fall through | |
423 case itos: push_i(rax); break; | |
424 case ltos: push_l(rax, rdx); break; | |
425 case ftos: push_f(); break; | |
426 case dtos: push_d(rax); break; | |
427 case vtos: /* nothing to do */ break; | |
428 default : ShouldNotReachHere(); | |
429 } | |
430 } | |
431 | |
432 | |
433 // Tagged stack helpers for swap and dup | |
434 void InterpreterMacroAssembler::load_ptr_and_tag(int n, Register val, | |
435 Register tag) { | |
304 | 436 movptr(val, Address(rsp, Interpreter::expr_offset_in_bytes(n))); |
0 | 437 if (TaggedStackInterpreter) { |
304 | 438 movptr(tag, Address(rsp, Interpreter::expr_tag_offset_in_bytes(n))); |
0 | 439 } |
440 } | |
441 | |
442 void InterpreterMacroAssembler::store_ptr_and_tag(int n, Register val, | |
443 Register tag) { | |
304 | 444 movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); |
0 | 445 if (TaggedStackInterpreter) { |
304 | 446 movptr(Address(rsp, Interpreter::expr_tag_offset_in_bytes(n)), tag); |
0 | 447 } |
448 } | |
449 | |
450 | |
451 // Tagged local support | |
452 void InterpreterMacroAssembler::tag_local(frame::Tag tag, int n) { | |
453 if (TaggedStackInterpreter) { | |
454 if (tag == frame::TagCategory2) { | |
304 | 455 movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n+1)), (int32_t)frame::TagValue); |
456 movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)frame::TagValue); | |
0 | 457 } else { |
304 | 458 movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)tag); |
0 | 459 } |
460 } | |
461 } | |
462 | |
463 void InterpreterMacroAssembler::tag_local(frame::Tag tag, Register idx) { | |
464 if (TaggedStackInterpreter) { | |
465 if (tag == frame::TagCategory2) { | |
304 | 466 movptr(Address(rdi, idx, Interpreter::stackElementScale(), |
467 Interpreter::local_tag_offset_in_bytes(1)), (int32_t)frame::TagValue); | |
468 movptr(Address(rdi, idx, Interpreter::stackElementScale(), | |
469 Interpreter::local_tag_offset_in_bytes(0)), (int32_t)frame::TagValue); | |
0 | 470 } else { |
304 | 471 movptr(Address(rdi, idx, Interpreter::stackElementScale(), |
472 Interpreter::local_tag_offset_in_bytes(0)), (int32_t)tag); | |
0 | 473 } |
474 } | |
475 } | |
476 | |
477 void InterpreterMacroAssembler::tag_local(Register tag, Register idx) { | |
478 if (TaggedStackInterpreter) { | |
479 // can only be TagValue or TagReference | |
304 | 480 movptr(Address(rdi, idx, Interpreter::stackElementScale(), |
0 | 481 Interpreter::local_tag_offset_in_bytes(0)), tag); |
482 } | |
483 } | |
484 | |
485 | |
486 void InterpreterMacroAssembler::tag_local(Register tag, int n) { | |
487 if (TaggedStackInterpreter) { | |
488 // can only be TagValue or TagReference | |
304 | 489 movptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), tag); |
0 | 490 } |
491 } | |
492 | |
493 #ifdef ASSERT | |
494 void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, int n) { | |
495 if (TaggedStackInterpreter) { | |
496 frame::Tag t = tag; | |
497 if (tag == frame::TagCategory2) { | |
498 Label nbl; | |
499 t = frame::TagValue; // change to what is stored in locals | |
304 | 500 cmpptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n+1)), (int32_t)t); |
0 | 501 jcc(Assembler::equal, nbl); |
502 stop("Local tag is bad for long/double"); | |
503 bind(nbl); | |
504 } | |
505 Label notBad; | |
304 | 506 cmpptr(Address(rdi, Interpreter::local_tag_offset_in_bytes(n)), (int32_t)t); |
0 | 507 jcc(Assembler::equal, notBad); |
508 // Also compare if the local value is zero, then the tag might | |
509 // not have been set coming from deopt. | |
304 | 510 cmpptr(Address(rdi, Interpreter::local_offset_in_bytes(n)), 0); |
0 | 511 jcc(Assembler::equal, notBad); |
512 stop("Local tag is bad"); | |
513 bind(notBad); | |
514 } | |
515 } | |
516 | |
517 void InterpreterMacroAssembler::verify_local_tag(frame::Tag tag, Register idx) { | |
518 if (TaggedStackInterpreter) { | |
519 frame::Tag t = tag; | |
520 if (tag == frame::TagCategory2) { | |
521 Label nbl; | |
522 t = frame::TagValue; // change to what is stored in locals | |
304 | 523 cmpptr(Address(rdi, idx, Interpreter::stackElementScale(), |
524 Interpreter::local_tag_offset_in_bytes(1)), (int32_t)t); | |
0 | 525 jcc(Assembler::equal, nbl); |
526 stop("Local tag is bad for long/double"); | |
527 bind(nbl); | |
528 } | |
529 Label notBad; | |
530 cmpl(Address(rdi, idx, Interpreter::stackElementScale(), | |
304 | 531 Interpreter::local_tag_offset_in_bytes(0)), (int32_t)t); |
0 | 532 jcc(Assembler::equal, notBad); |
533 // Also compare if the local value is zero, then the tag might | |
534 // not have been set coming from deopt. | |
304 | 535 cmpptr(Address(rdi, idx, Interpreter::stackElementScale(), |
0 | 536 Interpreter::local_offset_in_bytes(0)), 0); |
537 jcc(Assembler::equal, notBad); | |
538 stop("Local tag is bad"); | |
539 bind(notBad); | |
540 | |
541 } | |
542 } | |
543 #endif // ASSERT | |
544 | |
545 void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { | |
546 MacroAssembler::call_VM_leaf_base(entry_point, 0); | |
547 } | |
548 | |
549 | |
550 void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1) { | |
304 | 551 push(arg_1); |
0 | 552 MacroAssembler::call_VM_leaf_base(entry_point, 1); |
553 } | |
554 | |
555 | |
556 void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2) { | |
304 | 557 push(arg_2); |
558 push(arg_1); | |
0 | 559 MacroAssembler::call_VM_leaf_base(entry_point, 2); |
560 } | |
561 | |
562 | |
563 void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3) { | |
304 | 564 push(arg_3); |
565 push(arg_2); | |
566 push(arg_1); | |
0 | 567 MacroAssembler::call_VM_leaf_base(entry_point, 3); |
568 } | |
569 | |
570 | |
710 | 571 void InterpreterMacroAssembler::prepare_to_jump_from_interpreted() { |
0 | 572 // set sender sp |
304 | 573 lea(rsi, Address(rsp, wordSize)); |
0 | 574 // record last_sp |
304 | 575 movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), rsi); |
710 | 576 } |
577 | |
578 | |
579 // Jump to from_interpreted entry of a call unless single stepping is possible | |
580 // in this thread in which case we must call the i2i entry | |
581 void InterpreterMacroAssembler::jump_from_interpreted(Register method, Register temp) { | |
582 prepare_to_jump_from_interpreted(); | |
0 | 583 |
584 if (JvmtiExport::can_post_interpreter_events()) { | |
585 Label run_compiled_code; | |
586 // JVMTI events, such as single-stepping, are implemented partly by avoiding running | |
587 // compiled code in threads for which the event is enabled. Check here for | |
588 // interp_only_mode if these events CAN be enabled. | |
589 get_thread(temp); | |
590 // interp_only is an int, on little endian it is sufficient to test the byte only | |
591 // Is a cmpl faster (ce | |
592 cmpb(Address(temp, JavaThread::interp_only_mode_offset()), 0); | |
593 jcc(Assembler::zero, run_compiled_code); | |
594 jmp(Address(method, methodOopDesc::interpreter_entry_offset())); | |
595 bind(run_compiled_code); | |
596 } | |
597 | |
598 jmp(Address(method, methodOopDesc::from_interpreted_offset())); | |
599 | |
600 } | |
601 | |
602 | |
603 // The following two routines provide a hook so that an implementation | |
604 // can schedule the dispatch in two parts. Intel does not do this. | |
605 void InterpreterMacroAssembler::dispatch_prolog(TosState state, int step) { | |
606 // Nothing Intel-specific to be done here. | |
607 } | |
608 | |
609 void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) { | |
610 dispatch_next(state, step); | |
611 } | |
612 | |
613 void InterpreterMacroAssembler::dispatch_base(TosState state, address* table, | |
614 bool verifyoop) { | |
615 verify_FPU(1, state); | |
616 if (VerifyActivationFrameSize) { | |
617 Label L; | |
304 | 618 mov(rcx, rbp); |
619 subptr(rcx, rsp); | |
0 | 620 int min_frame_size = (frame::link_offset - frame::interpreter_frame_initial_sp_offset) * wordSize; |
304 | 621 cmpptr(rcx, min_frame_size); |
0 | 622 jcc(Assembler::greaterEqual, L); |
623 stop("broken stack frame"); | |
624 bind(L); | |
625 } | |
626 if (verifyoop) verify_oop(rax, state); | |
304 | 627 Address index(noreg, rbx, Address::times_ptr); |
0 | 628 ExternalAddress tbl((address)table); |
629 ArrayAddress dispatch(tbl, index); | |
630 jump(dispatch); | |
631 } | |
632 | |
633 | |
634 void InterpreterMacroAssembler::dispatch_only(TosState state) { | |
635 dispatch_base(state, Interpreter::dispatch_table(state)); | |
636 } | |
637 | |
638 | |
639 void InterpreterMacroAssembler::dispatch_only_normal(TosState state) { | |
640 dispatch_base(state, Interpreter::normal_table(state)); | |
641 } | |
642 | |
643 void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) { | |
644 dispatch_base(state, Interpreter::normal_table(state), false); | |
645 } | |
646 | |
647 | |
648 void InterpreterMacroAssembler::dispatch_next(TosState state, int step) { | |
649 // load next bytecode (load before advancing rsi to prevent AGI) | |
650 load_unsigned_byte(rbx, Address(rsi, step)); | |
651 // advance rsi | |
652 increment(rsi, step); | |
653 dispatch_base(state, Interpreter::dispatch_table(state)); | |
654 } | |
655 | |
656 | |
657 void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) { | |
658 // load current bytecode | |
659 load_unsigned_byte(rbx, Address(rsi, 0)); | |
660 dispatch_base(state, table); | |
661 } | |
662 | |
663 // remove activation | |
664 // | |
665 // Unlock the receiver if this is a synchronized method. | |
666 // Unlock any Java monitors from syncronized blocks. | |
667 // Remove the activation from the stack. | |
668 // | |
669 // If there are locked Java monitors | |
670 // If throw_monitor_exception | |
671 // throws IllegalMonitorStateException | |
672 // Else if install_monitor_exception | |
673 // installs IllegalMonitorStateException | |
674 // Else | |
675 // no error processing | |
676 void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_addr, | |
677 bool throw_monitor_exception, | |
678 bool install_monitor_exception, | |
679 bool notify_jvmdi) { | |
680 // Note: Registers rax, rdx and FPU ST(0) may be in use for the result | |
681 // check if synchronized method | |
682 Label unlocked, unlock, no_unlock; | |
683 | |
684 get_thread(rcx); | |
685 const Address do_not_unlock_if_synchronized(rcx, | |
686 in_bytes(JavaThread::do_not_unlock_if_synchronized_offset())); | |
687 | |
688 movbool(rbx, do_not_unlock_if_synchronized); | |
304 | 689 mov(rdi,rbx); |
0 | 690 movbool(do_not_unlock_if_synchronized, false); // reset the flag |
691 | |
304 | 692 movptr(rbx, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); // get method access flags |
0 | 693 movl(rcx, Address(rbx, methodOopDesc::access_flags_offset())); |
694 | |
695 testl(rcx, JVM_ACC_SYNCHRONIZED); | |
696 jcc(Assembler::zero, unlocked); | |
697 | |
698 // Don't unlock anything if the _do_not_unlock_if_synchronized flag | |
699 // is set. | |
304 | 700 mov(rcx,rdi); |
0 | 701 testbool(rcx); |
702 jcc(Assembler::notZero, no_unlock); | |
703 | |
704 // unlock monitor | |
705 push(state); // save result | |
706 | |
707 // BasicObjectLock will be first in list, since this is a synchronized method. However, need | |
708 // to check that the object has not been unlocked by an explicit monitorexit bytecode. | |
709 const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock)); | |
304 | 710 lea (rdx, monitor); // address of first monitor |
0 | 711 |
304 | 712 movptr (rax, Address(rdx, BasicObjectLock::obj_offset_in_bytes())); |
713 testptr(rax, rax); | |
714 jcc (Assembler::notZero, unlock); | |
0 | 715 |
716 pop(state); | |
717 if (throw_monitor_exception) { | |
718 empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow | |
719 | |
720 // Entry already unlocked, need to throw exception | |
721 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); | |
722 should_not_reach_here(); | |
723 } else { | |
724 // Monitor already unlocked during a stack unroll. | |
725 // If requested, install an illegal_monitor_state_exception. | |
726 // Continue with stack unrolling. | |
727 if (install_monitor_exception) { | |
728 empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow | |
729 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); | |
730 } | |
731 jmp(unlocked); | |
732 } | |
733 | |
734 bind(unlock); | |
735 unlock_object(rdx); | |
736 pop(state); | |
737 | |
738 // Check that for block-structured locking (i.e., that all locked objects has been unlocked) | |
739 bind(unlocked); | |
740 | |
741 // rax, rdx: Might contain return value | |
742 | |
743 // Check that all monitors are unlocked | |
744 { | |
745 Label loop, exception, entry, restart; | |
746 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; | |
747 const Address monitor_block_top(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); | |
748 const Address monitor_block_bot(rbp, frame::interpreter_frame_initial_sp_offset * wordSize); | |
749 | |
750 bind(restart); | |
304 | 751 movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry |
752 lea(rbx, monitor_block_bot); // points to word before bottom of monitor block | |
0 | 753 jmp(entry); |
754 | |
755 // Entry already locked, need to throw exception | |
756 bind(exception); | |
757 | |
758 if (throw_monitor_exception) { | |
759 empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow | |
760 | |
761 // Throw exception | |
762 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); | |
763 should_not_reach_here(); | |
764 } else { | |
765 // Stack unrolling. Unlock object and install illegal_monitor_exception | |
766 // Unlock does not block, so don't have to worry about the frame | |
767 | |
768 push(state); | |
304 | 769 mov(rdx, rcx); |
0 | 770 unlock_object(rdx); |
771 pop(state); | |
772 | |
773 if (install_monitor_exception) { | |
774 empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow | |
775 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); | |
776 } | |
777 | |
778 jmp(restart); | |
779 } | |
780 | |
781 bind(loop); | |
304 | 782 cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used |
0 | 783 jcc(Assembler::notEqual, exception); |
784 | |
304 | 785 addptr(rcx, entry_size); // otherwise advance to next entry |
0 | 786 bind(entry); |
304 | 787 cmpptr(rcx, rbx); // check if bottom reached |
0 | 788 jcc(Assembler::notEqual, loop); // if not at bottom then check this entry |
789 } | |
790 | |
791 bind(no_unlock); | |
792 | |
793 // jvmti support | |
794 if (notify_jvmdi) { | |
795 notify_method_exit(state, NotifyJVMTI); // preserve TOSCA | |
796 } else { | |
797 notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA | |
798 } | |
799 | |
800 // remove activation | |
304 | 801 movptr(rbx, Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); // get sender sp |
0 | 802 leave(); // remove frame anchor |
304 | 803 pop(ret_addr); // get return address |
804 mov(rsp, rbx); // set sp to sender sp | |
0 | 805 if (UseSSE) { |
806 // float and double are returned in xmm register in SSE-mode | |
807 if (state == ftos && UseSSE >= 1) { | |
304 | 808 subptr(rsp, wordSize); |
0 | 809 fstp_s(Address(rsp, 0)); |
810 movflt(xmm0, Address(rsp, 0)); | |
304 | 811 addptr(rsp, wordSize); |
0 | 812 } else if (state == dtos && UseSSE >= 2) { |
304 | 813 subptr(rsp, 2*wordSize); |
0 | 814 fstp_d(Address(rsp, 0)); |
815 movdbl(xmm0, Address(rsp, 0)); | |
304 | 816 addptr(rsp, 2*wordSize); |
0 | 817 } |
818 } | |
819 } | |
820 | |
821 #endif /* !CC_INTERP */ | |
822 | |
823 | |
824 // Lock object | |
825 // | |
826 // Argument: rdx : Points to BasicObjectLock to be used for locking. Must | |
827 // be initialized with object to lock | |
828 void InterpreterMacroAssembler::lock_object(Register lock_reg) { | |
829 assert(lock_reg == rdx, "The argument is only for looks. It must be rdx"); | |
830 | |
831 if (UseHeavyMonitors) { | |
832 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), lock_reg); | |
833 } else { | |
834 | |
835 Label done; | |
836 | |
837 const Register swap_reg = rax; // Must use rax, for cmpxchg instruction | |
838 const Register obj_reg = rcx; // Will contain the oop | |
839 | |
840 const int obj_offset = BasicObjectLock::obj_offset_in_bytes(); | |
841 const int lock_offset = BasicObjectLock::lock_offset_in_bytes (); | |
842 const int mark_offset = lock_offset + BasicLock::displaced_header_offset_in_bytes(); | |
843 | |
844 Label slow_case; | |
845 | |
846 // Load object pointer into obj_reg %rcx | |
304 | 847 movptr(obj_reg, Address(lock_reg, obj_offset)); |
0 | 848 |
849 if (UseBiasedLocking) { | |
850 // Note: we use noreg for the temporary register since it's hard | |
851 // to come up with a free register on all incoming code paths | |
852 biased_locking_enter(lock_reg, obj_reg, swap_reg, noreg, false, done, &slow_case); | |
853 } | |
854 | |
855 // Load immediate 1 into swap_reg %rax, | |
304 | 856 movptr(swap_reg, (int32_t)1); |
0 | 857 |
858 // Load (object->mark() | 1) into swap_reg %rax, | |
304 | 859 orptr(swap_reg, Address(obj_reg, 0)); |
0 | 860 |
861 // Save (object->mark() | 1) into BasicLock's displaced header | |
304 | 862 movptr(Address(lock_reg, mark_offset), swap_reg); |
0 | 863 |
864 assert(lock_offset == 0, "displached header must be first word in BasicObjectLock"); | |
865 if (os::is_MP()) { | |
866 lock(); | |
867 } | |
304 | 868 cmpxchgptr(lock_reg, Address(obj_reg, 0)); |
0 | 869 if (PrintBiasedLockingStatistics) { |
870 cond_inc32(Assembler::zero, | |
871 ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr())); | |
872 } | |
873 jcc(Assembler::zero, done); | |
874 | |
875 // Test if the oopMark is an obvious stack pointer, i.e., | |
876 // 1) (mark & 3) == 0, and | |
877 // 2) rsp <= mark < mark + os::pagesize() | |
878 // | |
879 // These 3 tests can be done by evaluating the following | |
880 // expression: ((mark - rsp) & (3 - os::vm_page_size())), | |
881 // assuming both stack pointer and pagesize have their | |
882 // least significant 2 bits clear. | |
883 // NOTE: the oopMark is in swap_reg %rax, as the result of cmpxchg | |
304 | 884 subptr(swap_reg, rsp); |
885 andptr(swap_reg, 3 - os::vm_page_size()); | |
0 | 886 |
887 // Save the test result, for recursive case, the result is zero | |
304 | 888 movptr(Address(lock_reg, mark_offset), swap_reg); |
0 | 889 |
890 if (PrintBiasedLockingStatistics) { | |
891 cond_inc32(Assembler::zero, | |
892 ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr())); | |
893 } | |
894 jcc(Assembler::zero, done); | |
895 | |
896 bind(slow_case); | |
897 | |
898 // Call the runtime routine for slow case | |
899 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), lock_reg); | |
900 | |
901 bind(done); | |
902 } | |
903 } | |
904 | |
905 | |
906 // Unlocks an object. Used in monitorexit bytecode and remove_activation. | |
907 // | |
908 // Argument: rdx : Points to BasicObjectLock structure for lock | |
909 // Throw an IllegalMonitorException if object is not locked by current thread | |
910 // | |
911 // Uses: rax, rbx, rcx, rdx | |
912 void InterpreterMacroAssembler::unlock_object(Register lock_reg) { | |
913 assert(lock_reg == rdx, "The argument is only for looks. It must be rdx"); | |
914 | |
915 if (UseHeavyMonitors) { | |
916 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg); | |
917 } else { | |
918 Label done; | |
919 | |
920 const Register swap_reg = rax; // Must use rax, for cmpxchg instruction | |
921 const Register header_reg = rbx; // Will contain the old oopMark | |
922 const Register obj_reg = rcx; // Will contain the oop | |
923 | |
924 save_bcp(); // Save in case of exception | |
925 | |
926 // Convert from BasicObjectLock structure to object and BasicLock structure | |
927 // Store the BasicLock address into %rax, | |
304 | 928 lea(swap_reg, Address(lock_reg, BasicObjectLock::lock_offset_in_bytes())); |
0 | 929 |
930 // Load oop into obj_reg(%rcx) | |
304 | 931 movptr(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset_in_bytes ())); |
0 | 932 |
933 // Free entry | |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
337
diff
changeset
|
934 movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), NULL_WORD); |
0 | 935 |
936 if (UseBiasedLocking) { | |
937 biased_locking_exit(obj_reg, header_reg, done); | |
938 } | |
939 | |
940 // Load the old header from BasicLock structure | |
304 | 941 movptr(header_reg, Address(swap_reg, BasicLock::displaced_header_offset_in_bytes())); |
0 | 942 |
943 // Test for recursion | |
304 | 944 testptr(header_reg, header_reg); |
0 | 945 |
946 // zero for recursive case | |
947 jcc(Assembler::zero, done); | |
948 | |
949 // Atomic swap back the old header | |
950 if (os::is_MP()) lock(); | |
304 | 951 cmpxchgptr(header_reg, Address(obj_reg, 0)); |
0 | 952 |
953 // zero for recursive case | |
954 jcc(Assembler::zero, done); | |
955 | |
956 // Call the runtime routine for slow case. | |
304 | 957 movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), obj_reg); // restore obj |
0 | 958 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg); |
959 | |
960 bind(done); | |
961 | |
962 restore_bcp(); | |
963 } | |
964 } | |
965 | |
966 | |
967 #ifndef CC_INTERP | |
968 | |
969 // Test ImethodDataPtr. If it is null, continue at the specified label | |
970 void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) { | |
971 assert(ProfileInterpreter, "must be profiling interpreter"); | |
304 | 972 movptr(mdp, Address(rbp, frame::interpreter_frame_mdx_offset * wordSize)); |
973 testptr(mdp, mdp); | |
0 | 974 jcc(Assembler::zero, zero_continue); |
975 } | |
976 | |
977 | |
978 // Set the method data pointer for the current bcp. | |
979 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { | |
980 assert(ProfileInterpreter, "must be profiling interpreter"); | |
981 Label zero_continue; | |
304 | 982 push(rax); |
983 push(rbx); | |
0 | 984 |
985 get_method(rbx); | |
986 // Test MDO to avoid the call if it is NULL. | |
304 | 987 movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
988 testptr(rax, rax); | |
0 | 989 jcc(Assembler::zero, zero_continue); |
990 | |
991 // rbx,: method | |
992 // rsi: bcp | |
993 call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi); | |
994 // rax,: mdi | |
995 | |
304 | 996 movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
997 testptr(rbx, rbx); | |
0 | 998 jcc(Assembler::zero, zero_continue); |
304 | 999 addptr(rbx, in_bytes(methodDataOopDesc::data_offset())); |
1000 addptr(rbx, rax); | |
1001 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rbx); | |
0 | 1002 |
1003 bind(zero_continue); | |
304 | 1004 pop(rbx); |
1005 pop(rax); | |
0 | 1006 } |
1007 | |
1008 void InterpreterMacroAssembler::verify_method_data_pointer() { | |
1009 assert(ProfileInterpreter, "must be profiling interpreter"); | |
1010 #ifdef ASSERT | |
1011 Label verify_continue; | |
304 | 1012 push(rax); |
1013 push(rbx); | |
1014 push(rcx); | |
1015 push(rdx); | |
0 | 1016 test_method_data_pointer(rcx, verify_continue); // If mdp is zero, continue |
1017 get_method(rbx); | |
1018 | |
1019 // If the mdp is valid, it will point to a DataLayout header which is | |
1020 // consistent with the bcp. The converse is highly probable also. | |
622
56aae7be60d4
6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents:
533
diff
changeset
|
1021 load_unsigned_short(rdx, Address(rcx, in_bytes(DataLayout::bci_offset()))); |
304 | 1022 addptr(rdx, Address(rbx, methodOopDesc::const_offset())); |
1023 lea(rdx, Address(rdx, constMethodOopDesc::codes_offset())); | |
1024 cmpptr(rdx, rsi); | |
0 | 1025 jcc(Assembler::equal, verify_continue); |
1026 // rbx,: method | |
1027 // rsi: bcp | |
1028 // rcx: mdp | |
1029 call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp), rbx, rsi, rcx); | |
1030 bind(verify_continue); | |
304 | 1031 pop(rdx); |
1032 pop(rcx); | |
1033 pop(rbx); | |
1034 pop(rax); | |
0 | 1035 #endif // ASSERT |
1036 } | |
1037 | |
1038 | |
1039 void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in, int constant, Register value) { | |
304 | 1040 // %%% this seems to be used to store counter data which is surely 32bits |
1041 // however 64bit side stores 64 bits which seems wrong | |
0 | 1042 assert(ProfileInterpreter, "must be profiling interpreter"); |
1043 Address data(mdp_in, constant); | |
304 | 1044 movptr(data, value); |
0 | 1045 } |
1046 | |
1047 | |
1048 void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, | |
1049 int constant, | |
1050 bool decrement) { | |
1051 // Counter address | |
1052 Address data(mdp_in, constant); | |
1053 | |
1054 increment_mdp_data_at(data, decrement); | |
1055 } | |
1056 | |
1057 | |
1058 void InterpreterMacroAssembler::increment_mdp_data_at(Address data, | |
1059 bool decrement) { | |
1060 | |
1061 assert( DataLayout::counter_increment==1, "flow-free idiom only works with 1" ); | |
1062 assert(ProfileInterpreter, "must be profiling interpreter"); | |
1063 | |
304 | 1064 // %%% 64bit treats this as 64 bit which seems unlikely |
0 | 1065 if (decrement) { |
1066 // Decrement the register. Set condition codes. | |
1067 addl(data, -DataLayout::counter_increment); | |
1068 // If the decrement causes the counter to overflow, stay negative | |
1069 Label L; | |
1070 jcc(Assembler::negative, L); | |
1071 addl(data, DataLayout::counter_increment); | |
1072 bind(L); | |
1073 } else { | |
1074 assert(DataLayout::counter_increment == 1, | |
1075 "flow-free idiom only works with 1"); | |
1076 // Increment the register. Set carry flag. | |
1077 addl(data, DataLayout::counter_increment); | |
1078 // If the increment causes the counter to overflow, pull back by 1. | |
1079 sbbl(data, 0); | |
1080 } | |
1081 } | |
1082 | |
1083 | |
1084 void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, | |
1085 Register reg, | |
1086 int constant, | |
1087 bool decrement) { | |
1088 Address data(mdp_in, reg, Address::times_1, constant); | |
1089 | |
1090 increment_mdp_data_at(data, decrement); | |
1091 } | |
1092 | |
1093 | |
1094 void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in, int flag_byte_constant) { | |
1095 assert(ProfileInterpreter, "must be profiling interpreter"); | |
1096 int header_offset = in_bytes(DataLayout::header_offset()); | |
1097 int header_bits = DataLayout::flag_mask_to_header_mask(flag_byte_constant); | |
1098 // Set the flag | |
1099 orl(Address(mdp_in, header_offset), header_bits); | |
1100 } | |
1101 | |
1102 | |
1103 | |
1104 void InterpreterMacroAssembler::test_mdp_data_at(Register mdp_in, | |
1105 int offset, | |
1106 Register value, | |
1107 Register test_value_out, | |
1108 Label& not_equal_continue) { | |
1109 assert(ProfileInterpreter, "must be profiling interpreter"); | |
1110 if (test_value_out == noreg) { | |
304 | 1111 cmpptr(value, Address(mdp_in, offset)); |
0 | 1112 } else { |
1113 // Put the test value into a register, so caller can use it: | |
304 | 1114 movptr(test_value_out, Address(mdp_in, offset)); |
1115 cmpptr(test_value_out, value); | |
0 | 1116 } |
1117 jcc(Assembler::notEqual, not_equal_continue); | |
1118 } | |
1119 | |
1120 | |
1121 void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, int offset_of_disp) { | |
1122 assert(ProfileInterpreter, "must be profiling interpreter"); | |
1123 Address disp_address(mdp_in, offset_of_disp); | |
304 | 1124 addptr(mdp_in,disp_address); |
1125 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); | |
0 | 1126 } |
1127 | |
1128 | |
1129 void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp) { | |
1130 assert(ProfileInterpreter, "must be profiling interpreter"); | |
1131 Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp); | |
304 | 1132 addptr(mdp_in, disp_address); |
1133 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); | |
0 | 1134 } |
1135 | |
1136 | |
1137 void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) { | |
1138 assert(ProfileInterpreter, "must be profiling interpreter"); | |
304 | 1139 addptr(mdp_in, constant); |
1140 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); | |
0 | 1141 } |
1142 | |
1143 | |
1144 void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) { | |
1145 assert(ProfileInterpreter, "must be profiling interpreter"); | |
304 | 1146 push(return_bci); // save/restore across call_VM |
0 | 1147 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), return_bci); |
304 | 1148 pop(return_bci); |
0 | 1149 } |
1150 | |
1151 | |
1152 void InterpreterMacroAssembler::profile_taken_branch(Register mdp, Register bumped_count) { | |
1153 if (ProfileInterpreter) { | |
1154 Label profile_continue; | |
1155 | |
1156 // If no method data exists, go to profile_continue. | |
1157 // Otherwise, assign to mdp | |
1158 test_method_data_pointer(mdp, profile_continue); | |
1159 | |
1160 // We are taking a branch. Increment the taken count. | |
1161 // We inline increment_mdp_data_at to return bumped_count in a register | |
1162 //increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset())); | |
1163 Address data(mdp, in_bytes(JumpData::taken_offset())); | |
304 | 1164 |
1165 // %%% 64bit treats these cells as 64 bit but they seem to be 32 bit | |
0 | 1166 movl(bumped_count,data); |
1167 assert( DataLayout::counter_increment==1, "flow-free idiom only works with 1" ); | |
1168 addl(bumped_count, DataLayout::counter_increment); | |
1169 sbbl(bumped_count, 0); | |
1170 movl(data,bumped_count); // Store back out | |
1171 | |
1172 // The method data pointer needs to be updated to reflect the new target. | |
1173 update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset())); | |
1174 bind (profile_continue); | |
1175 } | |
1176 } | |
1177 | |
1178 | |
1179 void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) { | |
1180 if (ProfileInterpreter) { | |
1181 Label profile_continue; | |
1182 | |
1183 // If no method data exists, go to profile_continue. | |
1184 test_method_data_pointer(mdp, profile_continue); | |
1185 | |
1186 // We are taking a branch. Increment the not taken count. | |
1187 increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset())); | |
1188 | |
1189 // The method data pointer needs to be updated to correspond to the next bytecode | |
1190 update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); | |
1191 bind (profile_continue); | |
1192 } | |
1193 } | |
1194 | |
1195 | |
1196 void InterpreterMacroAssembler::profile_call(Register mdp) { | |
1197 if (ProfileInterpreter) { | |
1198 Label profile_continue; | |
1199 | |
1200 // If no method data exists, go to profile_continue. | |
1201 test_method_data_pointer(mdp, profile_continue); | |
1202 | |
1203 // We are making a call. Increment the count. | |
1204 increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); | |
1205 | |
1206 // The method data pointer needs to be updated to reflect the new target. | |
1207 update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size())); | |
1208 bind (profile_continue); | |
1209 } | |
1210 } | |
1211 | |
1212 | |
1213 void InterpreterMacroAssembler::profile_final_call(Register mdp) { | |
1214 if (ProfileInterpreter) { | |
1215 Label profile_continue; | |
1216 | |
1217 // If no method data exists, go to profile_continue. | |
1218 test_method_data_pointer(mdp, profile_continue); | |
1219 | |
1220 // We are making a call. Increment the count. | |
1221 increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); | |
1222 | |
1223 // The method data pointer needs to be updated to reflect the new target. | |
1224 update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size())); | |
1225 bind (profile_continue); | |
1226 } | |
1227 } | |
1228 | |
1229 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1230 void InterpreterMacroAssembler::profile_virtual_call(Register receiver, Register mdp, |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1231 Register reg2, |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1232 bool receiver_can_be_null) { |
0 | 1233 if (ProfileInterpreter) { |
1234 Label profile_continue; | |
1235 | |
1236 // If no method data exists, go to profile_continue. | |
1237 test_method_data_pointer(mdp, profile_continue); | |
1238 | |
1239 // We are making a call. Increment the count. | |
1240 increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); | |
1241 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1242 Label skip_receiver_profile; |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1243 if (receiver_can_be_null) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1244 testptr(receiver, receiver); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1245 jcc(Assembler::zero, skip_receiver_profile); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1246 } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1247 |
0 | 1248 // Record the receiver type. |
1249 record_klass_in_profile(receiver, mdp, reg2); | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1250 bind(skip_receiver_profile); |
0 | 1251 |
1252 // The method data pointer needs to be updated to reflect the new target. | |
1253 update_mdp_by_constant(mdp, | |
1254 in_bytes(VirtualCallData:: | |
1255 virtual_call_data_size())); | |
1256 bind(profile_continue); | |
1257 } | |
1258 } | |
1259 | |
1260 | |
1261 void InterpreterMacroAssembler::record_klass_in_profile_helper( | |
1262 Register receiver, Register mdp, | |
1263 Register reg2, | |
1264 int start_row, Label& done) { | |
1265 int last_row = VirtualCallData::row_limit() - 1; | |
1266 assert(start_row <= last_row, "must be work left to do"); | |
1267 // Test this row for both the receiver and for null. | |
1268 // Take any of three different outcomes: | |
1269 // 1. found receiver => increment count and goto done | |
1270 // 2. found null => keep looking for case 1, maybe allocate this cell | |
1271 // 3. found something else => keep looking for cases 1 and 2 | |
1272 // Case 3 is handled by a recursive call. | |
1273 for (int row = start_row; row <= last_row; row++) { | |
1274 Label next_test; | |
1275 bool test_for_null_also = (row == start_row); | |
1276 | |
1277 // See if the receiver is receiver[n]. | |
1278 int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row)); | |
1279 test_mdp_data_at(mdp, recvr_offset, receiver, | |
1280 (test_for_null_also ? reg2 : noreg), | |
1281 next_test); | |
1282 // (Reg2 now contains the receiver from the CallData.) | |
1283 | |
1284 // The receiver is receiver[n]. Increment count[n]. | |
1285 int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row)); | |
1286 increment_mdp_data_at(mdp, count_offset); | |
1287 jmp(done); | |
1288 bind(next_test); | |
1289 | |
1290 if (row == start_row) { | |
1291 // Failed the equality check on receiver[n]... Test for null. | |
304 | 1292 testptr(reg2, reg2); |
0 | 1293 if (start_row == last_row) { |
1294 // The only thing left to do is handle the null case. | |
1295 jcc(Assembler::notZero, done); | |
1296 break; | |
1297 } | |
1298 // Since null is rare, make it be the branch-taken case. | |
1299 Label found_null; | |
1300 jcc(Assembler::zero, found_null); | |
1301 | |
1302 // Put all the "Case 3" tests here. | |
1303 record_klass_in_profile_helper(receiver, mdp, reg2, start_row + 1, done); | |
1304 | |
1305 // Found a null. Keep searching for a matching receiver, | |
1306 // but remember that this is an empty (unused) slot. | |
1307 bind(found_null); | |
1308 } | |
1309 } | |
1310 | |
1311 // In the fall-through case, we found no matching receiver, but we | |
1312 // observed the receiver[start_row] is NULL. | |
1313 | |
1314 // Fill in the receiver field and increment the count. | |
1315 int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row)); | |
1316 set_mdp_data_at(mdp, recvr_offset, receiver); | |
1317 int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); | |
304 | 1318 movptr(reg2, (int32_t)DataLayout::counter_increment); |
0 | 1319 set_mdp_data_at(mdp, count_offset, reg2); |
1320 jmp(done); | |
1321 } | |
1322 | |
1323 void InterpreterMacroAssembler::record_klass_in_profile(Register receiver, | |
1324 Register mdp, | |
1325 Register reg2) { | |
1326 assert(ProfileInterpreter, "must be profiling"); | |
1327 Label done; | |
1328 | |
1329 record_klass_in_profile_helper(receiver, mdp, reg2, 0, done); | |
1330 | |
1331 bind (done); | |
1332 } | |
1333 | |
1334 void InterpreterMacroAssembler::profile_ret(Register return_bci, Register mdp) { | |
1335 if (ProfileInterpreter) { | |
1336 Label profile_continue; | |
1337 uint row; | |
1338 | |
1339 // If no method data exists, go to profile_continue. | |
1340 test_method_data_pointer(mdp, profile_continue); | |
1341 | |
1342 // Update the total ret count. | |
1343 increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); | |
1344 | |
1345 for (row = 0; row < RetData::row_limit(); row++) { | |
1346 Label next_test; | |
1347 | |
1348 // See if return_bci is equal to bci[n]: | |
1349 test_mdp_data_at(mdp, in_bytes(RetData::bci_offset(row)), return_bci, | |
1350 noreg, next_test); | |
1351 | |
1352 // return_bci is equal to bci[n]. Increment the count. | |
1353 increment_mdp_data_at(mdp, in_bytes(RetData::bci_count_offset(row))); | |
1354 | |
1355 // The method data pointer needs to be updated to reflect the new target. | |
1356 update_mdp_by_offset(mdp, in_bytes(RetData::bci_displacement_offset(row))); | |
1357 jmp(profile_continue); | |
1358 bind(next_test); | |
1359 } | |
1360 | |
1361 update_mdp_for_ret(return_bci); | |
1362 | |
1363 bind (profile_continue); | |
1364 } | |
1365 } | |
1366 | |
1367 | |
1368 void InterpreterMacroAssembler::profile_null_seen(Register mdp) { | |
1369 if (ProfileInterpreter) { | |
1370 Label profile_continue; | |
1371 | |
1372 // If no method data exists, go to profile_continue. | |
1373 test_method_data_pointer(mdp, profile_continue); | |
1374 | |
1375 // The method data pointer needs to be updated. | |
1376 int mdp_delta = in_bytes(BitData::bit_data_size()); | |
1377 if (TypeProfileCasts) { | |
1378 mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); | |
1379 } | |
1380 update_mdp_by_constant(mdp, mdp_delta); | |
1381 | |
1382 bind (profile_continue); | |
1383 } | |
1384 } | |
1385 | |
1386 | |
1387 void InterpreterMacroAssembler::profile_typecheck_failed(Register mdp) { | |
1388 if (ProfileInterpreter && TypeProfileCasts) { | |
1389 Label profile_continue; | |
1390 | |
1391 // If no method data exists, go to profile_continue. | |
1392 test_method_data_pointer(mdp, profile_continue); | |
1393 | |
1394 int count_offset = in_bytes(CounterData::count_offset()); | |
1395 // Back up the address, since we have already bumped the mdp. | |
1396 count_offset -= in_bytes(VirtualCallData::virtual_call_data_size()); | |
1397 | |
1398 // *Decrement* the counter. We expect to see zero or small negatives. | |
1399 increment_mdp_data_at(mdp, count_offset, true); | |
1400 | |
1401 bind (profile_continue); | |
1402 } | |
1403 } | |
1404 | |
1405 | |
1406 void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, Register reg2) | |
1407 { | |
1408 if (ProfileInterpreter) { | |
1409 Label profile_continue; | |
1410 | |
1411 // If no method data exists, go to profile_continue. | |
1412 test_method_data_pointer(mdp, profile_continue); | |
1413 | |
1414 // The method data pointer needs to be updated. | |
1415 int mdp_delta = in_bytes(BitData::bit_data_size()); | |
1416 if (TypeProfileCasts) { | |
1417 mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); | |
1418 | |
1419 // Record the object type. | |
1420 record_klass_in_profile(klass, mdp, reg2); | |
1421 assert(reg2 == rdi, "we know how to fix this blown reg"); | |
1422 restore_locals(); // Restore EDI | |
1423 } | |
1424 update_mdp_by_constant(mdp, mdp_delta); | |
1425 | |
1426 bind(profile_continue); | |
1427 } | |
1428 } | |
1429 | |
1430 | |
1431 void InterpreterMacroAssembler::profile_switch_default(Register mdp) { | |
1432 if (ProfileInterpreter) { | |
1433 Label profile_continue; | |
1434 | |
1435 // If no method data exists, go to profile_continue. | |
1436 test_method_data_pointer(mdp, profile_continue); | |
1437 | |
1438 // Update the default case count | |
1439 increment_mdp_data_at(mdp, in_bytes(MultiBranchData::default_count_offset())); | |
1440 | |
1441 // The method data pointer needs to be updated. | |
1442 update_mdp_by_offset(mdp, in_bytes(MultiBranchData::default_displacement_offset())); | |
1443 | |
1444 bind (profile_continue); | |
1445 } | |
1446 } | |
1447 | |
1448 | |
1449 void InterpreterMacroAssembler::profile_switch_case(Register index, Register mdp, Register reg2) { | |
1450 if (ProfileInterpreter) { | |
1451 Label profile_continue; | |
1452 | |
1453 // If no method data exists, go to profile_continue. | |
1454 test_method_data_pointer(mdp, profile_continue); | |
1455 | |
1456 // Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes() | |
304 | 1457 movptr(reg2, (int32_t)in_bytes(MultiBranchData::per_case_size())); |
1458 // index is positive and so should have correct value if this code were | |
1459 // used on 64bits | |
1460 imulptr(index, reg2); | |
1461 addptr(index, in_bytes(MultiBranchData::case_array_offset())); | |
0 | 1462 |
1463 // Update the case count | |
1464 increment_mdp_data_at(mdp, index, in_bytes(MultiBranchData::relative_count_offset())); | |
1465 | |
1466 // The method data pointer needs to be updated. | |
1467 update_mdp_by_offset(mdp, index, in_bytes(MultiBranchData::relative_displacement_offset())); | |
1468 | |
1469 bind (profile_continue); | |
1470 } | |
1471 } | |
1472 | |
1473 #endif // !CC_INTERP | |
1474 | |
1475 | |
1476 | |
1477 void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) { | |
1478 if (state == atos) MacroAssembler::verify_oop(reg); | |
1479 } | |
1480 | |
1481 | |
1482 #ifndef CC_INTERP | |
1483 void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) { | |
1484 if (state == ftos || state == dtos) MacroAssembler::verify_FPU(stack_depth); | |
1485 } | |
1486 | |
1487 #endif /* CC_INTERP */ | |
1488 | |
1489 | |
1490 void InterpreterMacroAssembler::notify_method_entry() { | |
1491 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to | |
1492 // track stack depth. If it is possible to enter interp_only_mode we add | |
1493 // the code to check if the event should be sent. | |
1494 if (JvmtiExport::can_post_interpreter_events()) { | |
1495 Label L; | |
1496 get_thread(rcx); | |
1497 movl(rcx, Address(rcx, JavaThread::interp_only_mode_offset())); | |
1498 testl(rcx,rcx); | |
1499 jcc(Assembler::zero, L); | |
1500 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry)); | |
1501 bind(L); | |
1502 } | |
1503 | |
1504 { | |
1505 SkipIfEqual skip_if(this, &DTraceMethodProbes, 0); | |
1506 get_thread(rcx); | |
1507 get_method(rbx); | |
1508 call_VM_leaf( | |
1509 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), rcx, rbx); | |
1510 } | |
610
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1511 |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1512 // RedefineClasses() tracing support for obsolete method entry |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1513 if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1514 get_thread(rcx); |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1515 get_method(rbx); |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1516 call_VM_leaf( |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1517 CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1518 rcx, rbx); |
70998f2e05ef
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
337
diff
changeset
|
1519 } |
0 | 1520 } |
1521 | |
1522 | |
1523 void InterpreterMacroAssembler::notify_method_exit( | |
1524 TosState state, NotifyMethodExitMode mode) { | |
1525 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to | |
1526 // track stack depth. If it is possible to enter interp_only_mode we add | |
1527 // the code to check if the event should be sent. | |
1528 if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) { | |
1529 Label L; | |
1530 // Note: frame::interpreter_frame_result has a dependency on how the | |
1531 // method result is saved across the call to post_method_exit. If this | |
1532 // is changed then the interpreter_frame_result implementation will | |
1533 // need to be updated too. | |
1534 | |
1535 // For c++ interpreter the result is always stored at a known location in the frame | |
1536 // template interpreter will leave it on the top of the stack. | |
1537 NOT_CC_INTERP(push(state);) | |
1538 get_thread(rcx); | |
1539 movl(rcx, Address(rcx, JavaThread::interp_only_mode_offset())); | |
1540 testl(rcx,rcx); | |
1541 jcc(Assembler::zero, L); | |
1542 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit)); | |
1543 bind(L); | |
1544 NOT_CC_INTERP(pop(state);) | |
1545 } | |
1546 | |
1547 { | |
1548 SkipIfEqual skip_if(this, &DTraceMethodProbes, 0); | |
304 | 1549 NOT_CC_INTERP(push(state)); |
0 | 1550 get_thread(rbx); |
1551 get_method(rcx); | |
1552 call_VM_leaf( | |
1553 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), | |
1554 rbx, rcx); | |
304 | 1555 NOT_CC_INTERP(pop(state)); |
0 | 1556 } |
1557 } |