author | trims |
Thu, 27 May 2010 19:08:38 -0700 | |
changeset 5547 | f4b087cbb361 |
parent 5419 | f2e8cc8c12ea |
child 5702 | 201c5cde25bb |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
2 |
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
21 |
* questions. |
1 | 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) { |
|
1066 | 32 |
movptr(reg, Address(rbp, -(sizeof(BytecodeInterpreter) + 2 * wordSize))); |
33 |
movptr(reg, Address(reg, byte_offset_of(BytecodeInterpreter, _method))); |
|
1 | 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; |
|
1066 | 56 |
cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); |
1 | 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; |
|
1066 | 82 |
cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); |
1 | 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) { |
|
1066 | 135 |
case atos: movptr(rax, oop_addr); |
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1217
diff
changeset
|
136 |
movptr(oop_addr, NULL_WORD); |
1 | 137 |
verify_oop(rax, state); break; |
1066 | 138 |
case ltos: |
139 |
movl(rdx, val_addr1); // fall through |
|
1 | 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 |
|
1066 | 150 |
movl(tos_addr, (int32_t) ilgl); |
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1217
diff
changeset
|
151 |
movptr(val_addr, NULL_WORD); |
1909
952b42dad1fc
6795913: A few remaining wrong casts need to be fixed for building hotspot successfully on Mac OS.
xlu
parents:
1888
diff
changeset
|
152 |
NOT_LP64(movptr(val_addr1, NULL_WORD)); |
1 | 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; |
|
1066 | 160 |
movptr(tmp, Address(tmp, JavaThread::jvmti_thread_state_offset())); |
161 |
testptr(tmp, tmp); |
|
1 | 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); |
|
1066 | 174 |
movptr(tmp, Address(java_thread, JavaThread::jvmti_thread_state_offset())); |
1 | 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)); |
|
1066 | 187 |
bswapl(reg); |
1 | 188 |
shrl(reg, 16); |
189 |
} |
|
190 |
||
191 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
192 |
void InterpreterMacroAssembler::get_cache_index_at_bcp(Register reg, int bcp_offset, bool giant_index) { |
1 | 193 |
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
194 |
if (!giant_index) { |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
195 |
load_unsigned_short(reg, Address(rsi, bcp_offset)); |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
196 |
} else { |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
197 |
assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
198 |
movl(reg, Address(rsi, bcp_offset)); |
4478 | 199 |
// Check if the secondary index definition is still ~x, otherwise |
200 |
// we have to change the following assembler code to calculate the |
|
201 |
// plain index. |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
202 |
assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
203 |
notl(reg); // convert to plain index |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
204 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
205 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
206 |
|
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
207 |
|
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
208 |
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, Register index, |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
209 |
int bcp_offset, bool giant_index) { |
1 | 210 |
assert(cache != index, "must use different registers"); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
211 |
get_cache_index_at_bcp(index, bcp_offset, giant_index); |
1066 | 212 |
movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
1 | 213 |
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below"); |
1066 | 214 |
shlptr(index, 2); // convert from field index to ConstantPoolCacheEntry index |
1 | 215 |
} |
216 |
||
217 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
218 |
void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, Register tmp, |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
219 |
int bcp_offset, bool giant_index) { |
1 | 220 |
assert(cache != tmp, "must use different register"); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
221 |
get_cache_index_at_bcp(tmp, bcp_offset, giant_index); |
1 | 222 |
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below"); |
223 |
// convert from field index to ConstantPoolCacheEntry index |
|
224 |
// and from word offset to byte offset |
|
225 |
shll(tmp, 2 + LogBytesPerWord); |
|
1066 | 226 |
movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
1 | 227 |
// skip past the header |
1066 | 228 |
addptr(cache, in_bytes(constantPoolCacheOopDesc::base_offset())); |
229 |
addptr(cache, tmp); // construct pointer to cache entry |
|
1 | 230 |
} |
231 |
||
232 |
||
233 |
// Generate a subtype check: branch to ok_is_subtype if sub_klass is |
|
234 |
// a subtype of super_klass. EAX holds the super_klass. Blows ECX. |
|
235 |
// Resets EDI to locals. Register sub_klass cannot be any of the above. |
|
236 |
void InterpreterMacroAssembler::gen_subtype_check( Register Rsub_klass, Label &ok_is_subtype ) { |
|
237 |
assert( Rsub_klass != rax, "rax, holds superklass" ); |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
2151
diff
changeset
|
238 |
assert( Rsub_klass != rcx, "used as a temp" ); |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
2151
diff
changeset
|
239 |
assert( Rsub_klass != rdi, "used as a temp, restored from locals" ); |
1 | 240 |
|
241 |
// Profile the not-null value's klass. |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
2151
diff
changeset
|
242 |
profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi |
1 | 243 |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
2151
diff
changeset
|
244 |
// Do the check. |
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
2151
diff
changeset
|
245 |
check_klass_subtype(Rsub_klass, rax, rcx, ok_is_subtype); // blows rcx |
1 | 246 |
|
2256
82d4e10b7c6b
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
2151
diff
changeset
|
247 |
// Profile the failure of the check. |
1 | 248 |
profile_typecheck_failed(rcx); // blows rcx |
249 |
} |
|
250 |
||
251 |
void InterpreterMacroAssembler::f2ieee() { |
|
252 |
if (IEEEPrecision) { |
|
253 |
fstp_s(Address(rsp, 0)); |
|
254 |
fld_s(Address(rsp, 0)); |
|
255 |
} |
|
256 |
} |
|
257 |
||
258 |
||
259 |
void InterpreterMacroAssembler::d2ieee() { |
|
260 |
if (IEEEPrecision) { |
|
261 |
fstp_d(Address(rsp, 0)); |
|
262 |
fld_d(Address(rsp, 0)); |
|
263 |
} |
|
264 |
} |
|
265 |
||
266 |
// Java Expression Stack |
|
267 |
||
268 |
void InterpreterMacroAssembler::pop_ptr(Register r) { |
|
1066 | 269 |
pop(r); |
1 | 270 |
} |
271 |
||
272 |
void InterpreterMacroAssembler::pop_i(Register r) { |
|
1066 | 273 |
pop(r); |
1 | 274 |
} |
275 |
||
276 |
void InterpreterMacroAssembler::pop_l(Register lo, Register hi) { |
|
1066 | 277 |
pop(lo); |
278 |
pop(hi); |
|
1 | 279 |
} |
280 |
||
281 |
void InterpreterMacroAssembler::pop_f() { |
|
282 |
fld_s(Address(rsp, 0)); |
|
1066 | 283 |
addptr(rsp, 1 * wordSize); |
1 | 284 |
} |
285 |
||
286 |
void InterpreterMacroAssembler::pop_d() { |
|
287 |
fld_d(Address(rsp, 0)); |
|
1066 | 288 |
addptr(rsp, 2 * wordSize); |
1 | 289 |
} |
290 |
||
291 |
||
292 |
void InterpreterMacroAssembler::pop(TosState state) { |
|
293 |
switch (state) { |
|
294 |
case atos: pop_ptr(rax); break; |
|
295 |
case btos: // fall through |
|
296 |
case ctos: // fall through |
|
297 |
case stos: // fall through |
|
298 |
case itos: pop_i(rax); break; |
|
299 |
case ltos: pop_l(rax, rdx); break; |
|
300 |
case ftos: pop_f(); break; |
|
301 |
case dtos: pop_d(); break; |
|
302 |
case vtos: /* nothing to do */ break; |
|
303 |
default : ShouldNotReachHere(); |
|
304 |
} |
|
305 |
verify_oop(rax, state); |
|
306 |
} |
|
307 |
||
308 |
void InterpreterMacroAssembler::push_ptr(Register r) { |
|
1066 | 309 |
push(r); |
1 | 310 |
} |
311 |
||
312 |
void InterpreterMacroAssembler::push_i(Register r) { |
|
1066 | 313 |
push(r); |
1 | 314 |
} |
315 |
||
316 |
void InterpreterMacroAssembler::push_l(Register lo, Register hi) { |
|
1066 | 317 |
push(hi); |
318 |
push(lo); |
|
1 | 319 |
} |
320 |
||
321 |
void InterpreterMacroAssembler::push_f() { |
|
322 |
// Do not schedule for no AGI! Never write beyond rsp! |
|
1066 | 323 |
subptr(rsp, 1 * wordSize); |
1 | 324 |
fstp_s(Address(rsp, 0)); |
325 |
} |
|
326 |
||
327 |
void InterpreterMacroAssembler::push_d(Register r) { |
|
5419 | 328 |
// Do not schedule for no AGI! Never write beyond rsp! |
329 |
subptr(rsp, 2 * wordSize); |
|
330 |
fstp_d(Address(rsp, 0)); |
|
1 | 331 |
} |
332 |
||
333 |
||
334 |
void InterpreterMacroAssembler::push(TosState state) { |
|
335 |
verify_oop(rax, state); |
|
336 |
switch (state) { |
|
337 |
case atos: push_ptr(rax); break; |
|
338 |
case btos: // fall through |
|
339 |
case ctos: // fall through |
|
340 |
case stos: // fall through |
|
341 |
case itos: push_i(rax); break; |
|
342 |
case ltos: push_l(rax, rdx); break; |
|
343 |
case ftos: push_f(); break; |
|
344 |
case dtos: push_d(rax); break; |
|
345 |
case vtos: /* nothing to do */ break; |
|
346 |
default : ShouldNotReachHere(); |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
||
5419 | 351 |
// Helpers for swap and dup |
352 |
void InterpreterMacroAssembler::load_ptr(int n, Register val) { |
|
1066 | 353 |
movptr(val, Address(rsp, Interpreter::expr_offset_in_bytes(n))); |
1 | 354 |
} |
355 |
||
5419 | 356 |
void InterpreterMacroAssembler::store_ptr(int n, Register val) { |
357 |
movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val); |
|
1 | 358 |
} |
359 |
||
360 |
void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point) { |
|
361 |
MacroAssembler::call_VM_leaf_base(entry_point, 0); |
|
362 |
} |
|
363 |
||
364 |
||
365 |
void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1) { |
|
1066 | 366 |
push(arg_1); |
1 | 367 |
MacroAssembler::call_VM_leaf_base(entry_point, 1); |
368 |
} |
|
369 |
||
370 |
||
371 |
void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2) { |
|
1066 | 372 |
push(arg_2); |
373 |
push(arg_1); |
|
1 | 374 |
MacroAssembler::call_VM_leaf_base(entry_point, 2); |
375 |
} |
|
376 |
||
377 |
||
378 |
void InterpreterMacroAssembler::super_call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3) { |
|
1066 | 379 |
push(arg_3); |
380 |
push(arg_2); |
|
381 |
push(arg_1); |
|
1 | 382 |
MacroAssembler::call_VM_leaf_base(entry_point, 3); |
383 |
} |
|
384 |
||
385 |
||
2534 | 386 |
void InterpreterMacroAssembler::prepare_to_jump_from_interpreted() { |
1 | 387 |
// set sender sp |
1066 | 388 |
lea(rsi, Address(rsp, wordSize)); |
1 | 389 |
// record last_sp |
1066 | 390 |
movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), rsi); |
2534 | 391 |
} |
392 |
||
393 |
||
394 |
// Jump to from_interpreted entry of a call unless single stepping is possible |
|
395 |
// in this thread in which case we must call the i2i entry |
|
396 |
void InterpreterMacroAssembler::jump_from_interpreted(Register method, Register temp) { |
|
397 |
prepare_to_jump_from_interpreted(); |
|
1 | 398 |
|
399 |
if (JvmtiExport::can_post_interpreter_events()) { |
|
400 |
Label run_compiled_code; |
|
401 |
// JVMTI events, such as single-stepping, are implemented partly by avoiding running |
|
402 |
// compiled code in threads for which the event is enabled. Check here for |
|
403 |
// interp_only_mode if these events CAN be enabled. |
|
404 |
get_thread(temp); |
|
405 |
// interp_only is an int, on little endian it is sufficient to test the byte only |
|
406 |
// Is a cmpl faster (ce |
|
407 |
cmpb(Address(temp, JavaThread::interp_only_mode_offset()), 0); |
|
408 |
jcc(Assembler::zero, run_compiled_code); |
|
409 |
jmp(Address(method, methodOopDesc::interpreter_entry_offset())); |
|
410 |
bind(run_compiled_code); |
|
411 |
} |
|
412 |
||
413 |
jmp(Address(method, methodOopDesc::from_interpreted_offset())); |
|
414 |
||
415 |
} |
|
416 |
||
417 |
||
418 |
// The following two routines provide a hook so that an implementation |
|
419 |
// can schedule the dispatch in two parts. Intel does not do this. |
|
420 |
void InterpreterMacroAssembler::dispatch_prolog(TosState state, int step) { |
|
421 |
// Nothing Intel-specific to be done here. |
|
422 |
} |
|
423 |
||
424 |
void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) { |
|
425 |
dispatch_next(state, step); |
|
426 |
} |
|
427 |
||
428 |
void InterpreterMacroAssembler::dispatch_base(TosState state, address* table, |
|
429 |
bool verifyoop) { |
|
430 |
verify_FPU(1, state); |
|
431 |
if (VerifyActivationFrameSize) { |
|
432 |
Label L; |
|
1066 | 433 |
mov(rcx, rbp); |
434 |
subptr(rcx, rsp); |
|
1 | 435 |
int min_frame_size = (frame::link_offset - frame::interpreter_frame_initial_sp_offset) * wordSize; |
1066 | 436 |
cmpptr(rcx, min_frame_size); |
1 | 437 |
jcc(Assembler::greaterEqual, L); |
438 |
stop("broken stack frame"); |
|
439 |
bind(L); |
|
440 |
} |
|
441 |
if (verifyoop) verify_oop(rax, state); |
|
1066 | 442 |
Address index(noreg, rbx, Address::times_ptr); |
1 | 443 |
ExternalAddress tbl((address)table); |
444 |
ArrayAddress dispatch(tbl, index); |
|
445 |
jump(dispatch); |
|
446 |
} |
|
447 |
||
448 |
||
449 |
void InterpreterMacroAssembler::dispatch_only(TosState state) { |
|
450 |
dispatch_base(state, Interpreter::dispatch_table(state)); |
|
451 |
} |
|
452 |
||
453 |
||
454 |
void InterpreterMacroAssembler::dispatch_only_normal(TosState state) { |
|
455 |
dispatch_base(state, Interpreter::normal_table(state)); |
|
456 |
} |
|
457 |
||
458 |
void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) { |
|
459 |
dispatch_base(state, Interpreter::normal_table(state), false); |
|
460 |
} |
|
461 |
||
462 |
||
463 |
void InterpreterMacroAssembler::dispatch_next(TosState state, int step) { |
|
464 |
// load next bytecode (load before advancing rsi to prevent AGI) |
|
465 |
load_unsigned_byte(rbx, Address(rsi, step)); |
|
466 |
// advance rsi |
|
467 |
increment(rsi, step); |
|
468 |
dispatch_base(state, Interpreter::dispatch_table(state)); |
|
469 |
} |
|
470 |
||
471 |
||
472 |
void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) { |
|
473 |
// load current bytecode |
|
474 |
load_unsigned_byte(rbx, Address(rsi, 0)); |
|
475 |
dispatch_base(state, table); |
|
476 |
} |
|
477 |
||
478 |
// remove activation |
|
479 |
// |
|
480 |
// Unlock the receiver if this is a synchronized method. |
|
481 |
// Unlock any Java monitors from syncronized blocks. |
|
482 |
// Remove the activation from the stack. |
|
483 |
// |
|
484 |
// If there are locked Java monitors |
|
485 |
// If throw_monitor_exception |
|
486 |
// throws IllegalMonitorStateException |
|
487 |
// Else if install_monitor_exception |
|
488 |
// installs IllegalMonitorStateException |
|
489 |
// Else |
|
490 |
// no error processing |
|
491 |
void InterpreterMacroAssembler::remove_activation(TosState state, Register ret_addr, |
|
492 |
bool throw_monitor_exception, |
|
493 |
bool install_monitor_exception, |
|
494 |
bool notify_jvmdi) { |
|
495 |
// Note: Registers rax, rdx and FPU ST(0) may be in use for the result |
|
496 |
// check if synchronized method |
|
497 |
Label unlocked, unlock, no_unlock; |
|
498 |
||
499 |
get_thread(rcx); |
|
500 |
const Address do_not_unlock_if_synchronized(rcx, |
|
501 |
in_bytes(JavaThread::do_not_unlock_if_synchronized_offset())); |
|
502 |
||
503 |
movbool(rbx, do_not_unlock_if_synchronized); |
|
1066 | 504 |
mov(rdi,rbx); |
1 | 505 |
movbool(do_not_unlock_if_synchronized, false); // reset the flag |
506 |
||
1066 | 507 |
movptr(rbx, Address(rbp, frame::interpreter_frame_method_offset * wordSize)); // get method access flags |
1 | 508 |
movl(rcx, Address(rbx, methodOopDesc::access_flags_offset())); |
509 |
||
510 |
testl(rcx, JVM_ACC_SYNCHRONIZED); |
|
511 |
jcc(Assembler::zero, unlocked); |
|
512 |
||
513 |
// Don't unlock anything if the _do_not_unlock_if_synchronized flag |
|
514 |
// is set. |
|
1066 | 515 |
mov(rcx,rdi); |
1 | 516 |
testbool(rcx); |
517 |
jcc(Assembler::notZero, no_unlock); |
|
518 |
||
519 |
// unlock monitor |
|
520 |
push(state); // save result |
|
521 |
||
522 |
// BasicObjectLock will be first in list, since this is a synchronized method. However, need |
|
523 |
// to check that the object has not been unlocked by an explicit monitorexit bytecode. |
|
524 |
const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock)); |
|
1066 | 525 |
lea (rdx, monitor); // address of first monitor |
1 | 526 |
|
1066 | 527 |
movptr (rax, Address(rdx, BasicObjectLock::obj_offset_in_bytes())); |
528 |
testptr(rax, rax); |
|
529 |
jcc (Assembler::notZero, unlock); |
|
1 | 530 |
|
531 |
pop(state); |
|
532 |
if (throw_monitor_exception) { |
|
533 |
empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow |
|
534 |
||
535 |
// Entry already unlocked, need to throw exception |
|
536 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); |
|
537 |
should_not_reach_here(); |
|
538 |
} else { |
|
539 |
// Monitor already unlocked during a stack unroll. |
|
540 |
// If requested, install an illegal_monitor_state_exception. |
|
541 |
// Continue with stack unrolling. |
|
542 |
if (install_monitor_exception) { |
|
543 |
empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow |
|
544 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); |
|
545 |
} |
|
546 |
jmp(unlocked); |
|
547 |
} |
|
548 |
||
549 |
bind(unlock); |
|
550 |
unlock_object(rdx); |
|
551 |
pop(state); |
|
552 |
||
553 |
// Check that for block-structured locking (i.e., that all locked objects has been unlocked) |
|
554 |
bind(unlocked); |
|
555 |
||
556 |
// rax, rdx: Might contain return value |
|
557 |
||
558 |
// Check that all monitors are unlocked |
|
559 |
{ |
|
560 |
Label loop, exception, entry, restart; |
|
561 |
const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; |
|
562 |
const Address monitor_block_top(rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize); |
|
563 |
const Address monitor_block_bot(rbp, frame::interpreter_frame_initial_sp_offset * wordSize); |
|
564 |
||
565 |
bind(restart); |
|
1066 | 566 |
movptr(rcx, monitor_block_top); // points to current entry, starting with top-most entry |
567 |
lea(rbx, monitor_block_bot); // points to word before bottom of monitor block |
|
1 | 568 |
jmp(entry); |
569 |
||
570 |
// Entry already locked, need to throw exception |
|
571 |
bind(exception); |
|
572 |
||
573 |
if (throw_monitor_exception) { |
|
574 |
empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow |
|
575 |
||
576 |
// Throw exception |
|
577 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception)); |
|
578 |
should_not_reach_here(); |
|
579 |
} else { |
|
580 |
// Stack unrolling. Unlock object and install illegal_monitor_exception |
|
581 |
// Unlock does not block, so don't have to worry about the frame |
|
582 |
||
583 |
push(state); |
|
1066 | 584 |
mov(rdx, rcx); |
1 | 585 |
unlock_object(rdx); |
586 |
pop(state); |
|
587 |
||
588 |
if (install_monitor_exception) { |
|
589 |
empty_FPU_stack(); // remove possible return value from FPU-stack, otherwise stack could overflow |
|
590 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception)); |
|
591 |
} |
|
592 |
||
593 |
jmp(restart); |
|
594 |
} |
|
595 |
||
596 |
bind(loop); |
|
1066 | 597 |
cmpptr(Address(rcx, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD); // check if current entry is used |
1 | 598 |
jcc(Assembler::notEqual, exception); |
599 |
||
1066 | 600 |
addptr(rcx, entry_size); // otherwise advance to next entry |
1 | 601 |
bind(entry); |
1066 | 602 |
cmpptr(rcx, rbx); // check if bottom reached |
1 | 603 |
jcc(Assembler::notEqual, loop); // if not at bottom then check this entry |
604 |
} |
|
605 |
||
606 |
bind(no_unlock); |
|
607 |
||
608 |
// jvmti support |
|
609 |
if (notify_jvmdi) { |
|
610 |
notify_method_exit(state, NotifyJVMTI); // preserve TOSCA |
|
611 |
} else { |
|
612 |
notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA |
|
613 |
} |
|
614 |
||
615 |
// remove activation |
|
1066 | 616 |
movptr(rbx, Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize)); // get sender sp |
1 | 617 |
leave(); // remove frame anchor |
1066 | 618 |
pop(ret_addr); // get return address |
619 |
mov(rsp, rbx); // set sp to sender sp |
|
1 | 620 |
if (UseSSE) { |
621 |
// float and double are returned in xmm register in SSE-mode |
|
622 |
if (state == ftos && UseSSE >= 1) { |
|
1066 | 623 |
subptr(rsp, wordSize); |
1 | 624 |
fstp_s(Address(rsp, 0)); |
625 |
movflt(xmm0, Address(rsp, 0)); |
|
1066 | 626 |
addptr(rsp, wordSize); |
1 | 627 |
} else if (state == dtos && UseSSE >= 2) { |
1066 | 628 |
subptr(rsp, 2*wordSize); |
1 | 629 |
fstp_d(Address(rsp, 0)); |
630 |
movdbl(xmm0, Address(rsp, 0)); |
|
1066 | 631 |
addptr(rsp, 2*wordSize); |
1 | 632 |
} |
633 |
} |
|
634 |
} |
|
635 |
||
636 |
#endif /* !CC_INTERP */ |
|
637 |
||
638 |
||
639 |
// Lock object |
|
640 |
// |
|
641 |
// Argument: rdx : Points to BasicObjectLock to be used for locking. Must |
|
642 |
// be initialized with object to lock |
|
643 |
void InterpreterMacroAssembler::lock_object(Register lock_reg) { |
|
644 |
assert(lock_reg == rdx, "The argument is only for looks. It must be rdx"); |
|
645 |
||
646 |
if (UseHeavyMonitors) { |
|
647 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), lock_reg); |
|
648 |
} else { |
|
649 |
||
650 |
Label done; |
|
651 |
||
652 |
const Register swap_reg = rax; // Must use rax, for cmpxchg instruction |
|
653 |
const Register obj_reg = rcx; // Will contain the oop |
|
654 |
||
655 |
const int obj_offset = BasicObjectLock::obj_offset_in_bytes(); |
|
656 |
const int lock_offset = BasicObjectLock::lock_offset_in_bytes (); |
|
657 |
const int mark_offset = lock_offset + BasicLock::displaced_header_offset_in_bytes(); |
|
658 |
||
659 |
Label slow_case; |
|
660 |
||
661 |
// Load object pointer into obj_reg %rcx |
|
1066 | 662 |
movptr(obj_reg, Address(lock_reg, obj_offset)); |
1 | 663 |
|
664 |
if (UseBiasedLocking) { |
|
665 |
// Note: we use noreg for the temporary register since it's hard |
|
666 |
// to come up with a free register on all incoming code paths |
|
667 |
biased_locking_enter(lock_reg, obj_reg, swap_reg, noreg, false, done, &slow_case); |
|
668 |
} |
|
669 |
||
670 |
// Load immediate 1 into swap_reg %rax, |
|
1066 | 671 |
movptr(swap_reg, (int32_t)1); |
1 | 672 |
|
673 |
// Load (object->mark() | 1) into swap_reg %rax, |
|
1066 | 674 |
orptr(swap_reg, Address(obj_reg, 0)); |
1 | 675 |
|
676 |
// Save (object->mark() | 1) into BasicLock's displaced header |
|
1066 | 677 |
movptr(Address(lock_reg, mark_offset), swap_reg); |
1 | 678 |
|
679 |
assert(lock_offset == 0, "displached header must be first word in BasicObjectLock"); |
|
680 |
if (os::is_MP()) { |
|
681 |
lock(); |
|
682 |
} |
|
1066 | 683 |
cmpxchgptr(lock_reg, Address(obj_reg, 0)); |
1 | 684 |
if (PrintBiasedLockingStatistics) { |
685 |
cond_inc32(Assembler::zero, |
|
686 |
ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr())); |
|
687 |
} |
|
688 |
jcc(Assembler::zero, done); |
|
689 |
||
690 |
// Test if the oopMark is an obvious stack pointer, i.e., |
|
691 |
// 1) (mark & 3) == 0, and |
|
692 |
// 2) rsp <= mark < mark + os::pagesize() |
|
693 |
// |
|
694 |
// These 3 tests can be done by evaluating the following |
|
695 |
// expression: ((mark - rsp) & (3 - os::vm_page_size())), |
|
696 |
// assuming both stack pointer and pagesize have their |
|
697 |
// least significant 2 bits clear. |
|
698 |
// NOTE: the oopMark is in swap_reg %rax, as the result of cmpxchg |
|
1066 | 699 |
subptr(swap_reg, rsp); |
700 |
andptr(swap_reg, 3 - os::vm_page_size()); |
|
1 | 701 |
|
702 |
// Save the test result, for recursive case, the result is zero |
|
1066 | 703 |
movptr(Address(lock_reg, mark_offset), swap_reg); |
1 | 704 |
|
705 |
if (PrintBiasedLockingStatistics) { |
|
706 |
cond_inc32(Assembler::zero, |
|
707 |
ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr())); |
|
708 |
} |
|
709 |
jcc(Assembler::zero, done); |
|
710 |
||
711 |
bind(slow_case); |
|
712 |
||
713 |
// Call the runtime routine for slow case |
|
714 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter), lock_reg); |
|
715 |
||
716 |
bind(done); |
|
717 |
} |
|
718 |
} |
|
719 |
||
720 |
||
721 |
// Unlocks an object. Used in monitorexit bytecode and remove_activation. |
|
722 |
// |
|
723 |
// Argument: rdx : Points to BasicObjectLock structure for lock |
|
724 |
// Throw an IllegalMonitorException if object is not locked by current thread |
|
725 |
// |
|
726 |
// Uses: rax, rbx, rcx, rdx |
|
727 |
void InterpreterMacroAssembler::unlock_object(Register lock_reg) { |
|
728 |
assert(lock_reg == rdx, "The argument is only for looks. It must be rdx"); |
|
729 |
||
730 |
if (UseHeavyMonitors) { |
|
731 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg); |
|
732 |
} else { |
|
733 |
Label done; |
|
734 |
||
735 |
const Register swap_reg = rax; // Must use rax, for cmpxchg instruction |
|
736 |
const Register header_reg = rbx; // Will contain the old oopMark |
|
737 |
const Register obj_reg = rcx; // Will contain the oop |
|
738 |
||
739 |
save_bcp(); // Save in case of exception |
|
740 |
||
741 |
// Convert from BasicObjectLock structure to object and BasicLock structure |
|
742 |
// Store the BasicLock address into %rax, |
|
1066 | 743 |
lea(swap_reg, Address(lock_reg, BasicObjectLock::lock_offset_in_bytes())); |
1 | 744 |
|
745 |
// Load oop into obj_reg(%rcx) |
|
1066 | 746 |
movptr(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset_in_bytes ())); |
1 | 747 |
|
748 |
// Free entry |
|
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1217
diff
changeset
|
749 |
movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), NULL_WORD); |
1 | 750 |
|
751 |
if (UseBiasedLocking) { |
|
752 |
biased_locking_exit(obj_reg, header_reg, done); |
|
753 |
} |
|
754 |
||
755 |
// Load the old header from BasicLock structure |
|
1066 | 756 |
movptr(header_reg, Address(swap_reg, BasicLock::displaced_header_offset_in_bytes())); |
1 | 757 |
|
758 |
// Test for recursion |
|
1066 | 759 |
testptr(header_reg, header_reg); |
1 | 760 |
|
761 |
// zero for recursive case |
|
762 |
jcc(Assembler::zero, done); |
|
763 |
||
764 |
// Atomic swap back the old header |
|
765 |
if (os::is_MP()) lock(); |
|
1066 | 766 |
cmpxchgptr(header_reg, Address(obj_reg, 0)); |
1 | 767 |
|
768 |
// zero for recursive case |
|
769 |
jcc(Assembler::zero, done); |
|
770 |
||
771 |
// Call the runtime routine for slow case. |
|
1066 | 772 |
movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), obj_reg); // restore obj |
1 | 773 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg); |
774 |
||
775 |
bind(done); |
|
776 |
||
777 |
restore_bcp(); |
|
778 |
} |
|
779 |
} |
|
780 |
||
781 |
||
782 |
#ifndef CC_INTERP |
|
783 |
||
784 |
// Test ImethodDataPtr. If it is null, continue at the specified label |
|
785 |
void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) { |
|
786 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1066 | 787 |
movptr(mdp, Address(rbp, frame::interpreter_frame_mdx_offset * wordSize)); |
788 |
testptr(mdp, mdp); |
|
1 | 789 |
jcc(Assembler::zero, zero_continue); |
790 |
} |
|
791 |
||
792 |
||
793 |
// Set the method data pointer for the current bcp. |
|
794 |
void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { |
|
795 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
796 |
Label zero_continue; |
|
1066 | 797 |
push(rax); |
798 |
push(rbx); |
|
1 | 799 |
|
800 |
get_method(rbx); |
|
801 |
// Test MDO to avoid the call if it is NULL. |
|
1066 | 802 |
movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
803 |
testptr(rax, rax); |
|
1 | 804 |
jcc(Assembler::zero, zero_continue); |
805 |
||
806 |
// rbx,: method |
|
807 |
// rsi: bcp |
|
808 |
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi); |
|
809 |
// rax,: mdi |
|
810 |
||
1066 | 811 |
movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
812 |
testptr(rbx, rbx); |
|
1 | 813 |
jcc(Assembler::zero, zero_continue); |
1066 | 814 |
addptr(rbx, in_bytes(methodDataOopDesc::data_offset())); |
815 |
addptr(rbx, rax); |
|
816 |
movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rbx); |
|
1 | 817 |
|
818 |
bind(zero_continue); |
|
1066 | 819 |
pop(rbx); |
820 |
pop(rax); |
|
1 | 821 |
} |
822 |
||
823 |
void InterpreterMacroAssembler::verify_method_data_pointer() { |
|
824 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
825 |
#ifdef ASSERT |
|
826 |
Label verify_continue; |
|
1066 | 827 |
push(rax); |
828 |
push(rbx); |
|
829 |
push(rcx); |
|
830 |
push(rdx); |
|
1 | 831 |
test_method_data_pointer(rcx, verify_continue); // If mdp is zero, continue |
832 |
get_method(rbx); |
|
833 |
||
834 |
// If the mdp is valid, it will point to a DataLayout header which is |
|
835 |
// consistent with the bcp. The converse is highly probable also. |
|
2148
09c7f703773b
6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents:
1909
diff
changeset
|
836 |
load_unsigned_short(rdx, Address(rcx, in_bytes(DataLayout::bci_offset()))); |
1066 | 837 |
addptr(rdx, Address(rbx, methodOopDesc::const_offset())); |
838 |
lea(rdx, Address(rdx, constMethodOopDesc::codes_offset())); |
|
839 |
cmpptr(rdx, rsi); |
|
1 | 840 |
jcc(Assembler::equal, verify_continue); |
841 |
// rbx,: method |
|
842 |
// rsi: bcp |
|
843 |
// rcx: mdp |
|
844 |
call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp), rbx, rsi, rcx); |
|
845 |
bind(verify_continue); |
|
1066 | 846 |
pop(rdx); |
847 |
pop(rcx); |
|
848 |
pop(rbx); |
|
849 |
pop(rax); |
|
1 | 850 |
#endif // ASSERT |
851 |
} |
|
852 |
||
853 |
||
854 |
void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in, int constant, Register value) { |
|
1066 | 855 |
// %%% this seems to be used to store counter data which is surely 32bits |
856 |
// however 64bit side stores 64 bits which seems wrong |
|
1 | 857 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
858 |
Address data(mdp_in, constant); |
|
1066 | 859 |
movptr(data, value); |
1 | 860 |
} |
861 |
||
862 |
||
863 |
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, |
|
864 |
int constant, |
|
865 |
bool decrement) { |
|
866 |
// Counter address |
|
867 |
Address data(mdp_in, constant); |
|
868 |
||
869 |
increment_mdp_data_at(data, decrement); |
|
870 |
} |
|
871 |
||
872 |
||
873 |
void InterpreterMacroAssembler::increment_mdp_data_at(Address data, |
|
874 |
bool decrement) { |
|
875 |
||
876 |
assert( DataLayout::counter_increment==1, "flow-free idiom only works with 1" ); |
|
877 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
878 |
||
1066 | 879 |
// %%% 64bit treats this as 64 bit which seems unlikely |
1 | 880 |
if (decrement) { |
881 |
// Decrement the register. Set condition codes. |
|
882 |
addl(data, -DataLayout::counter_increment); |
|
883 |
// If the decrement causes the counter to overflow, stay negative |
|
884 |
Label L; |
|
885 |
jcc(Assembler::negative, L); |
|
886 |
addl(data, DataLayout::counter_increment); |
|
887 |
bind(L); |
|
888 |
} else { |
|
889 |
assert(DataLayout::counter_increment == 1, |
|
890 |
"flow-free idiom only works with 1"); |
|
891 |
// Increment the register. Set carry flag. |
|
892 |
addl(data, DataLayout::counter_increment); |
|
893 |
// If the increment causes the counter to overflow, pull back by 1. |
|
894 |
sbbl(data, 0); |
|
895 |
} |
|
896 |
} |
|
897 |
||
898 |
||
899 |
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in, |
|
900 |
Register reg, |
|
901 |
int constant, |
|
902 |
bool decrement) { |
|
903 |
Address data(mdp_in, reg, Address::times_1, constant); |
|
904 |
||
905 |
increment_mdp_data_at(data, decrement); |
|
906 |
} |
|
907 |
||
908 |
||
909 |
void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in, int flag_byte_constant) { |
|
910 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
911 |
int header_offset = in_bytes(DataLayout::header_offset()); |
|
912 |
int header_bits = DataLayout::flag_mask_to_header_mask(flag_byte_constant); |
|
913 |
// Set the flag |
|
914 |
orl(Address(mdp_in, header_offset), header_bits); |
|
915 |
} |
|
916 |
||
917 |
||
918 |
||
919 |
void InterpreterMacroAssembler::test_mdp_data_at(Register mdp_in, |
|
920 |
int offset, |
|
921 |
Register value, |
|
922 |
Register test_value_out, |
|
923 |
Label& not_equal_continue) { |
|
924 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
925 |
if (test_value_out == noreg) { |
|
1066 | 926 |
cmpptr(value, Address(mdp_in, offset)); |
1 | 927 |
} else { |
928 |
// Put the test value into a register, so caller can use it: |
|
1066 | 929 |
movptr(test_value_out, Address(mdp_in, offset)); |
930 |
cmpptr(test_value_out, value); |
|
1 | 931 |
} |
932 |
jcc(Assembler::notEqual, not_equal_continue); |
|
933 |
} |
|
934 |
||
935 |
||
936 |
void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, int offset_of_disp) { |
|
937 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
938 |
Address disp_address(mdp_in, offset_of_disp); |
|
1066 | 939 |
addptr(mdp_in,disp_address); |
940 |
movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); |
|
1 | 941 |
} |
942 |
||
943 |
||
944 |
void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp) { |
|
945 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
946 |
Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp); |
|
1066 | 947 |
addptr(mdp_in, disp_address); |
948 |
movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); |
|
1 | 949 |
} |
950 |
||
951 |
||
952 |
void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) { |
|
953 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1066 | 954 |
addptr(mdp_in, constant); |
955 |
movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in); |
|
1 | 956 |
} |
957 |
||
958 |
||
959 |
void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) { |
|
960 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
1066 | 961 |
push(return_bci); // save/restore across call_VM |
1 | 962 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), return_bci); |
1066 | 963 |
pop(return_bci); |
1 | 964 |
} |
965 |
||
966 |
||
967 |
void InterpreterMacroAssembler::profile_taken_branch(Register mdp, Register bumped_count) { |
|
968 |
if (ProfileInterpreter) { |
|
969 |
Label profile_continue; |
|
970 |
||
971 |
// If no method data exists, go to profile_continue. |
|
972 |
// Otherwise, assign to mdp |
|
973 |
test_method_data_pointer(mdp, profile_continue); |
|
974 |
||
975 |
// We are taking a branch. Increment the taken count. |
|
976 |
// We inline increment_mdp_data_at to return bumped_count in a register |
|
977 |
//increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset())); |
|
978 |
Address data(mdp, in_bytes(JumpData::taken_offset())); |
|
1066 | 979 |
|
980 |
// %%% 64bit treats these cells as 64 bit but they seem to be 32 bit |
|
1 | 981 |
movl(bumped_count,data); |
982 |
assert( DataLayout::counter_increment==1, "flow-free idiom only works with 1" ); |
|
983 |
addl(bumped_count, DataLayout::counter_increment); |
|
984 |
sbbl(bumped_count, 0); |
|
985 |
movl(data,bumped_count); // Store back out |
|
986 |
||
987 |
// The method data pointer needs to be updated to reflect the new target. |
|
988 |
update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset())); |
|
989 |
bind (profile_continue); |
|
990 |
} |
|
991 |
} |
|
992 |
||
993 |
||
994 |
void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) { |
|
995 |
if (ProfileInterpreter) { |
|
996 |
Label profile_continue; |
|
997 |
||
998 |
// If no method data exists, go to profile_continue. |
|
999 |
test_method_data_pointer(mdp, profile_continue); |
|
1000 |
||
1001 |
// We are taking a branch. Increment the not taken count. |
|
1002 |
increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset())); |
|
1003 |
||
1004 |
// The method data pointer needs to be updated to correspond to the next bytecode |
|
1005 |
update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size())); |
|
1006 |
bind (profile_continue); |
|
1007 |
} |
|
1008 |
} |
|
1009 |
||
1010 |
||
1011 |
void InterpreterMacroAssembler::profile_call(Register mdp) { |
|
1012 |
if (ProfileInterpreter) { |
|
1013 |
Label profile_continue; |
|
1014 |
||
1015 |
// If no method data exists, go to profile_continue. |
|
1016 |
test_method_data_pointer(mdp, profile_continue); |
|
1017 |
||
1018 |
// We are making a call. Increment the count. |
|
1019 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
|
1020 |
||
1021 |
// The method data pointer needs to be updated to reflect the new target. |
|
1022 |
update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size())); |
|
1023 |
bind (profile_continue); |
|
1024 |
} |
|
1025 |
} |
|
1026 |
||
1027 |
||
1028 |
void InterpreterMacroAssembler::profile_final_call(Register mdp) { |
|
1029 |
if (ProfileInterpreter) { |
|
1030 |
Label profile_continue; |
|
1031 |
||
1032 |
// If no method data exists, go to profile_continue. |
|
1033 |
test_method_data_pointer(mdp, profile_continue); |
|
1034 |
||
1035 |
// We are making a call. Increment the count. |
|
1036 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
|
1037 |
||
1038 |
// The method data pointer needs to be updated to reflect the new target. |
|
1039 |
update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size())); |
|
1040 |
bind (profile_continue); |
|
1041 |
} |
|
1042 |
} |
|
1043 |
||
1044 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1045 |
void InterpreterMacroAssembler::profile_virtual_call(Register receiver, Register mdp, |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1046 |
Register reg2, |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1047 |
bool receiver_can_be_null) { |
1 | 1048 |
if (ProfileInterpreter) { |
1049 |
Label profile_continue; |
|
1050 |
||
1051 |
// If no method data exists, go to profile_continue. |
|
1052 |
test_method_data_pointer(mdp, profile_continue); |
|
1053 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1054 |
Label skip_receiver_profile; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1055 |
if (receiver_can_be_null) { |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1056 |
Label not_null; |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1057 |
testptr(receiver, receiver); |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1058 |
jccb(Assembler::notZero, not_null); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1059 |
// We are making a call. Increment the count for null receiver. |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1060 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1061 |
jmp(skip_receiver_profile); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1062 |
bind(not_null); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1063 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1064 |
|
1 | 1065 |
// Record the receiver type. |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1066 |
record_klass_in_profile(receiver, mdp, reg2, true); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1067 |
bind(skip_receiver_profile); |
1 | 1068 |
|
1069 |
// The method data pointer needs to be updated to reflect the new target. |
|
1070 |
update_mdp_by_constant(mdp, |
|
1071 |
in_bytes(VirtualCallData:: |
|
1072 |
virtual_call_data_size())); |
|
1073 |
bind(profile_continue); |
|
1074 |
} |
|
1075 |
} |
|
1076 |
||
1077 |
||
1078 |
void InterpreterMacroAssembler::record_klass_in_profile_helper( |
|
1079 |
Register receiver, Register mdp, |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1080 |
Register reg2, int start_row, |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1081 |
Label& done, bool is_virtual_call) { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1082 |
if (TypeProfileWidth == 0) { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1083 |
if (is_virtual_call) { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1084 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1085 |
} |
3814
91f531a11872
6858208: jvm crash when specifying TypeProfileWidth=0 on jdk 6.0
poonam
parents:
3179
diff
changeset
|
1086 |
return; |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1087 |
} |
3814
91f531a11872
6858208: jvm crash when specifying TypeProfileWidth=0 on jdk 6.0
poonam
parents:
3179
diff
changeset
|
1088 |
|
1 | 1089 |
int last_row = VirtualCallData::row_limit() - 1; |
1090 |
assert(start_row <= last_row, "must be work left to do"); |
|
1091 |
// Test this row for both the receiver and for null. |
|
1092 |
// Take any of three different outcomes: |
|
1093 |
// 1. found receiver => increment count and goto done |
|
1094 |
// 2. found null => keep looking for case 1, maybe allocate this cell |
|
1095 |
// 3. found something else => keep looking for cases 1 and 2 |
|
1096 |
// Case 3 is handled by a recursive call. |
|
1097 |
for (int row = start_row; row <= last_row; row++) { |
|
1098 |
Label next_test; |
|
1099 |
bool test_for_null_also = (row == start_row); |
|
1100 |
||
1101 |
// See if the receiver is receiver[n]. |
|
1102 |
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row)); |
|
1103 |
test_mdp_data_at(mdp, recvr_offset, receiver, |
|
1104 |
(test_for_null_also ? reg2 : noreg), |
|
1105 |
next_test); |
|
1106 |
// (Reg2 now contains the receiver from the CallData.) |
|
1107 |
||
1108 |
// The receiver is receiver[n]. Increment count[n]. |
|
1109 |
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row)); |
|
1110 |
increment_mdp_data_at(mdp, count_offset); |
|
1111 |
jmp(done); |
|
1112 |
bind(next_test); |
|
1113 |
||
1114 |
if (row == start_row) { |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1115 |
Label found_null; |
1 | 1116 |
// Failed the equality check on receiver[n]... Test for null. |
1066 | 1117 |
testptr(reg2, reg2); |
1 | 1118 |
if (start_row == last_row) { |
1119 |
// The only thing left to do is handle the null case. |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1120 |
if (is_virtual_call) { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1121 |
jccb(Assembler::zero, found_null); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1122 |
// Receiver did not match any saved receiver and there is no empty row for it. |
4892
e977b527544a
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
4754
diff
changeset
|
1123 |
// Increment total counter to indicate polymorphic case. |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1124 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1125 |
jmp(done); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1126 |
bind(found_null); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1127 |
} else { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1128 |
jcc(Assembler::notZero, done); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1129 |
} |
1 | 1130 |
break; |
1131 |
} |
|
1132 |
// Since null is rare, make it be the branch-taken case. |
|
1133 |
jcc(Assembler::zero, found_null); |
|
1134 |
||
1135 |
// Put all the "Case 3" tests here. |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1136 |
record_klass_in_profile_helper(receiver, mdp, reg2, start_row + 1, done, is_virtual_call); |
1 | 1137 |
|
1138 |
// Found a null. Keep searching for a matching receiver, |
|
1139 |
// but remember that this is an empty (unused) slot. |
|
1140 |
bind(found_null); |
|
1141 |
} |
|
1142 |
} |
|
1143 |
||
1144 |
// In the fall-through case, we found no matching receiver, but we |
|
1145 |
// observed the receiver[start_row] is NULL. |
|
1146 |
||
1147 |
// Fill in the receiver field and increment the count. |
|
1148 |
int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row)); |
|
1149 |
set_mdp_data_at(mdp, recvr_offset, receiver); |
|
1150 |
int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row)); |
|
1066 | 1151 |
movptr(reg2, (int32_t)DataLayout::counter_increment); |
1 | 1152 |
set_mdp_data_at(mdp, count_offset, reg2); |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1153 |
if (start_row > 0) { |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1154 |
jmp(done); |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1155 |
} |
1 | 1156 |
} |
1157 |
||
1158 |
void InterpreterMacroAssembler::record_klass_in_profile(Register receiver, |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1159 |
Register mdp, Register reg2, |
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1160 |
bool is_virtual_call) { |
1 | 1161 |
assert(ProfileInterpreter, "must be profiling"); |
1162 |
Label done; |
|
1163 |
||
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1164 |
record_klass_in_profile_helper(receiver, mdp, reg2, 0, done, is_virtual_call); |
1 | 1165 |
|
1166 |
bind (done); |
|
1167 |
} |
|
1168 |
||
1169 |
void InterpreterMacroAssembler::profile_ret(Register return_bci, Register mdp) { |
|
1170 |
if (ProfileInterpreter) { |
|
1171 |
Label profile_continue; |
|
1172 |
uint row; |
|
1173 |
||
1174 |
// If no method data exists, go to profile_continue. |
|
1175 |
test_method_data_pointer(mdp, profile_continue); |
|
1176 |
||
1177 |
// Update the total ret count. |
|
1178 |
increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
|
1179 |
||
1180 |
for (row = 0; row < RetData::row_limit(); row++) { |
|
1181 |
Label next_test; |
|
1182 |
||
1183 |
// See if return_bci is equal to bci[n]: |
|
1184 |
test_mdp_data_at(mdp, in_bytes(RetData::bci_offset(row)), return_bci, |
|
1185 |
noreg, next_test); |
|
1186 |
||
1187 |
// return_bci is equal to bci[n]. Increment the count. |
|
1188 |
increment_mdp_data_at(mdp, in_bytes(RetData::bci_count_offset(row))); |
|
1189 |
||
1190 |
// The method data pointer needs to be updated to reflect the new target. |
|
1191 |
update_mdp_by_offset(mdp, in_bytes(RetData::bci_displacement_offset(row))); |
|
1192 |
jmp(profile_continue); |
|
1193 |
bind(next_test); |
|
1194 |
} |
|
1195 |
||
1196 |
update_mdp_for_ret(return_bci); |
|
1197 |
||
1198 |
bind (profile_continue); |
|
1199 |
} |
|
1200 |
} |
|
1201 |
||
1202 |
||
1203 |
void InterpreterMacroAssembler::profile_null_seen(Register mdp) { |
|
1204 |
if (ProfileInterpreter) { |
|
1205 |
Label profile_continue; |
|
1206 |
||
1207 |
// If no method data exists, go to profile_continue. |
|
1208 |
test_method_data_pointer(mdp, profile_continue); |
|
1209 |
||
3179
e9442e207d31
6851908: interpreter null check profiling broken causing extra compilation invalidation
never
parents:
2570
diff
changeset
|
1210 |
set_mdp_flag_at(mdp, BitData::null_seen_byte_constant()); |
e9442e207d31
6851908: interpreter null check profiling broken causing extra compilation invalidation
never
parents:
2570
diff
changeset
|
1211 |
|
1 | 1212 |
// The method data pointer needs to be updated. |
1213 |
int mdp_delta = in_bytes(BitData::bit_data_size()); |
|
1214 |
if (TypeProfileCasts) { |
|
1215 |
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1216 |
} |
|
1217 |
update_mdp_by_constant(mdp, mdp_delta); |
|
1218 |
||
1219 |
bind (profile_continue); |
|
1220 |
} |
|
1221 |
} |
|
1222 |
||
1223 |
||
1224 |
void InterpreterMacroAssembler::profile_typecheck_failed(Register mdp) { |
|
1225 |
if (ProfileInterpreter && TypeProfileCasts) { |
|
1226 |
Label profile_continue; |
|
1227 |
||
1228 |
// If no method data exists, go to profile_continue. |
|
1229 |
test_method_data_pointer(mdp, profile_continue); |
|
1230 |
||
1231 |
int count_offset = in_bytes(CounterData::count_offset()); |
|
1232 |
// Back up the address, since we have already bumped the mdp. |
|
1233 |
count_offset -= in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1234 |
||
1235 |
// *Decrement* the counter. We expect to see zero or small negatives. |
|
1236 |
increment_mdp_data_at(mdp, count_offset, true); |
|
1237 |
||
1238 |
bind (profile_continue); |
|
1239 |
} |
|
1240 |
} |
|
1241 |
||
1242 |
||
1243 |
void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, Register reg2) |
|
1244 |
{ |
|
1245 |
if (ProfileInterpreter) { |
|
1246 |
Label profile_continue; |
|
1247 |
||
1248 |
// If no method data exists, go to profile_continue. |
|
1249 |
test_method_data_pointer(mdp, profile_continue); |
|
1250 |
||
1251 |
// The method data pointer needs to be updated. |
|
1252 |
int mdp_delta = in_bytes(BitData::bit_data_size()); |
|
1253 |
if (TypeProfileCasts) { |
|
1254 |
mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); |
|
1255 |
||
1256 |
// Record the object type. |
|
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4478
diff
changeset
|
1257 |
record_klass_in_profile(klass, mdp, reg2, false); |
1 | 1258 |
assert(reg2 == rdi, "we know how to fix this blown reg"); |
1259 |
restore_locals(); // Restore EDI |
|
1260 |
} |
|
1261 |
update_mdp_by_constant(mdp, mdp_delta); |
|
1262 |
||
1263 |
bind(profile_continue); |
|
1264 |
} |
|
1265 |
} |
|
1266 |
||
1267 |
||
1268 |
void InterpreterMacroAssembler::profile_switch_default(Register mdp) { |
|
1269 |
if (ProfileInterpreter) { |
|
1270 |
Label profile_continue; |
|
1271 |
||
1272 |
// If no method data exists, go to profile_continue. |
|
1273 |
test_method_data_pointer(mdp, profile_continue); |
|
1274 |
||
1275 |
// Update the default case count |
|
1276 |
increment_mdp_data_at(mdp, in_bytes(MultiBranchData::default_count_offset())); |
|
1277 |
||
1278 |
// The method data pointer needs to be updated. |
|
1279 |
update_mdp_by_offset(mdp, in_bytes(MultiBranchData::default_displacement_offset())); |
|
1280 |
||
1281 |
bind (profile_continue); |
|
1282 |
} |
|
1283 |
} |
|
1284 |
||
1285 |
||
1286 |
void InterpreterMacroAssembler::profile_switch_case(Register index, Register mdp, Register reg2) { |
|
1287 |
if (ProfileInterpreter) { |
|
1288 |
Label profile_continue; |
|
1289 |
||
1290 |
// If no method data exists, go to profile_continue. |
|
1291 |
test_method_data_pointer(mdp, profile_continue); |
|
1292 |
||
1293 |
// Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes() |
|
1066 | 1294 |
movptr(reg2, (int32_t)in_bytes(MultiBranchData::per_case_size())); |
1295 |
// index is positive and so should have correct value if this code were |
|
1296 |
// used on 64bits |
|
1297 |
imulptr(index, reg2); |
|
1298 |
addptr(index, in_bytes(MultiBranchData::case_array_offset())); |
|
1 | 1299 |
|
1300 |
// Update the case count |
|
1301 |
increment_mdp_data_at(mdp, index, in_bytes(MultiBranchData::relative_count_offset())); |
|
1302 |
||
1303 |
// The method data pointer needs to be updated. |
|
1304 |
update_mdp_by_offset(mdp, index, in_bytes(MultiBranchData::relative_displacement_offset())); |
|
1305 |
||
1306 |
bind (profile_continue); |
|
1307 |
} |
|
1308 |
} |
|
1309 |
||
1310 |
#endif // !CC_INTERP |
|
1311 |
||
1312 |
||
1313 |
||
1314 |
void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) { |
|
1315 |
if (state == atos) MacroAssembler::verify_oop(reg); |
|
1316 |
} |
|
1317 |
||
1318 |
||
1319 |
#ifndef CC_INTERP |
|
1320 |
void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) { |
|
1321 |
if (state == ftos || state == dtos) MacroAssembler::verify_FPU(stack_depth); |
|
1322 |
} |
|
1323 |
||
1324 |
#endif /* CC_INTERP */ |
|
1325 |
||
1326 |
||
1327 |
void InterpreterMacroAssembler::notify_method_entry() { |
|
1328 |
// Whenever JVMTI is interp_only_mode, method entry/exit events are sent to |
|
1329 |
// track stack depth. If it is possible to enter interp_only_mode we add |
|
1330 |
// the code to check if the event should be sent. |
|
1331 |
if (JvmtiExport::can_post_interpreter_events()) { |
|
1332 |
Label L; |
|
1333 |
get_thread(rcx); |
|
1334 |
movl(rcx, Address(rcx, JavaThread::interp_only_mode_offset())); |
|
1335 |
testl(rcx,rcx); |
|
1336 |
jcc(Assembler::zero, L); |
|
1337 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry)); |
|
1338 |
bind(L); |
|
1339 |
} |
|
1340 |
||
1341 |
{ |
|
1342 |
SkipIfEqual skip_if(this, &DTraceMethodProbes, 0); |
|
1343 |
get_thread(rcx); |
|
1344 |
get_method(rbx); |
|
1345 |
call_VM_leaf( |
|
1346 |
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), rcx, rbx); |
|
1347 |
} |
|
2136
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1348 |
|
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1349 |
// RedefineClasses() tracing support for obsolete method entry |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1350 |
if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1351 |
get_thread(rcx); |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1352 |
get_method(rbx); |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1353 |
call_VM_leaf( |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1354 |
CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1355 |
rcx, rbx); |
c55428da3cec
6805864: 4/3 Problem with jvmti->redefineClasses: some methods don't get redefined
dcubed
parents:
1217
diff
changeset
|
1356 |
} |
1 | 1357 |
} |
1358 |
||
1359 |
||
1360 |
void InterpreterMacroAssembler::notify_method_exit( |
|
1361 |
TosState state, NotifyMethodExitMode mode) { |
|
1362 |
// Whenever JVMTI is interp_only_mode, method entry/exit events are sent to |
|
1363 |
// track stack depth. If it is possible to enter interp_only_mode we add |
|
1364 |
// the code to check if the event should be sent. |
|
1365 |
if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) { |
|
1366 |
Label L; |
|
1367 |
// Note: frame::interpreter_frame_result has a dependency on how the |
|
1368 |
// method result is saved across the call to post_method_exit. If this |
|
1369 |
// is changed then the interpreter_frame_result implementation will |
|
1370 |
// need to be updated too. |
|
1371 |
||
1372 |
// For c++ interpreter the result is always stored at a known location in the frame |
|
1373 |
// template interpreter will leave it on the top of the stack. |
|
1374 |
NOT_CC_INTERP(push(state);) |
|
1375 |
get_thread(rcx); |
|
1376 |
movl(rcx, Address(rcx, JavaThread::interp_only_mode_offset())); |
|
1377 |
testl(rcx,rcx); |
|
1378 |
jcc(Assembler::zero, L); |
|
1379 |
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit)); |
|
1380 |
bind(L); |
|
1381 |
NOT_CC_INTERP(pop(state);) |
|
1382 |
} |
|
1383 |
||
1384 |
{ |
|
1385 |
SkipIfEqual skip_if(this, &DTraceMethodProbes, 0); |
|
1066 | 1386 |
NOT_CC_INTERP(push(state)); |
1 | 1387 |
get_thread(rbx); |
1388 |
get_method(rcx); |
|
1389 |
call_VM_leaf( |
|
1390 |
CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), |
|
1391 |
rbx, rcx); |
|
1066 | 1392 |
NOT_CC_INTERP(pop(state)); |
1 | 1393 |
} |
1394 |
} |