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