Mercurial > hg > truffle
annotate src/share/vm/interpreter/bytecodeInterpreter.cpp @ 14411:bdd155477289
8023033: PPC64 (part 13): basic changes for AIX
Summary: Added AIX includes alpha-sorted before BSD. Fix compilation issues with xlC in shared code. Basic shared platform dependend adaption (vm_version etc.).
Reviewed-by: kvn, dholmes, stefank
author | goetz |
---|---|
date | Thu, 22 Aug 2013 09:39:54 -0700 |
parents | 6cc7093e1341 |
children | f3806614494a |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1513
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1513
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1513
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 // no precompiled headers |
26 #include "classfile/vmSymbols.hpp" | |
27 #include "gc_interface/collectedHeap.hpp" | |
28 #include "interpreter/bytecodeHistogram.hpp" | |
29 #include "interpreter/bytecodeInterpreter.hpp" | |
30 #include "interpreter/bytecodeInterpreter.inline.hpp" | |
31 #include "interpreter/interpreter.hpp" | |
32 #include "interpreter/interpreterRuntime.hpp" | |
33 #include "memory/resourceArea.hpp" | |
10233 | 34 #include "oops/methodCounters.hpp" |
1972 | 35 #include "oops/objArrayKlass.hpp" |
36 #include "oops/oop.inline.hpp" | |
37 #include "prims/jvmtiExport.hpp" | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
38 #include "prims/jvmtiThreadState.hpp" |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
39 #include "runtime/biasedLocking.hpp" |
1972 | 40 #include "runtime/frame.inline.hpp" |
41 #include "runtime/handles.inline.hpp" | |
42 #include "runtime/interfaceSupport.hpp" | |
43 #include "runtime/sharedRuntime.hpp" | |
44 #include "runtime/threadCritical.hpp" | |
45 #include "utilities/exceptions.hpp" | |
46 #ifdef TARGET_OS_ARCH_linux_x86 | |
47 # include "orderAccess_linux_x86.inline.hpp" | |
48 #endif | |
49 #ifdef TARGET_OS_ARCH_linux_sparc | |
50 # include "orderAccess_linux_sparc.inline.hpp" | |
51 #endif | |
52 #ifdef TARGET_OS_ARCH_linux_zero | |
53 # include "orderAccess_linux_zero.inline.hpp" | |
54 #endif | |
55 #ifdef TARGET_OS_ARCH_solaris_x86 | |
56 # include "orderAccess_solaris_x86.inline.hpp" | |
57 #endif | |
58 #ifdef TARGET_OS_ARCH_solaris_sparc | |
59 # include "orderAccess_solaris_sparc.inline.hpp" | |
60 #endif | |
61 #ifdef TARGET_OS_ARCH_windows_x86 | |
62 # include "orderAccess_windows_x86.inline.hpp" | |
63 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
64 #ifdef TARGET_OS_ARCH_linux_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
65 # include "orderAccess_linux_arm.inline.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
66 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
67 #ifdef TARGET_OS_ARCH_linux_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
68 # include "orderAccess_linux_ppc.inline.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
2142
diff
changeset
|
69 #endif |
14411 | 70 #ifdef TARGET_OS_ARCH_aix_ppc |
71 # include "orderAccess_aix_ppc.inline.hpp" | |
72 #endif | |
3960 | 73 #ifdef TARGET_OS_ARCH_bsd_x86 |
74 # include "orderAccess_bsd_x86.inline.hpp" | |
75 #endif | |
76 #ifdef TARGET_OS_ARCH_bsd_zero | |
77 # include "orderAccess_bsd_zero.inline.hpp" | |
78 #endif | |
1972 | 79 |
0 | 80 |
81 // no precompiled headers | |
82 #ifdef CC_INTERP | |
83 | |
84 /* | |
85 * USELABELS - If using GCC, then use labels for the opcode dispatching | |
86 * rather -then a switch statement. This improves performance because it | |
87 * gives us the oportunity to have the instructions that calculate the | |
88 * next opcode to jump to be intermixed with the rest of the instructions | |
89 * that implement the opcode (see UPDATE_PC_AND_TOS_AND_CONTINUE macro). | |
90 */ | |
91 #undef USELABELS | |
92 #ifdef __GNUC__ | |
93 /* | |
94 ASSERT signifies debugging. It is much easier to step thru bytecodes if we | |
95 don't use the computed goto approach. | |
96 */ | |
97 #ifndef ASSERT | |
98 #define USELABELS | |
99 #endif | |
100 #endif | |
101 | |
102 #undef CASE | |
103 #ifdef USELABELS | |
104 #define CASE(opcode) opc ## opcode | |
105 #define DEFAULT opc_default | |
106 #else | |
107 #define CASE(opcode) case Bytecodes:: opcode | |
108 #define DEFAULT default | |
109 #endif | |
110 | |
111 /* | |
112 * PREFETCH_OPCCODE - Some compilers do better if you prefetch the next | |
113 * opcode before going back to the top of the while loop, rather then having | |
114 * the top of the while loop handle it. This provides a better opportunity | |
115 * for instruction scheduling. Some compilers just do this prefetch | |
116 * automatically. Some actually end up with worse performance if you | |
117 * force the prefetch. Solaris gcc seems to do better, but cc does worse. | |
118 */ | |
119 #undef PREFETCH_OPCCODE | |
120 #define PREFETCH_OPCCODE | |
121 | |
122 /* | |
123 Interpreter safepoint: it is expected that the interpreter will have no live | |
124 handles of its own creation live at an interpreter safepoint. Therefore we | |
125 run a HandleMarkCleaner and trash all handles allocated in the call chain | |
126 since the JavaCalls::call_helper invocation that initiated the chain. | |
127 There really shouldn't be any handles remaining to trash but this is cheap | |
128 in relation to a safepoint. | |
129 */ | |
130 #define SAFEPOINT \ | |
131 if ( SafepointSynchronize::is_synchronizing()) { \ | |
132 { \ | |
133 /* zap freed handles rather than GC'ing them */ \ | |
134 HandleMarkCleaner __hmc(THREAD); \ | |
135 } \ | |
136 CALL_VM(SafepointSynchronize::block(THREAD), handle_exception); \ | |
137 } | |
138 | |
139 /* | |
140 * VM_JAVA_ERROR - Macro for throwing a java exception from | |
141 * the interpreter loop. Should really be a CALL_VM but there | |
142 * is no entry point to do the transition to vm so we just | |
143 * do it by hand here. | |
144 */ | |
145 #define VM_JAVA_ERROR_NO_JUMP(name, msg) \ | |
146 DECACHE_STATE(); \ | |
147 SET_LAST_JAVA_FRAME(); \ | |
148 { \ | |
149 ThreadInVMfromJava trans(THREAD); \ | |
150 Exceptions::_throw_msg(THREAD, __FILE__, __LINE__, name, msg); \ | |
151 } \ | |
152 RESET_LAST_JAVA_FRAME(); \ | |
153 CACHE_STATE(); | |
154 | |
155 // Normal throw of a java error | |
156 #define VM_JAVA_ERROR(name, msg) \ | |
157 VM_JAVA_ERROR_NO_JUMP(name, msg) \ | |
158 goto handle_exception; | |
159 | |
160 #ifdef PRODUCT | |
161 #define DO_UPDATE_INSTRUCTION_COUNT(opcode) | |
162 #else | |
163 #define DO_UPDATE_INSTRUCTION_COUNT(opcode) \ | |
164 { \ | |
165 BytecodeCounter::_counter_value++; \ | |
166 BytecodeHistogram::_counters[(Bytecodes::Code)opcode]++; \ | |
167 if (StopInterpreterAt && StopInterpreterAt == BytecodeCounter::_counter_value) os::breakpoint(); \ | |
168 if (TraceBytecodes) { \ | |
169 CALL_VM((void)SharedRuntime::trace_bytecode(THREAD, 0, \ | |
170 topOfStack[Interpreter::expr_index_at(1)], \ | |
171 topOfStack[Interpreter::expr_index_at(2)]), \ | |
172 handle_exception); \ | |
173 } \ | |
174 } | |
175 #endif | |
176 | |
177 #undef DEBUGGER_SINGLE_STEP_NOTIFY | |
178 #ifdef VM_JVMTI | |
179 /* NOTE: (kbr) This macro must be called AFTER the PC has been | |
180 incremented. JvmtiExport::at_single_stepping_point() may cause a | |
181 breakpoint opcode to get inserted at the current PC to allow the | |
182 debugger to coalesce single-step events. | |
183 | |
184 As a result if we call at_single_stepping_point() we refetch opcode | |
185 to get the current opcode. This will override any other prefetching | |
186 that might have occurred. | |
187 */ | |
188 #define DEBUGGER_SINGLE_STEP_NOTIFY() \ | |
189 { \ | |
190 if (_jvmti_interp_events) { \ | |
191 if (JvmtiExport::should_post_single_step()) { \ | |
192 DECACHE_STATE(); \ | |
193 SET_LAST_JAVA_FRAME(); \ | |
194 ThreadInVMfromJava trans(THREAD); \ | |
195 JvmtiExport::at_single_stepping_point(THREAD, \ | |
196 istate->method(), \ | |
197 pc); \ | |
198 RESET_LAST_JAVA_FRAME(); \ | |
199 CACHE_STATE(); \ | |
200 if (THREAD->pop_frame_pending() && \ | |
201 !THREAD->pop_frame_in_process()) { \ | |
202 goto handle_Pop_Frame; \ | |
203 } \ | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
204 if (THREAD->jvmti_thread_state() && \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
205 THREAD->jvmti_thread_state()->is_earlyret_pending()) { \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
206 goto handle_Early_Return; \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
207 } \ |
0 | 208 opcode = *pc; \ |
209 } \ | |
210 } \ | |
211 } | |
212 #else | |
213 #define DEBUGGER_SINGLE_STEP_NOTIFY() | |
214 #endif | |
215 | |
216 /* | |
217 * CONTINUE - Macro for executing the next opcode. | |
218 */ | |
219 #undef CONTINUE | |
220 #ifdef USELABELS | |
221 // Have to do this dispatch this way in C++ because otherwise gcc complains about crossing an | |
222 // initialization (which is is the initialization of the table pointer...) | |
520
52a431267315
6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents:
196
diff
changeset
|
223 #define DISPATCH(opcode) goto *(void*)dispatch_table[opcode] |
0 | 224 #define CONTINUE { \ |
225 opcode = *pc; \ | |
226 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
227 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
228 DISPATCH(opcode); \ | |
229 } | |
230 #else | |
231 #ifdef PREFETCH_OPCCODE | |
232 #define CONTINUE { \ | |
233 opcode = *pc; \ | |
234 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
235 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
236 continue; \ | |
237 } | |
238 #else | |
239 #define CONTINUE { \ | |
240 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
241 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
242 continue; \ | |
243 } | |
244 #endif | |
245 #endif | |
246 | |
247 | |
248 #define UPDATE_PC(opsize) {pc += opsize; } | |
249 /* | |
250 * UPDATE_PC_AND_TOS - Macro for updating the pc and topOfStack. | |
251 */ | |
252 #undef UPDATE_PC_AND_TOS | |
253 #define UPDATE_PC_AND_TOS(opsize, stack) \ | |
254 {pc += opsize; MORE_STACK(stack); } | |
255 | |
256 /* | |
257 * UPDATE_PC_AND_TOS_AND_CONTINUE - Macro for updating the pc and topOfStack, | |
258 * and executing the next opcode. It's somewhat similar to the combination | |
259 * of UPDATE_PC_AND_TOS and CONTINUE, but with some minor optimizations. | |
260 */ | |
261 #undef UPDATE_PC_AND_TOS_AND_CONTINUE | |
262 #ifdef USELABELS | |
263 #define UPDATE_PC_AND_TOS_AND_CONTINUE(opsize, stack) { \ | |
264 pc += opsize; opcode = *pc; MORE_STACK(stack); \ | |
265 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
266 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
267 DISPATCH(opcode); \ | |
268 } | |
269 | |
270 #define UPDATE_PC_AND_CONTINUE(opsize) { \ | |
271 pc += opsize; opcode = *pc; \ | |
272 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
273 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
274 DISPATCH(opcode); \ | |
275 } | |
276 #else | |
277 #ifdef PREFETCH_OPCCODE | |
278 #define UPDATE_PC_AND_TOS_AND_CONTINUE(opsize, stack) { \ | |
279 pc += opsize; opcode = *pc; MORE_STACK(stack); \ | |
280 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
281 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
282 goto do_continue; \ | |
283 } | |
284 | |
285 #define UPDATE_PC_AND_CONTINUE(opsize) { \ | |
286 pc += opsize; opcode = *pc; \ | |
287 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
288 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
289 goto do_continue; \ | |
290 } | |
291 #else | |
292 #define UPDATE_PC_AND_TOS_AND_CONTINUE(opsize, stack) { \ | |
293 pc += opsize; MORE_STACK(stack); \ | |
294 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
295 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
296 goto do_continue; \ | |
297 } | |
298 | |
299 #define UPDATE_PC_AND_CONTINUE(opsize) { \ | |
300 pc += opsize; \ | |
301 DO_UPDATE_INSTRUCTION_COUNT(opcode); \ | |
302 DEBUGGER_SINGLE_STEP_NOTIFY(); \ | |
303 goto do_continue; \ | |
304 } | |
305 #endif /* PREFETCH_OPCCODE */ | |
306 #endif /* USELABELS */ | |
307 | |
308 // About to call a new method, update the save the adjusted pc and return to frame manager | |
309 #define UPDATE_PC_AND_RETURN(opsize) \ | |
310 DECACHE_TOS(); \ | |
311 istate->set_bcp(pc+opsize); \ | |
312 return; | |
313 | |
314 | |
315 #define METHOD istate->method() | |
10233 | 316 #define GET_METHOD_COUNTERS(res) \ |
317 res = METHOD->method_counters(); \ | |
318 if (res == NULL) { \ | |
319 CALL_VM(res = InterpreterRuntime::build_method_counters(THREAD, METHOD), handle_exception); \ | |
320 } | |
321 | |
0 | 322 #define OSR_REQUEST(res, branch_pc) \ |
323 CALL_VM(res=InterpreterRuntime::frequency_counter_overflow(THREAD, branch_pc), handle_exception); | |
324 /* | |
325 * For those opcodes that need to have a GC point on a backwards branch | |
326 */ | |
327 | |
328 // Backedge counting is kind of strange. The asm interpreter will increment | |
329 // the backedge counter as a separate counter but it does it's comparisons | |
330 // to the sum (scaled) of invocation counter and backedge count to make | |
331 // a decision. Seems kind of odd to sum them together like that | |
332 | |
333 // skip is delta from current bcp/bci for target, branch_pc is pre-branch bcp | |
334 | |
335 | |
336 #define DO_BACKEDGE_CHECKS(skip, branch_pc) \ | |
337 if ((skip) <= 0) { \ | |
10233 | 338 MethodCounters* mcs; \ |
339 GET_METHOD_COUNTERS(mcs); \ | |
1078 | 340 if (UseLoopCounter) { \ |
0 | 341 bool do_OSR = UseOnStackReplacement; \ |
10233 | 342 mcs->backedge_counter()->increment(); \ |
343 if (do_OSR) do_OSR = mcs->backedge_counter()->reached_InvocationLimit(); \ | |
0 | 344 if (do_OSR) { \ |
345 nmethod* osr_nmethod; \ | |
346 OSR_REQUEST(osr_nmethod, branch_pc); \ | |
347 if (osr_nmethod != NULL && osr_nmethod->osr_entry_bci() != InvalidOSREntryBci) { \ | |
1078 | 348 intptr_t* buf = SharedRuntime::OSR_migration_begin(THREAD); \ |
0 | 349 istate->set_msg(do_osr); \ |
350 istate->set_osr_buf((address)buf); \ | |
351 istate->set_osr_entry(osr_nmethod->osr_entry()); \ | |
352 return; \ | |
353 } \ | |
354 } \ | |
355 } /* UseCompiler ... */ \ | |
10233 | 356 mcs->invocation_counter()->increment(); \ |
0 | 357 SAFEPOINT; \ |
358 } | |
359 | |
360 /* | |
361 * For those opcodes that need to have a GC point on a backwards branch | |
362 */ | |
363 | |
364 /* | |
365 * Macros for caching and flushing the interpreter state. Some local | |
366 * variables need to be flushed out to the frame before we do certain | |
367 * things (like pushing frames or becomming gc safe) and some need to | |
368 * be recached later (like after popping a frame). We could use one | |
369 * macro to cache or decache everything, but this would be less then | |
370 * optimal because we don't always need to cache or decache everything | |
371 * because some things we know are already cached or decached. | |
372 */ | |
373 #undef DECACHE_TOS | |
374 #undef CACHE_TOS | |
375 #undef CACHE_PREV_TOS | |
376 #define DECACHE_TOS() istate->set_stack(topOfStack); | |
377 | |
378 #define CACHE_TOS() topOfStack = (intptr_t *)istate->stack(); | |
379 | |
380 #undef DECACHE_PC | |
381 #undef CACHE_PC | |
382 #define DECACHE_PC() istate->set_bcp(pc); | |
383 #define CACHE_PC() pc = istate->bcp(); | |
384 #define CACHE_CP() cp = istate->constants(); | |
385 #define CACHE_LOCALS() locals = istate->locals(); | |
386 #undef CACHE_FRAME | |
387 #define CACHE_FRAME() | |
388 | |
389 /* | |
390 * CHECK_NULL - Macro for throwing a NullPointerException if the object | |
391 * passed is a null ref. | |
392 * On some architectures/platforms it should be possible to do this implicitly | |
393 */ | |
394 #undef CHECK_NULL | |
395 #define CHECK_NULL(obj_) \ | |
520
52a431267315
6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents:
196
diff
changeset
|
396 if ((obj_) == NULL) { \ |
0 | 397 VM_JAVA_ERROR(vmSymbols::java_lang_NullPointerException(), ""); \ |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
398 } \ |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
399 VERIFY_OOP(obj_) |
0 | 400 |
401 #define VMdoubleConstZero() 0.0 | |
402 #define VMdoubleConstOne() 1.0 | |
403 #define VMlongConstZero() (max_jlong-max_jlong) | |
404 #define VMlongConstOne() ((max_jlong-max_jlong)+1) | |
405 | |
406 /* | |
407 * Alignment | |
408 */ | |
409 #define VMalignWordUp(val) (((uintptr_t)(val) + 3) & ~3) | |
410 | |
411 // Decache the interpreter state that interpreter modifies directly (i.e. GC is indirect mod) | |
412 #define DECACHE_STATE() DECACHE_PC(); DECACHE_TOS(); | |
413 | |
414 // Reload interpreter state after calling the VM or a possible GC | |
415 #define CACHE_STATE() \ | |
416 CACHE_TOS(); \ | |
417 CACHE_PC(); \ | |
418 CACHE_CP(); \ | |
419 CACHE_LOCALS(); | |
420 | |
421 // Call the VM don't check for pending exceptions | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
422 #define CALL_VM_NOCHECK(func) \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
423 DECACHE_STATE(); \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
424 SET_LAST_JAVA_FRAME(); \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
425 func; \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
426 RESET_LAST_JAVA_FRAME(); \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
427 CACHE_STATE(); \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
428 if (THREAD->pop_frame_pending() && \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
429 !THREAD->pop_frame_in_process()) { \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
430 goto handle_Pop_Frame; \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
431 } \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
432 if (THREAD->jvmti_thread_state() && \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
433 THREAD->jvmti_thread_state()->is_earlyret_pending()) { \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
434 goto handle_Early_Return; \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
435 } |
0 | 436 |
437 // Call the VM and check for pending exceptions | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
438 #define CALL_VM(func, label) { \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
439 CALL_VM_NOCHECK(func); \ |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
440 if (THREAD->has_pending_exception()) goto label; \ |
0 | 441 } |
442 | |
443 /* | |
444 * BytecodeInterpreter::run(interpreterState istate) | |
445 * BytecodeInterpreter::runWithChecks(interpreterState istate) | |
446 * | |
447 * The real deal. This is where byte codes actually get interpreted. | |
448 * Basically it's a big while loop that iterates until we return from | |
449 * the method passed in. | |
450 * | |
451 * The runWithChecks is used if JVMTI is enabled. | |
452 * | |
453 */ | |
454 #if defined(VM_JVMTI) | |
455 void | |
456 BytecodeInterpreter::runWithChecks(interpreterState istate) { | |
457 #else | |
458 void | |
459 BytecodeInterpreter::run(interpreterState istate) { | |
460 #endif | |
461 | |
462 // In order to simplify some tests based on switches set at runtime | |
463 // we invoke the interpreter a single time after switches are enabled | |
464 // and set simpler to to test variables rather than method calls or complex | |
465 // boolean expressions. | |
466 | |
467 static int initialized = 0; | |
468 static int checkit = 0; | |
469 static intptr_t* c_addr = NULL; | |
470 static intptr_t c_value; | |
471 | |
472 if (checkit && *c_addr != c_value) { | |
473 os::breakpoint(); | |
474 } | |
475 #ifdef VM_JVMTI | |
476 static bool _jvmti_interp_events = 0; | |
477 #endif | |
478 | |
479 static int _compiling; // (UseCompiler || CountCompiledCalls) | |
480 | |
481 #ifdef ASSERT | |
482 if (istate->_msg != initialize) { | |
10393
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
483 // We have a problem here if we are running with a pre-hsx24 JDK (for example during bootstrap) |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
484 // because in that case, EnableInvokeDynamic is true by default but will be later switched off |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
485 // if java_lang_invoke_MethodHandle::compute_offsets() detects that the JDK only has the classes |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
486 // for the old JSR292 implementation. |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
487 // This leads to a situation where 'istate->_stack_limit' always accounts for |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
488 // methodOopDesc::extra_stack_entries() because it is computed in |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
489 // CppInterpreterGenerator::generate_compute_interpreter_state() which was generated while |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
490 // EnableInvokeDynamic was still true. On the other hand, istate->_method->max_stack() doesn't |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
491 // account for extra_stack_entries() anymore because at the time when it is called |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
492 // EnableInvokeDynamic was already set to false. |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
493 // So we have a second version of the assertion which handles the case where EnableInvokeDynamic was |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
494 // switched off because of the wrong classes. |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
495 if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) { |
11046
6a0ead6dc6db
8017531: 8010460 changes broke bytecodeInterpreter.cpp
goetz
parents:
10393
diff
changeset
|
496 assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit"); |
10393
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
497 } else { |
11046
6a0ead6dc6db
8017531: 8010460 changes broke bytecodeInterpreter.cpp
goetz
parents:
10393
diff
changeset
|
498 const int extra_stack_entries = Method::extra_stack_entries_for_jsr292; |
10393
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
499 assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
500 + 1), "bad stack limit"); |
603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
roland
parents:
10233
diff
changeset
|
501 } |
1729 | 502 #ifndef SHARK |
503 IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong")); | |
504 #endif // !SHARK | |
0 | 505 } |
506 // Verify linkages. | |
507 interpreterState l = istate; | |
508 do { | |
509 assert(l == l->_self_link, "bad link"); | |
510 l = l->_prev_link; | |
511 } while (l != NULL); | |
512 // Screwups with stack management usually cause us to overwrite istate | |
513 // save a copy so we can verify it. | |
514 interpreterState orig = istate; | |
515 #endif | |
516 | |
517 register intptr_t* topOfStack = (intptr_t *)istate->stack(); /* access with STACK macros */ | |
518 register address pc = istate->bcp(); | |
519 register jubyte opcode; | |
520 register intptr_t* locals = istate->locals(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
521 register ConstantPoolCache* cp = istate->constants(); // method()->constants()->cache() |
0 | 522 #ifdef LOTS_OF_REGS |
523 register JavaThread* THREAD = istate->thread(); | |
524 #else | |
525 #undef THREAD | |
526 #define THREAD istate->thread() | |
527 #endif | |
528 | |
529 #ifdef USELABELS | |
530 const static void* const opclabels_data[256] = { | |
531 /* 0x00 */ &&opc_nop, &&opc_aconst_null,&&opc_iconst_m1,&&opc_iconst_0, | |
532 /* 0x04 */ &&opc_iconst_1,&&opc_iconst_2, &&opc_iconst_3, &&opc_iconst_4, | |
533 /* 0x08 */ &&opc_iconst_5,&&opc_lconst_0, &&opc_lconst_1, &&opc_fconst_0, | |
534 /* 0x0C */ &&opc_fconst_1,&&opc_fconst_2, &&opc_dconst_0, &&opc_dconst_1, | |
535 | |
536 /* 0x10 */ &&opc_bipush, &&opc_sipush, &&opc_ldc, &&opc_ldc_w, | |
537 /* 0x14 */ &&opc_ldc2_w, &&opc_iload, &&opc_lload, &&opc_fload, | |
538 /* 0x18 */ &&opc_dload, &&opc_aload, &&opc_iload_0,&&opc_iload_1, | |
539 /* 0x1C */ &&opc_iload_2,&&opc_iload_3,&&opc_lload_0,&&opc_lload_1, | |
540 | |
541 /* 0x20 */ &&opc_lload_2,&&opc_lload_3,&&opc_fload_0,&&opc_fload_1, | |
542 /* 0x24 */ &&opc_fload_2,&&opc_fload_3,&&opc_dload_0,&&opc_dload_1, | |
543 /* 0x28 */ &&opc_dload_2,&&opc_dload_3,&&opc_aload_0,&&opc_aload_1, | |
544 /* 0x2C */ &&opc_aload_2,&&opc_aload_3,&&opc_iaload, &&opc_laload, | |
545 | |
546 /* 0x30 */ &&opc_faload, &&opc_daload, &&opc_aaload, &&opc_baload, | |
547 /* 0x34 */ &&opc_caload, &&opc_saload, &&opc_istore, &&opc_lstore, | |
548 /* 0x38 */ &&opc_fstore, &&opc_dstore, &&opc_astore, &&opc_istore_0, | |
549 /* 0x3C */ &&opc_istore_1,&&opc_istore_2,&&opc_istore_3,&&opc_lstore_0, | |
550 | |
551 /* 0x40 */ &&opc_lstore_1,&&opc_lstore_2,&&opc_lstore_3,&&opc_fstore_0, | |
552 /* 0x44 */ &&opc_fstore_1,&&opc_fstore_2,&&opc_fstore_3,&&opc_dstore_0, | |
553 /* 0x48 */ &&opc_dstore_1,&&opc_dstore_2,&&opc_dstore_3,&&opc_astore_0, | |
554 /* 0x4C */ &&opc_astore_1,&&opc_astore_2,&&opc_astore_3,&&opc_iastore, | |
555 | |
556 /* 0x50 */ &&opc_lastore,&&opc_fastore,&&opc_dastore,&&opc_aastore, | |
557 /* 0x54 */ &&opc_bastore,&&opc_castore,&&opc_sastore,&&opc_pop, | |
558 /* 0x58 */ &&opc_pop2, &&opc_dup, &&opc_dup_x1, &&opc_dup_x2, | |
559 /* 0x5C */ &&opc_dup2, &&opc_dup2_x1,&&opc_dup2_x2,&&opc_swap, | |
560 | |
561 /* 0x60 */ &&opc_iadd,&&opc_ladd,&&opc_fadd,&&opc_dadd, | |
562 /* 0x64 */ &&opc_isub,&&opc_lsub,&&opc_fsub,&&opc_dsub, | |
563 /* 0x68 */ &&opc_imul,&&opc_lmul,&&opc_fmul,&&opc_dmul, | |
564 /* 0x6C */ &&opc_idiv,&&opc_ldiv,&&opc_fdiv,&&opc_ddiv, | |
565 | |
566 /* 0x70 */ &&opc_irem, &&opc_lrem, &&opc_frem,&&opc_drem, | |
567 /* 0x74 */ &&opc_ineg, &&opc_lneg, &&opc_fneg,&&opc_dneg, | |
568 /* 0x78 */ &&opc_ishl, &&opc_lshl, &&opc_ishr,&&opc_lshr, | |
569 /* 0x7C */ &&opc_iushr,&&opc_lushr,&&opc_iand,&&opc_land, | |
570 | |
571 /* 0x80 */ &&opc_ior, &&opc_lor,&&opc_ixor,&&opc_lxor, | |
572 /* 0x84 */ &&opc_iinc,&&opc_i2l,&&opc_i2f, &&opc_i2d, | |
573 /* 0x88 */ &&opc_l2i, &&opc_l2f,&&opc_l2d, &&opc_f2i, | |
574 /* 0x8C */ &&opc_f2l, &&opc_f2d,&&opc_d2i, &&opc_d2l, | |
575 | |
576 /* 0x90 */ &&opc_d2f, &&opc_i2b, &&opc_i2c, &&opc_i2s, | |
577 /* 0x94 */ &&opc_lcmp, &&opc_fcmpl,&&opc_fcmpg,&&opc_dcmpl, | |
578 /* 0x98 */ &&opc_dcmpg,&&opc_ifeq, &&opc_ifne, &&opc_iflt, | |
579 /* 0x9C */ &&opc_ifge, &&opc_ifgt, &&opc_ifle, &&opc_if_icmpeq, | |
580 | |
581 /* 0xA0 */ &&opc_if_icmpne,&&opc_if_icmplt,&&opc_if_icmpge, &&opc_if_icmpgt, | |
582 /* 0xA4 */ &&opc_if_icmple,&&opc_if_acmpeq,&&opc_if_acmpne, &&opc_goto, | |
583 /* 0xA8 */ &&opc_jsr, &&opc_ret, &&opc_tableswitch,&&opc_lookupswitch, | |
584 /* 0xAC */ &&opc_ireturn, &&opc_lreturn, &&opc_freturn, &&opc_dreturn, | |
585 | |
586 /* 0xB0 */ &&opc_areturn, &&opc_return, &&opc_getstatic, &&opc_putstatic, | |
587 /* 0xB4 */ &&opc_getfield, &&opc_putfield, &&opc_invokevirtual,&&opc_invokespecial, | |
2480 | 588 /* 0xB8 */ &&opc_invokestatic,&&opc_invokeinterface,&&opc_invokedynamic,&&opc_new, |
0 | 589 /* 0xBC */ &&opc_newarray, &&opc_anewarray, &&opc_arraylength, &&opc_athrow, |
590 | |
591 /* 0xC0 */ &&opc_checkcast, &&opc_instanceof, &&opc_monitorenter, &&opc_monitorexit, | |
592 /* 0xC4 */ &&opc_wide, &&opc_multianewarray, &&opc_ifnull, &&opc_ifnonnull, | |
123 | 593 /* 0xC8 */ &&opc_goto_w, &&opc_jsr_w, &&opc_breakpoint, &&opc_default, |
594 /* 0xCC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
595 | |
596 /* 0xD0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
0 | 597 /* 0xD4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
598 /* 0xD8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
599 /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
600 | |
601 /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
2480 | 602 /* 0xE4 */ &&opc_default, &&opc_fast_aldc, &&opc_fast_aldc_w, &&opc_return_register_finalizer, |
6926 | 603 /* 0xE8 */ &&opc_invokehandle,&&opc_default, &&opc_default, &&opc_default, |
0 | 604 /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, |
605 | |
606 /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
607 /* 0xF4 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
608 /* 0xF8 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, | |
609 /* 0xFC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default | |
610 }; | |
611 register uintptr_t *dispatch_table = (uintptr_t*)&opclabels_data[0]; | |
612 #endif /* USELABELS */ | |
613 | |
614 #ifdef ASSERT | |
615 // this will trigger a VERIFY_OOP on entry | |
616 if (istate->msg() != initialize && ! METHOD->is_static()) { | |
617 oop rcvr = LOCALS_OBJECT(0); | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
618 VERIFY_OOP(rcvr); |
0 | 619 } |
620 #endif | |
621 // #define HACK | |
622 #ifdef HACK | |
623 bool interesting = false; | |
624 #endif // HACK | |
625 | |
626 /* QQQ this should be a stack method so we don't know actual direction */ | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
627 guarantee(istate->msg() == initialize || |
0 | 628 topOfStack >= istate->stack_limit() && |
629 topOfStack < istate->stack_base(), | |
630 "Stack top out of range"); | |
631 | |
632 switch (istate->msg()) { | |
633 case initialize: { | |
634 if (initialized++) ShouldNotReachHere(); // Only one initialize call | |
635 _compiling = (UseCompiler || CountCompiledCalls); | |
636 #ifdef VM_JVMTI | |
637 _jvmti_interp_events = JvmtiExport::can_post_interpreter_events(); | |
638 #endif | |
639 return; | |
640 } | |
641 break; | |
642 case method_entry: { | |
643 THREAD->set_do_not_unlock(); | |
644 // count invocations | |
645 assert(initialized, "Interpreter not initialized"); | |
646 if (_compiling) { | |
10233 | 647 MethodCounters* mcs; |
648 GET_METHOD_COUNTERS(mcs); | |
0 | 649 if (ProfileInterpreter) { |
10233 | 650 METHOD->increment_interpreter_invocation_count(THREAD); |
0 | 651 } |
10233 | 652 mcs->invocation_counter()->increment(); |
653 if (mcs->invocation_counter()->reached_InvocationLimit()) { | |
0 | 654 CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception); |
655 | |
656 // We no longer retry on a counter overflow | |
657 | |
658 // istate->set_msg(retry_method); | |
659 // THREAD->clr_do_not_unlock(); | |
660 // return; | |
661 } | |
662 SAFEPOINT; | |
663 } | |
664 | |
665 if ((istate->_stack_base - istate->_stack_limit) != istate->method()->max_stack() + 1) { | |
666 // initialize | |
667 os::breakpoint(); | |
668 } | |
669 | |
670 #ifdef HACK | |
671 { | |
672 ResourceMark rm; | |
673 char *method_name = istate->method()->name_and_sig_as_C_string(); | |
674 if (strstr(method_name, "runThese$TestRunner.run()V") != NULL) { | |
675 tty->print_cr("entering: depth %d bci: %d", | |
676 (istate->_stack_base - istate->_stack), | |
677 istate->_bcp - istate->_method->code_base()); | |
678 interesting = true; | |
679 } | |
680 } | |
681 #endif // HACK | |
682 | |
683 | |
684 // lock method if synchronized | |
685 if (METHOD->is_synchronized()) { | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
686 // oop rcvr = locals[0].j.r; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
687 oop rcvr; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
688 if (METHOD->is_static()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
689 rcvr = METHOD->constants()->pool_holder()->java_mirror(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
690 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
691 rcvr = LOCALS_OBJECT(0); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
692 VERIFY_OOP(rcvr); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
693 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
694 // The initial monitor is ours for the taking |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
695 // Monitor not filled in frame manager any longer as this caused race condition with biased locking. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
696 BasicObjectLock* mon = &istate->monitor_base()[-1]; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
697 mon->set_obj(rcvr); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
698 bool success = false; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
699 uintptr_t epoch_mask_in_place = (uintptr_t)markOopDesc::epoch_mask_in_place; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
700 markOop mark = rcvr->mark(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
701 intptr_t hash = (intptr_t) markOopDesc::no_hash; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
702 // Implies UseBiasedLocking. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
703 if (mark->has_bias_pattern()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
704 uintptr_t thread_ident; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
705 uintptr_t anticipated_bias_locking_value; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
706 thread_ident = (uintptr_t)istate->thread(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
707 anticipated_bias_locking_value = |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
708 (((uintptr_t)rcvr->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) & |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
709 ~((uintptr_t) markOopDesc::age_mask_in_place); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
710 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
711 if (anticipated_bias_locking_value == 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
712 // Already biased towards this thread, nothing to do. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
713 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
714 (* BiasedLocking::biased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
715 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
716 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
717 } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
718 // Try to revoke bias. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
719 markOop header = rcvr->klass()->prototype_header(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
720 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
721 header = header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
722 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
723 if (Atomic::cmpxchg_ptr(header, rcvr->mark_addr(), mark) == mark) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
724 if (PrintBiasedLockingStatistics) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
725 (*BiasedLocking::revoked_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
726 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
727 } else if ((anticipated_bias_locking_value & epoch_mask_in_place) != 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
728 // Try to rebias. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
729 markOop new_header = (markOop) ( (intptr_t) rcvr->klass()->prototype_header() | thread_ident); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
730 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
731 new_header = new_header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
732 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
733 if (Atomic::cmpxchg_ptr((void*)new_header, rcvr->mark_addr(), mark) == mark) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
734 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
735 (* BiasedLocking::rebiased_lock_entry_count_addr())++; |
0 | 736 } |
737 } else { | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
738 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
739 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
740 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
741 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
742 // Try to bias towards thread in case object is anonymously biased. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
743 markOop header = (markOop) ((uintptr_t) mark & |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
744 ((uintptr_t)markOopDesc::biased_lock_mask_in_place | |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
745 (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place)); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
746 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
747 header = header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
748 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
749 markOop new_header = (markOop) ((uintptr_t) header | thread_ident); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
750 // Debugging hint. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
751 DEBUG_ONLY(mon->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
752 if (Atomic::cmpxchg_ptr((void*)new_header, rcvr->mark_addr(), header) == header) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
753 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
754 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
755 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
756 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
757 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
758 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
759 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
760 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
761 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
762 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
763 // Traditional lightweight locking. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
764 if (!success) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
765 markOop displaced = rcvr->mark()->set_unlocked(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
766 mon->lock()->set_displaced_header(displaced); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
767 bool call_vm = UseHeavyMonitors; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
768 if (call_vm || Atomic::cmpxchg_ptr(mon, rcvr->mark_addr(), displaced) != displaced) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
769 // Is it simple recursive case? |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
770 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
771 mon->lock()->set_displaced_header(NULL); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
772 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
773 CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception); |
0 | 774 } |
775 } | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
776 } |
0 | 777 } |
778 THREAD->clr_do_not_unlock(); | |
779 | |
780 // Notify jvmti | |
781 #ifdef VM_JVMTI | |
782 if (_jvmti_interp_events) { | |
783 // Whenever JVMTI puts a thread in interp_only_mode, method | |
784 // entry/exit events are sent for that thread to track stack depth. | |
785 if (THREAD->is_interp_only_mode()) { | |
786 CALL_VM(InterpreterRuntime::post_method_entry(THREAD), | |
787 handle_exception); | |
788 } | |
789 } | |
790 #endif /* VM_JVMTI */ | |
791 | |
792 goto run; | |
793 } | |
794 | |
795 case popping_frame: { | |
796 // returned from a java call to pop the frame, restart the call | |
797 // clear the message so we don't confuse ourselves later | |
798 assert(THREAD->pop_frame_in_process(), "wrong frame pop state"); | |
799 istate->set_msg(no_request); | |
800 THREAD->clr_pop_frame_in_process(); | |
801 goto run; | |
802 } | |
803 | |
804 case method_resume: { | |
805 if ((istate->_stack_base - istate->_stack_limit) != istate->method()->max_stack() + 1) { | |
806 // resume | |
807 os::breakpoint(); | |
808 } | |
809 #ifdef HACK | |
810 { | |
811 ResourceMark rm; | |
812 char *method_name = istate->method()->name_and_sig_as_C_string(); | |
813 if (strstr(method_name, "runThese$TestRunner.run()V") != NULL) { | |
814 tty->print_cr("resume: depth %d bci: %d", | |
815 (istate->_stack_base - istate->_stack) , | |
816 istate->_bcp - istate->_method->code_base()); | |
817 interesting = true; | |
818 } | |
819 } | |
820 #endif // HACK | |
821 // returned from a java call, continue executing. | |
822 if (THREAD->pop_frame_pending() && !THREAD->pop_frame_in_process()) { | |
823 goto handle_Pop_Frame; | |
824 } | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
825 if (THREAD->jvmti_thread_state() && |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
826 THREAD->jvmti_thread_state()->is_earlyret_pending()) { |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
827 goto handle_Early_Return; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
828 } |
0 | 829 |
830 if (THREAD->has_pending_exception()) goto handle_exception; | |
831 // Update the pc by the saved amount of the invoke bytecode size | |
832 UPDATE_PC(istate->bcp_advance()); | |
833 goto run; | |
834 } | |
835 | |
836 case deopt_resume2: { | |
837 // Returned from an opcode that will reexecute. Deopt was | |
838 // a result of a PopFrame request. | |
839 // | |
840 goto run; | |
841 } | |
842 | |
843 case deopt_resume: { | |
844 // Returned from an opcode that has completed. The stack has | |
845 // the result all we need to do is skip across the bytecode | |
846 // and continue (assuming there is no exception pending) | |
847 // | |
848 // compute continuation length | |
849 // | |
850 // Note: it is possible to deopt at a return_register_finalizer opcode | |
851 // because this requires entering the vm to do the registering. While the | |
852 // opcode is complete we can't advance because there are no more opcodes | |
853 // much like trying to deopt at a poll return. In that has we simply | |
854 // get out of here | |
855 // | |
2142 | 856 if ( Bytecodes::code_at(METHOD, pc) == Bytecodes::_return_register_finalizer) { |
0 | 857 // this will do the right thing even if an exception is pending. |
858 goto handle_return; | |
859 } | |
2142 | 860 UPDATE_PC(Bytecodes::length_at(METHOD, pc)); |
0 | 861 if (THREAD->has_pending_exception()) goto handle_exception; |
862 goto run; | |
863 } | |
864 case got_monitors: { | |
865 // continue locking now that we have a monitor to use | |
866 // we expect to find newly allocated monitor at the "top" of the monitor stack. | |
867 oop lockee = STACK_OBJECT(-1); | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
868 VERIFY_OOP(lockee); |
0 | 869 // derefing's lockee ought to provoke implicit null check |
870 // find a free monitor | |
871 BasicObjectLock* entry = (BasicObjectLock*) istate->stack_base(); | |
872 assert(entry->obj() == NULL, "Frame manager didn't allocate the monitor"); | |
873 entry->set_obj(lockee); | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
874 bool success = false; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
875 uintptr_t epoch_mask_in_place = (uintptr_t)markOopDesc::epoch_mask_in_place; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
876 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
877 markOop mark = lockee->mark(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
878 intptr_t hash = (intptr_t) markOopDesc::no_hash; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
879 // implies UseBiasedLocking |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
880 if (mark->has_bias_pattern()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
881 uintptr_t thread_ident; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
882 uintptr_t anticipated_bias_locking_value; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
883 thread_ident = (uintptr_t)istate->thread(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
884 anticipated_bias_locking_value = |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
885 (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) & |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
886 ~((uintptr_t) markOopDesc::age_mask_in_place); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
887 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
888 if (anticipated_bias_locking_value == 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
889 // already biased towards this thread, nothing to do |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
890 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
891 (* BiasedLocking::biased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
892 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
893 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
894 } else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
895 // try revoke bias |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
896 markOop header = lockee->klass()->prototype_header(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
897 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
898 header = header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
899 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
900 if (Atomic::cmpxchg_ptr(header, lockee->mark_addr(), mark) == mark) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
901 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
902 (*BiasedLocking::revoked_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
903 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
904 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
905 } else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
906 // try rebias |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
907 markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
908 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
909 new_header = new_header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
910 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
911 if (Atomic::cmpxchg_ptr((void*)new_header, lockee->mark_addr(), mark) == mark) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
912 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
913 (* BiasedLocking::rebiased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
914 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
915 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
916 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
917 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
918 success = true; |
0 | 919 } else { |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
920 // try to bias towards thread in case object is anonymously biased |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
921 markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place | |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
922 (uintptr_t)markOopDesc::age_mask_in_place | epoch_mask_in_place)); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
923 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
924 header = header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
925 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
926 markOop new_header = (markOop) ((uintptr_t) header | thread_ident); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
927 // debugging hint |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
928 DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
929 if (Atomic::cmpxchg_ptr((void*)new_header, lockee->mark_addr(), header) == header) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
930 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
931 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
932 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
933 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
934 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
935 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
936 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
937 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
938 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
939 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
940 // traditional lightweight locking |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
941 if (!success) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
942 markOop displaced = lockee->mark()->set_unlocked(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
943 entry->lock()->set_displaced_header(displaced); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
944 bool call_vm = UseHeavyMonitors; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
945 if (call_vm || Atomic::cmpxchg_ptr(entry, lockee->mark_addr(), displaced) != displaced) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
946 // Is it simple recursive case? |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
947 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
948 entry->lock()->set_displaced_header(NULL); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
949 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
950 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
951 } |
0 | 952 } |
953 } | |
954 UPDATE_PC_AND_TOS(1, -1); | |
955 goto run; | |
956 } | |
957 default: { | |
958 fatal("Unexpected message from frame manager"); | |
959 } | |
960 } | |
961 | |
962 run: | |
963 | |
964 DO_UPDATE_INSTRUCTION_COUNT(*pc) | |
965 DEBUGGER_SINGLE_STEP_NOTIFY(); | |
966 #ifdef PREFETCH_OPCCODE | |
967 opcode = *pc; /* prefetch first opcode */ | |
968 #endif | |
969 | |
970 #ifndef USELABELS | |
971 while (1) | |
972 #endif | |
973 { | |
974 #ifndef PREFETCH_OPCCODE | |
975 opcode = *pc; | |
976 #endif | |
977 // Seems like this happens twice per opcode. At worst this is only | |
978 // need at entry to the loop. | |
979 // DEBUGGER_SINGLE_STEP_NOTIFY(); | |
980 /* Using this labels avoids double breakpoints when quickening and | |
981 * when returing from transition frames. | |
982 */ | |
983 opcode_switch: | |
984 assert(istate == orig, "Corrupted istate"); | |
985 /* QQQ Hmm this has knowledge of direction, ought to be a stack method */ | |
986 assert(topOfStack >= istate->stack_limit(), "Stack overrun"); | |
987 assert(topOfStack < istate->stack_base(), "Stack underrun"); | |
988 | |
989 #ifdef USELABELS | |
990 DISPATCH(opcode); | |
991 #else | |
992 switch (opcode) | |
993 #endif | |
994 { | |
995 CASE(_nop): | |
996 UPDATE_PC_AND_CONTINUE(1); | |
997 | |
998 /* Push miscellaneous constants onto the stack. */ | |
999 | |
1000 CASE(_aconst_null): | |
1001 SET_STACK_OBJECT(NULL, 0); | |
1002 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1003 | |
1004 #undef OPC_CONST_n | |
1005 #define OPC_CONST_n(opcode, const_type, value) \ | |
1006 CASE(opcode): \ | |
1007 SET_STACK_ ## const_type(value, 0); \ | |
1008 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1009 | |
1010 OPC_CONST_n(_iconst_m1, INT, -1); | |
1011 OPC_CONST_n(_iconst_0, INT, 0); | |
1012 OPC_CONST_n(_iconst_1, INT, 1); | |
1013 OPC_CONST_n(_iconst_2, INT, 2); | |
1014 OPC_CONST_n(_iconst_3, INT, 3); | |
1015 OPC_CONST_n(_iconst_4, INT, 4); | |
1016 OPC_CONST_n(_iconst_5, INT, 5); | |
1017 OPC_CONST_n(_fconst_0, FLOAT, 0.0); | |
1018 OPC_CONST_n(_fconst_1, FLOAT, 1.0); | |
1019 OPC_CONST_n(_fconst_2, FLOAT, 2.0); | |
1020 | |
1021 #undef OPC_CONST2_n | |
1022 #define OPC_CONST2_n(opcname, value, key, kind) \ | |
1023 CASE(_##opcname): \ | |
1024 { \ | |
1025 SET_STACK_ ## kind(VM##key##Const##value(), 1); \ | |
1026 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); \ | |
1027 } | |
1028 OPC_CONST2_n(dconst_0, Zero, double, DOUBLE); | |
1029 OPC_CONST2_n(dconst_1, One, double, DOUBLE); | |
1030 OPC_CONST2_n(lconst_0, Zero, long, LONG); | |
1031 OPC_CONST2_n(lconst_1, One, long, LONG); | |
1032 | |
1033 /* Load constant from constant pool: */ | |
1034 | |
1035 /* Push a 1-byte signed integer value onto the stack. */ | |
1036 CASE(_bipush): | |
1037 SET_STACK_INT((jbyte)(pc[1]), 0); | |
1038 UPDATE_PC_AND_TOS_AND_CONTINUE(2, 1); | |
1039 | |
1040 /* Push a 2-byte signed integer constant onto the stack. */ | |
1041 CASE(_sipush): | |
1042 SET_STACK_INT((int16_t)Bytes::get_Java_u2(pc + 1), 0); | |
1043 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); | |
1044 | |
1045 /* load from local variable */ | |
1046 | |
1047 CASE(_aload): | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1048 VERIFY_OOP(LOCALS_OBJECT(pc[1])); |
0 | 1049 SET_STACK_OBJECT(LOCALS_OBJECT(pc[1]), 0); |
1050 UPDATE_PC_AND_TOS_AND_CONTINUE(2, 1); | |
1051 | |
1052 CASE(_iload): | |
1053 CASE(_fload): | |
1054 SET_STACK_SLOT(LOCALS_SLOT(pc[1]), 0); | |
1055 UPDATE_PC_AND_TOS_AND_CONTINUE(2, 1); | |
1056 | |
1057 CASE(_lload): | |
1058 SET_STACK_LONG_FROM_ADDR(LOCALS_LONG_AT(pc[1]), 1); | |
1059 UPDATE_PC_AND_TOS_AND_CONTINUE(2, 2); | |
1060 | |
1061 CASE(_dload): | |
1062 SET_STACK_DOUBLE_FROM_ADDR(LOCALS_DOUBLE_AT(pc[1]), 1); | |
1063 UPDATE_PC_AND_TOS_AND_CONTINUE(2, 2); | |
1064 | |
1065 #undef OPC_LOAD_n | |
1066 #define OPC_LOAD_n(num) \ | |
1067 CASE(_aload_##num): \ | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1068 VERIFY_OOP(LOCALS_OBJECT(num)); \ |
0 | 1069 SET_STACK_OBJECT(LOCALS_OBJECT(num), 0); \ |
1070 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); \ | |
1071 \ | |
1072 CASE(_iload_##num): \ | |
1073 CASE(_fload_##num): \ | |
1074 SET_STACK_SLOT(LOCALS_SLOT(num), 0); \ | |
1075 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); \ | |
1076 \ | |
1077 CASE(_lload_##num): \ | |
1078 SET_STACK_LONG_FROM_ADDR(LOCALS_LONG_AT(num), 1); \ | |
1079 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); \ | |
1080 CASE(_dload_##num): \ | |
1081 SET_STACK_DOUBLE_FROM_ADDR(LOCALS_DOUBLE_AT(num), 1); \ | |
1082 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1083 | |
1084 OPC_LOAD_n(0); | |
1085 OPC_LOAD_n(1); | |
1086 OPC_LOAD_n(2); | |
1087 OPC_LOAD_n(3); | |
1088 | |
1089 /* store to a local variable */ | |
1090 | |
1091 CASE(_astore): | |
1092 astore(topOfStack, -1, locals, pc[1]); | |
1093 UPDATE_PC_AND_TOS_AND_CONTINUE(2, -1); | |
1094 | |
1095 CASE(_istore): | |
1096 CASE(_fstore): | |
1097 SET_LOCALS_SLOT(STACK_SLOT(-1), pc[1]); | |
1098 UPDATE_PC_AND_TOS_AND_CONTINUE(2, -1); | |
1099 | |
1100 CASE(_lstore): | |
1101 SET_LOCALS_LONG(STACK_LONG(-1), pc[1]); | |
1102 UPDATE_PC_AND_TOS_AND_CONTINUE(2, -2); | |
1103 | |
1104 CASE(_dstore): | |
1105 SET_LOCALS_DOUBLE(STACK_DOUBLE(-1), pc[1]); | |
1106 UPDATE_PC_AND_TOS_AND_CONTINUE(2, -2); | |
1107 | |
1108 CASE(_wide): { | |
1109 uint16_t reg = Bytes::get_Java_u2(pc + 2); | |
1110 | |
1111 opcode = pc[1]; | |
1112 switch(opcode) { | |
1113 case Bytecodes::_aload: | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1114 VERIFY_OOP(LOCALS_OBJECT(reg)); |
0 | 1115 SET_STACK_OBJECT(LOCALS_OBJECT(reg), 0); |
1116 UPDATE_PC_AND_TOS_AND_CONTINUE(4, 1); | |
1117 | |
1118 case Bytecodes::_iload: | |
1119 case Bytecodes::_fload: | |
1120 SET_STACK_SLOT(LOCALS_SLOT(reg), 0); | |
1121 UPDATE_PC_AND_TOS_AND_CONTINUE(4, 1); | |
1122 | |
1123 case Bytecodes::_lload: | |
1124 SET_STACK_LONG_FROM_ADDR(LOCALS_LONG_AT(reg), 1); | |
1125 UPDATE_PC_AND_TOS_AND_CONTINUE(4, 2); | |
1126 | |
1127 case Bytecodes::_dload: | |
1128 SET_STACK_DOUBLE_FROM_ADDR(LOCALS_LONG_AT(reg), 1); | |
1129 UPDATE_PC_AND_TOS_AND_CONTINUE(4, 2); | |
1130 | |
1131 case Bytecodes::_astore: | |
1132 astore(topOfStack, -1, locals, reg); | |
1133 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -1); | |
1134 | |
1135 case Bytecodes::_istore: | |
1136 case Bytecodes::_fstore: | |
1137 SET_LOCALS_SLOT(STACK_SLOT(-1), reg); | |
1138 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -1); | |
1139 | |
1140 case Bytecodes::_lstore: | |
1141 SET_LOCALS_LONG(STACK_LONG(-1), reg); | |
1142 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -2); | |
1143 | |
1144 case Bytecodes::_dstore: | |
1145 SET_LOCALS_DOUBLE(STACK_DOUBLE(-1), reg); | |
1146 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -2); | |
1147 | |
1148 case Bytecodes::_iinc: { | |
1149 int16_t offset = (int16_t)Bytes::get_Java_u2(pc+4); | |
1150 // Be nice to see what this generates.... QQQ | |
1151 SET_LOCALS_INT(LOCALS_INT(reg) + offset, reg); | |
1152 UPDATE_PC_AND_CONTINUE(6); | |
1153 } | |
1154 case Bytecodes::_ret: | |
1155 pc = istate->method()->code_base() + (intptr_t)(LOCALS_ADDR(reg)); | |
1156 UPDATE_PC_AND_CONTINUE(0); | |
1157 default: | |
1158 VM_JAVA_ERROR(vmSymbols::java_lang_InternalError(), "undefined opcode"); | |
1159 } | |
1160 } | |
1161 | |
1162 | |
1163 #undef OPC_STORE_n | |
1164 #define OPC_STORE_n(num) \ | |
1165 CASE(_astore_##num): \ | |
1166 astore(topOfStack, -1, locals, num); \ | |
1167 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \ | |
1168 CASE(_istore_##num): \ | |
1169 CASE(_fstore_##num): \ | |
1170 SET_LOCALS_SLOT(STACK_SLOT(-1), num); \ | |
1171 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); | |
1172 | |
1173 OPC_STORE_n(0); | |
1174 OPC_STORE_n(1); | |
1175 OPC_STORE_n(2); | |
1176 OPC_STORE_n(3); | |
1177 | |
1178 #undef OPC_DSTORE_n | |
1179 #define OPC_DSTORE_n(num) \ | |
1180 CASE(_dstore_##num): \ | |
1181 SET_LOCALS_DOUBLE(STACK_DOUBLE(-1), num); \ | |
1182 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -2); \ | |
1183 CASE(_lstore_##num): \ | |
1184 SET_LOCALS_LONG(STACK_LONG(-1), num); \ | |
1185 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -2); | |
1186 | |
1187 OPC_DSTORE_n(0); | |
1188 OPC_DSTORE_n(1); | |
1189 OPC_DSTORE_n(2); | |
1190 OPC_DSTORE_n(3); | |
1191 | |
1192 /* stack pop, dup, and insert opcodes */ | |
1193 | |
1194 | |
1195 CASE(_pop): /* Discard the top item on the stack */ | |
1196 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); | |
1197 | |
1198 | |
1199 CASE(_pop2): /* Discard the top 2 items on the stack */ | |
1200 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -2); | |
1201 | |
1202 | |
1203 CASE(_dup): /* Duplicate the top item on the stack */ | |
1204 dup(topOfStack); | |
1205 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1206 | |
1207 CASE(_dup2): /* Duplicate the top 2 items on the stack */ | |
1208 dup2(topOfStack); | |
1209 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1210 | |
1211 CASE(_dup_x1): /* insert top word two down */ | |
1212 dup_x1(topOfStack); | |
1213 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1214 | |
1215 CASE(_dup_x2): /* insert top word three down */ | |
1216 dup_x2(topOfStack); | |
1217 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1218 | |
1219 CASE(_dup2_x1): /* insert top 2 slots three down */ | |
1220 dup2_x1(topOfStack); | |
1221 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1222 | |
1223 CASE(_dup2_x2): /* insert top 2 slots four down */ | |
1224 dup2_x2(topOfStack); | |
1225 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1226 | |
1227 CASE(_swap): { /* swap top two elements on the stack */ | |
1228 swap(topOfStack); | |
1229 UPDATE_PC_AND_CONTINUE(1); | |
1230 } | |
1231 | |
1232 /* Perform various binary integer operations */ | |
1233 | |
1234 #undef OPC_INT_BINARY | |
1235 #define OPC_INT_BINARY(opcname, opname, test) \ | |
1236 CASE(_i##opcname): \ | |
1237 if (test && (STACK_INT(-1) == 0)) { \ | |
1238 VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \ | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1239 "/ by zero"); \ |
0 | 1240 } \ |
1241 SET_STACK_INT(VMint##opname(STACK_INT(-2), \ | |
1242 STACK_INT(-1)), \ | |
1243 -2); \ | |
1244 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \ | |
1245 CASE(_l##opcname): \ | |
1246 { \ | |
1247 if (test) { \ | |
1248 jlong l1 = STACK_LONG(-1); \ | |
1249 if (VMlongEqz(l1)) { \ | |
1250 VM_JAVA_ERROR(vmSymbols::java_lang_ArithmeticException(), \ | |
1251 "/ by long zero"); \ | |
1252 } \ | |
1253 } \ | |
1254 /* First long at (-1,-2) next long at (-3,-4) */ \ | |
1255 SET_STACK_LONG(VMlong##opname(STACK_LONG(-3), \ | |
1256 STACK_LONG(-1)), \ | |
1257 -3); \ | |
1258 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -2); \ | |
1259 } | |
1260 | |
1261 OPC_INT_BINARY(add, Add, 0); | |
1262 OPC_INT_BINARY(sub, Sub, 0); | |
1263 OPC_INT_BINARY(mul, Mul, 0); | |
1264 OPC_INT_BINARY(and, And, 0); | |
1265 OPC_INT_BINARY(or, Or, 0); | |
1266 OPC_INT_BINARY(xor, Xor, 0); | |
1267 OPC_INT_BINARY(div, Div, 1); | |
1268 OPC_INT_BINARY(rem, Rem, 1); | |
1269 | |
1270 | |
1271 /* Perform various binary floating number operations */ | |
1272 /* On some machine/platforms/compilers div zero check can be implicit */ | |
1273 | |
1274 #undef OPC_FLOAT_BINARY | |
1275 #define OPC_FLOAT_BINARY(opcname, opname) \ | |
1276 CASE(_d##opcname): { \ | |
1277 SET_STACK_DOUBLE(VMdouble##opname(STACK_DOUBLE(-3), \ | |
1278 STACK_DOUBLE(-1)), \ | |
1279 -3); \ | |
1280 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -2); \ | |
1281 } \ | |
1282 CASE(_f##opcname): \ | |
1283 SET_STACK_FLOAT(VMfloat##opname(STACK_FLOAT(-2), \ | |
1284 STACK_FLOAT(-1)), \ | |
1285 -2); \ | |
1286 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); | |
1287 | |
1288 | |
1289 OPC_FLOAT_BINARY(add, Add); | |
1290 OPC_FLOAT_BINARY(sub, Sub); | |
1291 OPC_FLOAT_BINARY(mul, Mul); | |
1292 OPC_FLOAT_BINARY(div, Div); | |
1293 OPC_FLOAT_BINARY(rem, Rem); | |
1294 | |
1295 /* Shift operations | |
1296 * Shift left int and long: ishl, lshl | |
1297 * Logical shift right int and long w/zero extension: iushr, lushr | |
1298 * Arithmetic shift right int and long w/sign extension: ishr, lshr | |
1299 */ | |
1300 | |
1301 #undef OPC_SHIFT_BINARY | |
1302 #define OPC_SHIFT_BINARY(opcname, opname) \ | |
1303 CASE(_i##opcname): \ | |
1304 SET_STACK_INT(VMint##opname(STACK_INT(-2), \ | |
1305 STACK_INT(-1)), \ | |
1306 -2); \ | |
1307 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \ | |
1308 CASE(_l##opcname): \ | |
1309 { \ | |
1310 SET_STACK_LONG(VMlong##opname(STACK_LONG(-2), \ | |
1311 STACK_INT(-1)), \ | |
1312 -2); \ | |
1313 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \ | |
1314 } | |
1315 | |
1316 OPC_SHIFT_BINARY(shl, Shl); | |
1317 OPC_SHIFT_BINARY(shr, Shr); | |
1318 OPC_SHIFT_BINARY(ushr, Ushr); | |
1319 | |
1320 /* Increment local variable by constant */ | |
1321 CASE(_iinc): | |
1322 { | |
1323 // locals[pc[1]].j.i += (jbyte)(pc[2]); | |
1324 SET_LOCALS_INT(LOCALS_INT(pc[1]) + (jbyte)(pc[2]), pc[1]); | |
1325 UPDATE_PC_AND_CONTINUE(3); | |
1326 } | |
1327 | |
1328 /* negate the value on the top of the stack */ | |
1329 | |
1330 CASE(_ineg): | |
1331 SET_STACK_INT(VMintNeg(STACK_INT(-1)), -1); | |
1332 UPDATE_PC_AND_CONTINUE(1); | |
1333 | |
1334 CASE(_fneg): | |
1335 SET_STACK_FLOAT(VMfloatNeg(STACK_FLOAT(-1)), -1); | |
1336 UPDATE_PC_AND_CONTINUE(1); | |
1337 | |
1338 CASE(_lneg): | |
1339 { | |
1340 SET_STACK_LONG(VMlongNeg(STACK_LONG(-1)), -1); | |
1341 UPDATE_PC_AND_CONTINUE(1); | |
1342 } | |
1343 | |
1344 CASE(_dneg): | |
1345 { | |
1346 SET_STACK_DOUBLE(VMdoubleNeg(STACK_DOUBLE(-1)), -1); | |
1347 UPDATE_PC_AND_CONTINUE(1); | |
1348 } | |
1349 | |
1350 /* Conversion operations */ | |
1351 | |
1352 CASE(_i2f): /* convert top of stack int to float */ | |
1353 SET_STACK_FLOAT(VMint2Float(STACK_INT(-1)), -1); | |
1354 UPDATE_PC_AND_CONTINUE(1); | |
1355 | |
1356 CASE(_i2l): /* convert top of stack int to long */ | |
1357 { | |
1358 // this is ugly QQQ | |
1359 jlong r = VMint2Long(STACK_INT(-1)); | |
1360 MORE_STACK(-1); // Pop | |
1361 SET_STACK_LONG(r, 1); | |
1362 | |
1363 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1364 } | |
1365 | |
1366 CASE(_i2d): /* convert top of stack int to double */ | |
1367 { | |
1368 // this is ugly QQQ (why cast to jlong?? ) | |
1369 jdouble r = (jlong)STACK_INT(-1); | |
1370 MORE_STACK(-1); // Pop | |
1371 SET_STACK_DOUBLE(r, 1); | |
1372 | |
1373 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1374 } | |
1375 | |
1376 CASE(_l2i): /* convert top of stack long to int */ | |
1377 { | |
1378 jint r = VMlong2Int(STACK_LONG(-1)); | |
1379 MORE_STACK(-2); // Pop | |
1380 SET_STACK_INT(r, 0); | |
1381 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1382 } | |
1383 | |
1384 CASE(_l2f): /* convert top of stack long to float */ | |
1385 { | |
1386 jlong r = STACK_LONG(-1); | |
1387 MORE_STACK(-2); // Pop | |
1388 SET_STACK_FLOAT(VMlong2Float(r), 0); | |
1389 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1390 } | |
1391 | |
1392 CASE(_l2d): /* convert top of stack long to double */ | |
1393 { | |
1394 jlong r = STACK_LONG(-1); | |
1395 MORE_STACK(-2); // Pop | |
1396 SET_STACK_DOUBLE(VMlong2Double(r), 1); | |
1397 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1398 } | |
1399 | |
1400 CASE(_f2i): /* Convert top of stack float to int */ | |
1401 SET_STACK_INT(SharedRuntime::f2i(STACK_FLOAT(-1)), -1); | |
1402 UPDATE_PC_AND_CONTINUE(1); | |
1403 | |
1404 CASE(_f2l): /* convert top of stack float to long */ | |
1405 { | |
1406 jlong r = SharedRuntime::f2l(STACK_FLOAT(-1)); | |
1407 MORE_STACK(-1); // POP | |
1408 SET_STACK_LONG(r, 1); | |
1409 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1410 } | |
1411 | |
1412 CASE(_f2d): /* convert top of stack float to double */ | |
1413 { | |
1414 jfloat f; | |
1415 jdouble r; | |
1416 f = STACK_FLOAT(-1); | |
1417 r = (jdouble) f; | |
1418 MORE_STACK(-1); // POP | |
1419 SET_STACK_DOUBLE(r, 1); | |
1420 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1421 } | |
1422 | |
1423 CASE(_d2i): /* convert top of stack double to int */ | |
1424 { | |
1425 jint r1 = SharedRuntime::d2i(STACK_DOUBLE(-1)); | |
1426 MORE_STACK(-2); | |
1427 SET_STACK_INT(r1, 0); | |
1428 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1429 } | |
1430 | |
1431 CASE(_d2f): /* convert top of stack double to float */ | |
1432 { | |
1433 jfloat r1 = VMdouble2Float(STACK_DOUBLE(-1)); | |
1434 MORE_STACK(-2); | |
1435 SET_STACK_FLOAT(r1, 0); | |
1436 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1437 } | |
1438 | |
1439 CASE(_d2l): /* convert top of stack double to long */ | |
1440 { | |
1441 jlong r1 = SharedRuntime::d2l(STACK_DOUBLE(-1)); | |
1442 MORE_STACK(-2); | |
1443 SET_STACK_LONG(r1, 1); | |
1444 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 2); | |
1445 } | |
1446 | |
1447 CASE(_i2b): | |
1448 SET_STACK_INT(VMint2Byte(STACK_INT(-1)), -1); | |
1449 UPDATE_PC_AND_CONTINUE(1); | |
1450 | |
1451 CASE(_i2c): | |
1452 SET_STACK_INT(VMint2Char(STACK_INT(-1)), -1); | |
1453 UPDATE_PC_AND_CONTINUE(1); | |
1454 | |
1455 CASE(_i2s): | |
1456 SET_STACK_INT(VMint2Short(STACK_INT(-1)), -1); | |
1457 UPDATE_PC_AND_CONTINUE(1); | |
1458 | |
1459 /* comparison operators */ | |
1460 | |
1461 | |
1462 #define COMPARISON_OP(name, comparison) \ | |
1463 CASE(_if_icmp##name): { \ | |
1464 int skip = (STACK_INT(-2) comparison STACK_INT(-1)) \ | |
1465 ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ | |
1466 address branch_pc = pc; \ | |
1467 UPDATE_PC_AND_TOS(skip, -2); \ | |
1468 DO_BACKEDGE_CHECKS(skip, branch_pc); \ | |
1469 CONTINUE; \ | |
1470 } \ | |
1471 CASE(_if##name): { \ | |
1472 int skip = (STACK_INT(-1) comparison 0) \ | |
1473 ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ | |
1474 address branch_pc = pc; \ | |
1475 UPDATE_PC_AND_TOS(skip, -1); \ | |
1476 DO_BACKEDGE_CHECKS(skip, branch_pc); \ | |
1477 CONTINUE; \ | |
1478 } | |
1479 | |
1480 #define COMPARISON_OP2(name, comparison) \ | |
1481 COMPARISON_OP(name, comparison) \ | |
1482 CASE(_if_acmp##name): { \ | |
1483 int skip = (STACK_OBJECT(-2) comparison STACK_OBJECT(-1)) \ | |
1484 ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ | |
1485 address branch_pc = pc; \ | |
1486 UPDATE_PC_AND_TOS(skip, -2); \ | |
1487 DO_BACKEDGE_CHECKS(skip, branch_pc); \ | |
1488 CONTINUE; \ | |
1489 } | |
1490 | |
1491 #define NULL_COMPARISON_NOT_OP(name) \ | |
1492 CASE(_if##name): { \ | |
520
52a431267315
6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents:
196
diff
changeset
|
1493 int skip = (!(STACK_OBJECT(-1) == NULL)) \ |
0 | 1494 ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ |
1495 address branch_pc = pc; \ | |
1496 UPDATE_PC_AND_TOS(skip, -1); \ | |
1497 DO_BACKEDGE_CHECKS(skip, branch_pc); \ | |
1498 CONTINUE; \ | |
1499 } | |
1500 | |
1501 #define NULL_COMPARISON_OP(name) \ | |
1502 CASE(_if##name): { \ | |
520
52a431267315
6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents:
196
diff
changeset
|
1503 int skip = ((STACK_OBJECT(-1) == NULL)) \ |
0 | 1504 ? (int16_t)Bytes::get_Java_u2(pc + 1) : 3; \ |
1505 address branch_pc = pc; \ | |
1506 UPDATE_PC_AND_TOS(skip, -1); \ | |
1507 DO_BACKEDGE_CHECKS(skip, branch_pc); \ | |
1508 CONTINUE; \ | |
1509 } | |
1510 COMPARISON_OP(lt, <); | |
1511 COMPARISON_OP(gt, >); | |
1512 COMPARISON_OP(le, <=); | |
1513 COMPARISON_OP(ge, >=); | |
1514 COMPARISON_OP2(eq, ==); /* include ref comparison */ | |
1515 COMPARISON_OP2(ne, !=); /* include ref comparison */ | |
1516 NULL_COMPARISON_OP(null); | |
1517 NULL_COMPARISON_NOT_OP(nonnull); | |
1518 | |
1519 /* Goto pc at specified offset in switch table. */ | |
1520 | |
1521 CASE(_tableswitch): { | |
1522 jint* lpc = (jint*)VMalignWordUp(pc+1); | |
1523 int32_t key = STACK_INT(-1); | |
1524 int32_t low = Bytes::get_Java_u4((address)&lpc[1]); | |
1525 int32_t high = Bytes::get_Java_u4((address)&lpc[2]); | |
1526 int32_t skip; | |
1527 key -= low; | |
1528 skip = ((uint32_t) key > (uint32_t)(high - low)) | |
1529 ? Bytes::get_Java_u4((address)&lpc[0]) | |
1530 : Bytes::get_Java_u4((address)&lpc[key + 3]); | |
1531 // Does this really need a full backedge check (osr?) | |
1532 address branch_pc = pc; | |
1533 UPDATE_PC_AND_TOS(skip, -1); | |
1534 DO_BACKEDGE_CHECKS(skip, branch_pc); | |
1535 CONTINUE; | |
1536 } | |
1537 | |
1538 /* Goto pc whose table entry matches specified key */ | |
1539 | |
1540 CASE(_lookupswitch): { | |
1541 jint* lpc = (jint*)VMalignWordUp(pc+1); | |
1542 int32_t key = STACK_INT(-1); | |
1543 int32_t skip = Bytes::get_Java_u4((address) lpc); /* default amount */ | |
1544 int32_t npairs = Bytes::get_Java_u4((address) &lpc[1]); | |
1545 while (--npairs >= 0) { | |
1546 lpc += 2; | |
1547 if (key == (int32_t)Bytes::get_Java_u4((address)lpc)) { | |
1548 skip = Bytes::get_Java_u4((address)&lpc[1]); | |
1549 break; | |
1550 } | |
1551 } | |
1552 address branch_pc = pc; | |
1553 UPDATE_PC_AND_TOS(skip, -1); | |
1554 DO_BACKEDGE_CHECKS(skip, branch_pc); | |
1555 CONTINUE; | |
1556 } | |
1557 | |
1558 CASE(_fcmpl): | |
1559 CASE(_fcmpg): | |
1560 { | |
1561 SET_STACK_INT(VMfloatCompare(STACK_FLOAT(-2), | |
1562 STACK_FLOAT(-1), | |
1563 (opcode == Bytecodes::_fcmpl ? -1 : 1)), | |
1564 -2); | |
1565 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); | |
1566 } | |
1567 | |
1568 CASE(_dcmpl): | |
1569 CASE(_dcmpg): | |
1570 { | |
1571 int r = VMdoubleCompare(STACK_DOUBLE(-3), | |
1572 STACK_DOUBLE(-1), | |
1573 (opcode == Bytecodes::_dcmpl ? -1 : 1)); | |
1574 MORE_STACK(-4); // Pop | |
1575 SET_STACK_INT(r, 0); | |
1576 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1577 } | |
1578 | |
1579 CASE(_lcmp): | |
1580 { | |
1581 int r = VMlongCompare(STACK_LONG(-3), STACK_LONG(-1)); | |
1582 MORE_STACK(-4); | |
1583 SET_STACK_INT(r, 0); | |
1584 UPDATE_PC_AND_TOS_AND_CONTINUE(1, 1); | |
1585 } | |
1586 | |
1587 | |
1588 /* Return from a method */ | |
1589 | |
1590 CASE(_areturn): | |
1591 CASE(_ireturn): | |
1592 CASE(_freturn): | |
1593 { | |
1594 // Allow a safepoint before returning to frame manager. | |
1595 SAFEPOINT; | |
1596 | |
1597 goto handle_return; | |
1598 } | |
1599 | |
1600 CASE(_lreturn): | |
1601 CASE(_dreturn): | |
1602 { | |
1603 // Allow a safepoint before returning to frame manager. | |
1604 SAFEPOINT; | |
1605 goto handle_return; | |
1606 } | |
1607 | |
1608 CASE(_return_register_finalizer): { | |
1609 | |
1610 oop rcvr = LOCALS_OBJECT(0); | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1611 VERIFY_OOP(rcvr); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1612 if (rcvr->klass()->has_finalizer()) { |
0 | 1613 CALL_VM(InterpreterRuntime::register_finalizer(THREAD, rcvr), handle_exception); |
1614 } | |
1615 goto handle_return; | |
1616 } | |
1617 CASE(_return): { | |
1618 | |
1619 // Allow a safepoint before returning to frame manager. | |
1620 SAFEPOINT; | |
1621 goto handle_return; | |
1622 } | |
1623 | |
1624 /* Array access byte-codes */ | |
1625 | |
1626 /* Every array access byte-code starts out like this */ | |
1627 // arrayOopDesc* arrObj = (arrayOopDesc*)STACK_OBJECT(arrayOff); | |
1628 #define ARRAY_INTRO(arrayOff) \ | |
1629 arrayOop arrObj = (arrayOop)STACK_OBJECT(arrayOff); \ | |
1630 jint index = STACK_INT(arrayOff + 1); \ | |
1631 char message[jintAsStringSize]; \ | |
1632 CHECK_NULL(arrObj); \ | |
1633 if ((uint32_t)index >= (uint32_t)arrObj->length()) { \ | |
1634 sprintf(message, "%d", index); \ | |
1635 VM_JAVA_ERROR(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), \ | |
1636 message); \ | |
1637 } | |
1638 | |
1639 /* 32-bit loads. These handle conversion from < 32-bit types */ | |
1640 #define ARRAY_LOADTO32(T, T2, format, stackRes, extra) \ | |
1641 { \ | |
1642 ARRAY_INTRO(-2); \ | |
11077
a023ec3452c7
8019382: PPC64: Fix bytecodeInterpreter to compile with '-Wunused-value'
simonis
parents:
11046
diff
changeset
|
1643 (void)extra; \ |
0 | 1644 SET_ ## stackRes(*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)), \ |
1645 -2); \ | |
1646 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \ | |
1647 } | |
1648 | |
1649 /* 64-bit loads */ | |
1650 #define ARRAY_LOADTO64(T,T2, stackRes, extra) \ | |
1651 { \ | |
1652 ARRAY_INTRO(-2); \ | |
1653 SET_ ## stackRes(*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)), -1); \ | |
11077
a023ec3452c7
8019382: PPC64: Fix bytecodeInterpreter to compile with '-Wunused-value'
simonis
parents:
11046
diff
changeset
|
1654 (void)extra; \ |
a023ec3452c7
8019382: PPC64: Fix bytecodeInterpreter to compile with '-Wunused-value'
simonis
parents:
11046
diff
changeset
|
1655 UPDATE_PC_AND_CONTINUE(1); \ |
0 | 1656 } |
1657 | |
1658 CASE(_iaload): | |
1659 ARRAY_LOADTO32(T_INT, jint, "%d", STACK_INT, 0); | |
1660 CASE(_faload): | |
1661 ARRAY_LOADTO32(T_FLOAT, jfloat, "%f", STACK_FLOAT, 0); | |
14399
48b178ff07b6
8019518: PPC64 (part 103): cppInterpreter: implement support for compressed Oops
goetz
parents:
14398
diff
changeset
|
1662 CASE(_aaload): { |
48b178ff07b6
8019518: PPC64 (part 103): cppInterpreter: implement support for compressed Oops
goetz
parents:
14398
diff
changeset
|
1663 ARRAY_INTRO(-2); |
48b178ff07b6
8019518: PPC64 (part 103): cppInterpreter: implement support for compressed Oops
goetz
parents:
14398
diff
changeset
|
1664 SET_STACK_OBJECT(((objArrayOop) arrObj)->obj_at(index), -2); |
48b178ff07b6
8019518: PPC64 (part 103): cppInterpreter: implement support for compressed Oops
goetz
parents:
14398
diff
changeset
|
1665 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); |
48b178ff07b6
8019518: PPC64 (part 103): cppInterpreter: implement support for compressed Oops
goetz
parents:
14398
diff
changeset
|
1666 } |
0 | 1667 CASE(_baload): |
1668 ARRAY_LOADTO32(T_BYTE, jbyte, "%d", STACK_INT, 0); | |
1669 CASE(_caload): | |
1670 ARRAY_LOADTO32(T_CHAR, jchar, "%d", STACK_INT, 0); | |
1671 CASE(_saload): | |
1672 ARRAY_LOADTO32(T_SHORT, jshort, "%d", STACK_INT, 0); | |
1673 CASE(_laload): | |
1674 ARRAY_LOADTO64(T_LONG, jlong, STACK_LONG, 0); | |
1675 CASE(_daload): | |
1676 ARRAY_LOADTO64(T_DOUBLE, jdouble, STACK_DOUBLE, 0); | |
1677 | |
1678 /* 32-bit stores. These handle conversion to < 32-bit types */ | |
1679 #define ARRAY_STOREFROM32(T, T2, format, stackSrc, extra) \ | |
1680 { \ | |
1681 ARRAY_INTRO(-3); \ | |
11077
a023ec3452c7
8019382: PPC64: Fix bytecodeInterpreter to compile with '-Wunused-value'
simonis
parents:
11046
diff
changeset
|
1682 (void)extra; \ |
0 | 1683 *(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)) = stackSrc( -1); \ |
1684 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3); \ | |
1685 } | |
1686 | |
1687 /* 64-bit stores */ | |
1688 #define ARRAY_STOREFROM64(T, T2, stackSrc, extra) \ | |
1689 { \ | |
1690 ARRAY_INTRO(-4); \ | |
11077
a023ec3452c7
8019382: PPC64: Fix bytecodeInterpreter to compile with '-Wunused-value'
simonis
parents:
11046
diff
changeset
|
1691 (void)extra; \ |
0 | 1692 *(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)) = stackSrc( -1); \ |
1693 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -4); \ | |
1694 } | |
1695 | |
1696 CASE(_iastore): | |
1697 ARRAY_STOREFROM32(T_INT, jint, "%d", STACK_INT, 0); | |
1698 CASE(_fastore): | |
1699 ARRAY_STOREFROM32(T_FLOAT, jfloat, "%f", STACK_FLOAT, 0); | |
1700 /* | |
1701 * This one looks different because of the assignability check | |
1702 */ | |
1703 CASE(_aastore): { | |
1704 oop rhsObject = STACK_OBJECT(-1); | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1705 VERIFY_OOP(rhsObject); |
0 | 1706 ARRAY_INTRO( -3); |
1707 // arrObj, index are set | |
1708 if (rhsObject != NULL) { | |
1709 /* Check assignability of rhsObject into arrObj */ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1710 Klass* rhsKlassOop = rhsObject->klass(); // EBX (subclass) |
6831
d8ce2825b193
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
6725
diff
changeset
|
1711 Klass* elemKlassOop = ObjArrayKlass::cast(arrObj->klass())->element_klass(); // superklass EAX |
0 | 1712 // |
1713 // Check for compatibilty. This check must not GC!! | |
1714 // Seems way more expensive now that we must dispatch | |
1715 // | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1716 if (rhsKlassOop != elemKlassOop && !rhsKlassOop->is_subtype_of(elemKlassOop)) { // ebx->is... |
0 | 1717 VM_JAVA_ERROR(vmSymbols::java_lang_ArrayStoreException(), ""); |
1718 } | |
1719 } | |
14398
641d55c11d6b
8019517: PPC64 (part 102): cppInterpreter: implement G1 support
goetz
parents:
14396
diff
changeset
|
1720 ((objArrayOopDesc *) arrObj)->obj_at_put(index, rhsObject); |
0 | 1721 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3); |
1722 } | |
1723 CASE(_bastore): | |
1724 ARRAY_STOREFROM32(T_BYTE, jbyte, "%d", STACK_INT, 0); | |
1725 CASE(_castore): | |
1726 ARRAY_STOREFROM32(T_CHAR, jchar, "%d", STACK_INT, 0); | |
1727 CASE(_sastore): | |
1728 ARRAY_STOREFROM32(T_SHORT, jshort, "%d", STACK_INT, 0); | |
1729 CASE(_lastore): | |
1730 ARRAY_STOREFROM64(T_LONG, jlong, STACK_LONG, 0); | |
1731 CASE(_dastore): | |
1732 ARRAY_STOREFROM64(T_DOUBLE, jdouble, STACK_DOUBLE, 0); | |
1733 | |
1734 CASE(_arraylength): | |
1735 { | |
1736 arrayOop ary = (arrayOop) STACK_OBJECT(-1); | |
1737 CHECK_NULL(ary); | |
1738 SET_STACK_INT(ary->length(), -1); | |
1739 UPDATE_PC_AND_CONTINUE(1); | |
1740 } | |
1741 | |
1742 /* monitorenter and monitorexit for locking/unlocking an object */ | |
1743 | |
1744 CASE(_monitorenter): { | |
1745 oop lockee = STACK_OBJECT(-1); | |
1746 // derefing's lockee ought to provoke implicit null check | |
1747 CHECK_NULL(lockee); | |
1748 // find a free monitor or one already allocated for this object | |
1749 // if we find a matching object then we need a new monitor | |
1750 // since this is recursive enter | |
1751 BasicObjectLock* limit = istate->monitor_base(); | |
1752 BasicObjectLock* most_recent = (BasicObjectLock*) istate->stack_base(); | |
1753 BasicObjectLock* entry = NULL; | |
1754 while (most_recent != limit ) { | |
1755 if (most_recent->obj() == NULL) entry = most_recent; | |
1756 else if (most_recent->obj() == lockee) break; | |
1757 most_recent++; | |
1758 } | |
1759 if (entry != NULL) { | |
1760 entry->set_obj(lockee); | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1761 int success = false; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1762 uintptr_t epoch_mask_in_place = (uintptr_t)markOopDesc::epoch_mask_in_place; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1763 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1764 markOop mark = lockee->mark(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1765 intptr_t hash = (intptr_t) markOopDesc::no_hash; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1766 // implies UseBiasedLocking |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1767 if (mark->has_bias_pattern()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1768 uintptr_t thread_ident; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1769 uintptr_t anticipated_bias_locking_value; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1770 thread_ident = (uintptr_t)istate->thread(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1771 anticipated_bias_locking_value = |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1772 (((uintptr_t)lockee->klass()->prototype_header() | thread_ident) ^ (uintptr_t)mark) & |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1773 ~((uintptr_t) markOopDesc::age_mask_in_place); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1774 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1775 if (anticipated_bias_locking_value == 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1776 // already biased towards this thread, nothing to do |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1777 if (PrintBiasedLockingStatistics) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1778 (* BiasedLocking::biased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1779 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1780 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1781 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1782 else if ((anticipated_bias_locking_value & markOopDesc::biased_lock_mask_in_place) != 0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1783 // try revoke bias |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1784 markOop header = lockee->klass()->prototype_header(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1785 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1786 header = header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1787 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1788 if (Atomic::cmpxchg_ptr(header, lockee->mark_addr(), mark) == mark) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1789 if (PrintBiasedLockingStatistics) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1790 (*BiasedLocking::revoked_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1791 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1792 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1793 else if ((anticipated_bias_locking_value & epoch_mask_in_place) !=0) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1794 // try rebias |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1795 markOop new_header = (markOop) ( (intptr_t) lockee->klass()->prototype_header() | thread_ident); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1796 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1797 new_header = new_header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1798 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1799 if (Atomic::cmpxchg_ptr((void*)new_header, lockee->mark_addr(), mark) == mark) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1800 if (PrintBiasedLockingStatistics) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1801 (* BiasedLocking::rebiased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1802 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1803 else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1804 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1805 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1806 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1807 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1808 else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1809 // try to bias towards thread in case object is anonymously biased |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1810 markOop header = (markOop) ((uintptr_t) mark & ((uintptr_t)markOopDesc::biased_lock_mask_in_place | |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1811 (uintptr_t)markOopDesc::age_mask_in_place | |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1812 epoch_mask_in_place)); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1813 if (hash != markOopDesc::no_hash) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1814 header = header->copy_set_hash(hash); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1815 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1816 markOop new_header = (markOop) ((uintptr_t) header | thread_ident); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1817 // debugging hint |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1818 DEBUG_ONLY(entry->lock()->set_displaced_header((markOop) (uintptr_t) 0xdeaddead);) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1819 if (Atomic::cmpxchg_ptr((void*)new_header, lockee->mark_addr(), header) == header) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1820 if (PrintBiasedLockingStatistics) |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1821 (* BiasedLocking::anonymously_biased_lock_entry_count_addr())++; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1822 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1823 else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1824 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1825 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1826 success = true; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1827 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1828 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1829 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1830 // traditional lightweight locking |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1831 if (!success) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1832 markOop displaced = lockee->mark()->set_unlocked(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1833 entry->lock()->set_displaced_header(displaced); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1834 bool call_vm = UseHeavyMonitors; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1835 if (call_vm || Atomic::cmpxchg_ptr(entry, lockee->mark_addr(), displaced) != displaced) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1836 // Is it simple recursive case? |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1837 if (!call_vm && THREAD->is_lock_owned((address) displaced->clear_lock_bits())) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1838 entry->lock()->set_displaced_header(NULL); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1839 } else { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1840 CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1841 } |
0 | 1842 } |
1843 } | |
1844 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); | |
1845 } else { | |
1846 istate->set_msg(more_monitors); | |
1847 UPDATE_PC_AND_RETURN(0); // Re-execute | |
1848 } | |
1849 } | |
1850 | |
1851 CASE(_monitorexit): { | |
1852 oop lockee = STACK_OBJECT(-1); | |
1853 CHECK_NULL(lockee); | |
1854 // derefing's lockee ought to provoke implicit null check | |
1855 // find our monitor slot | |
1856 BasicObjectLock* limit = istate->monitor_base(); | |
1857 BasicObjectLock* most_recent = (BasicObjectLock*) istate->stack_base(); | |
1858 while (most_recent != limit ) { | |
1859 if ((most_recent)->obj() == lockee) { | |
1860 BasicLock* lock = most_recent->lock(); | |
1861 markOop header = lock->displaced_header(); | |
1862 most_recent->set_obj(NULL); | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1863 if (!lockee->mark()->has_bias_pattern()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1864 bool call_vm = UseHeavyMonitors; |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1865 // If it isn't recursive we either must swap old header or call the runtime |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1866 if (header != NULL || call_vm) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1867 if (call_vm || Atomic::cmpxchg_ptr(header, lockee->mark_addr(), lock) != lock) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1868 // restore object for the slow case |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1869 most_recent->set_obj(lockee); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1870 CALL_VM(InterpreterRuntime::monitorexit(THREAD, most_recent), handle_exception); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
1871 } |
0 | 1872 } |
1873 } | |
1874 UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); | |
1875 } | |
1876 most_recent++; | |
1877 } | |
1878 // Need to throw illegal monitor state exception | |
1879 CALL_VM(InterpreterRuntime::throw_illegal_monitor_state_exception(THREAD), handle_exception); | |
2480 | 1880 ShouldNotReachHere(); |
0 | 1881 } |
1882 | |
1883 /* All of the non-quick opcodes. */ | |
1884 | |
1885 /* -Set clobbersCpIndex true if the quickened opcode clobbers the | |
1886 * constant pool index in the instruction. | |
1887 */ | |
1888 CASE(_getfield): | |
1889 CASE(_getstatic): | |
1890 { | |
1891 u2 index; | |
1892 ConstantPoolCacheEntry* cache; | |
1893 index = Bytes::get_native_u2(pc+1); | |
1894 | |
1895 // QQQ Need to make this as inlined as possible. Probably need to | |
1896 // split all the bytecode cases out so c++ compiler has a chance | |
1897 // for constant prop to fold everything possible away. | |
1898 | |
1899 cache = cp->entry_at(index); | |
1900 if (!cache->is_resolved((Bytecodes::Code)opcode)) { | |
1901 CALL_VM(InterpreterRuntime::resolve_get_put(THREAD, (Bytecodes::Code)opcode), | |
1902 handle_exception); | |
1903 cache = cp->entry_at(index); | |
1904 } | |
1905 | |
1906 #ifdef VM_JVMTI | |
1907 if (_jvmti_interp_events) { | |
1908 int *count_addr; | |
1909 oop obj; | |
1910 // Check to see if a field modification watch has been set | |
1911 // before we take the time to call into the VM. | |
1912 count_addr = (int *)JvmtiExport::get_field_access_count_addr(); | |
1913 if ( *count_addr > 0 ) { | |
1914 if ((Bytecodes::Code)opcode == Bytecodes::_getstatic) { | |
1915 obj = (oop)NULL; | |
1916 } else { | |
1917 obj = (oop) STACK_OBJECT(-1); | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1918 VERIFY_OOP(obj); |
0 | 1919 } |
1920 CALL_VM(InterpreterRuntime::post_field_access(THREAD, | |
1921 obj, | |
1922 cache), | |
1923 handle_exception); | |
1924 } | |
1925 } | |
1926 #endif /* VM_JVMTI */ | |
1927 | |
1928 oop obj; | |
1929 if ((Bytecodes::Code)opcode == Bytecodes::_getstatic) { | |
6926 | 1930 Klass* k = cache->f1_as_klass(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1931 obj = k->java_mirror(); |
0 | 1932 MORE_STACK(1); // Assume single slot push |
1933 } else { | |
1934 obj = (oop) STACK_OBJECT(-1); | |
1935 CHECK_NULL(obj); | |
1936 } | |
1937 | |
1938 // | |
1939 // Now store the result on the stack | |
1940 // | |
1941 TosState tos_type = cache->flag_state(); | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
1942 int field_offset = cache->f2_as_index(); |
0 | 1943 if (cache->is_volatile()) { |
1944 if (tos_type == atos) { | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1945 VERIFY_OOP(obj->obj_field_acquire(field_offset)); |
0 | 1946 SET_STACK_OBJECT(obj->obj_field_acquire(field_offset), -1); |
1947 } else if (tos_type == itos) { | |
1948 SET_STACK_INT(obj->int_field_acquire(field_offset), -1); | |
1949 } else if (tos_type == ltos) { | |
1950 SET_STACK_LONG(obj->long_field_acquire(field_offset), 0); | |
1951 MORE_STACK(1); | |
1952 } else if (tos_type == btos) { | |
1953 SET_STACK_INT(obj->byte_field_acquire(field_offset), -1); | |
1954 } else if (tos_type == ctos) { | |
1955 SET_STACK_INT(obj->char_field_acquire(field_offset), -1); | |
1956 } else if (tos_type == stos) { | |
1957 SET_STACK_INT(obj->short_field_acquire(field_offset), -1); | |
1958 } else if (tos_type == ftos) { | |
1959 SET_STACK_FLOAT(obj->float_field_acquire(field_offset), -1); | |
1960 } else { | |
1961 SET_STACK_DOUBLE(obj->double_field_acquire(field_offset), 0); | |
1962 MORE_STACK(1); | |
1963 } | |
1964 } else { | |
1965 if (tos_type == atos) { | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
1966 VERIFY_OOP(obj->obj_field(field_offset)); |
0 | 1967 SET_STACK_OBJECT(obj->obj_field(field_offset), -1); |
1968 } else if (tos_type == itos) { | |
1969 SET_STACK_INT(obj->int_field(field_offset), -1); | |
1970 } else if (tos_type == ltos) { | |
1971 SET_STACK_LONG(obj->long_field(field_offset), 0); | |
1972 MORE_STACK(1); | |
1973 } else if (tos_type == btos) { | |
1974 SET_STACK_INT(obj->byte_field(field_offset), -1); | |
1975 } else if (tos_type == ctos) { | |
1976 SET_STACK_INT(obj->char_field(field_offset), -1); | |
1977 } else if (tos_type == stos) { | |
1978 SET_STACK_INT(obj->short_field(field_offset), -1); | |
1979 } else if (tos_type == ftos) { | |
1980 SET_STACK_FLOAT(obj->float_field(field_offset), -1); | |
1981 } else { | |
1982 SET_STACK_DOUBLE(obj->double_field(field_offset), 0); | |
1983 MORE_STACK(1); | |
1984 } | |
1985 } | |
1986 | |
1987 UPDATE_PC_AND_CONTINUE(3); | |
1988 } | |
1989 | |
1990 CASE(_putfield): | |
1991 CASE(_putstatic): | |
1992 { | |
1993 u2 index = Bytes::get_native_u2(pc+1); | |
1994 ConstantPoolCacheEntry* cache = cp->entry_at(index); | |
1995 if (!cache->is_resolved((Bytecodes::Code)opcode)) { | |
1996 CALL_VM(InterpreterRuntime::resolve_get_put(THREAD, (Bytecodes::Code)opcode), | |
1997 handle_exception); | |
1998 cache = cp->entry_at(index); | |
1999 } | |
2000 | |
2001 #ifdef VM_JVMTI | |
2002 if (_jvmti_interp_events) { | |
2003 int *count_addr; | |
2004 oop obj; | |
2005 // Check to see if a field modification watch has been set | |
2006 // before we take the time to call into the VM. | |
2007 count_addr = (int *)JvmtiExport::get_field_modification_count_addr(); | |
2008 if ( *count_addr > 0 ) { | |
2009 if ((Bytecodes::Code)opcode == Bytecodes::_putstatic) { | |
2010 obj = (oop)NULL; | |
2011 } | |
2012 else { | |
2013 if (cache->is_long() || cache->is_double()) { | |
2014 obj = (oop) STACK_OBJECT(-3); | |
2015 } else { | |
2016 obj = (oop) STACK_OBJECT(-2); | |
2017 } | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2018 VERIFY_OOP(obj); |
0 | 2019 } |
2020 | |
2021 CALL_VM(InterpreterRuntime::post_field_modification(THREAD, | |
2022 obj, | |
2023 cache, | |
2024 (jvalue *)STACK_SLOT(-1)), | |
2025 handle_exception); | |
2026 } | |
2027 } | |
2028 #endif /* VM_JVMTI */ | |
2029 | |
2030 // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases | |
2031 // out so c++ compiler has a chance for constant prop to fold everything possible away. | |
2032 | |
2033 oop obj; | |
2034 int count; | |
2035 TosState tos_type = cache->flag_state(); | |
2036 | |
2037 count = -1; | |
2038 if (tos_type == ltos || tos_type == dtos) { | |
2039 --count; | |
2040 } | |
2041 if ((Bytecodes::Code)opcode == Bytecodes::_putstatic) { | |
6926 | 2042 Klass* k = cache->f1_as_klass(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2043 obj = k->java_mirror(); |
0 | 2044 } else { |
2045 --count; | |
2046 obj = (oop) STACK_OBJECT(count); | |
2047 CHECK_NULL(obj); | |
2048 } | |
2049 | |
2050 // | |
2051 // Now store the result | |
2052 // | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2053 int field_offset = cache->f2_as_index(); |
0 | 2054 if (cache->is_volatile()) { |
2055 if (tos_type == itos) { | |
2056 obj->release_int_field_put(field_offset, STACK_INT(-1)); | |
2057 } else if (tos_type == atos) { | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2058 VERIFY_OOP(STACK_OBJECT(-1)); |
0 | 2059 obj->release_obj_field_put(field_offset, STACK_OBJECT(-1)); |
2060 } else if (tos_type == btos) { | |
2061 obj->release_byte_field_put(field_offset, STACK_INT(-1)); | |
2062 } else if (tos_type == ltos) { | |
2063 obj->release_long_field_put(field_offset, STACK_LONG(-1)); | |
2064 } else if (tos_type == ctos) { | |
2065 obj->release_char_field_put(field_offset, STACK_INT(-1)); | |
2066 } else if (tos_type == stos) { | |
2067 obj->release_short_field_put(field_offset, STACK_INT(-1)); | |
2068 } else if (tos_type == ftos) { | |
2069 obj->release_float_field_put(field_offset, STACK_FLOAT(-1)); | |
2070 } else { | |
2071 obj->release_double_field_put(field_offset, STACK_DOUBLE(-1)); | |
2072 } | |
2073 OrderAccess::storeload(); | |
2074 } else { | |
2075 if (tos_type == itos) { | |
2076 obj->int_field_put(field_offset, STACK_INT(-1)); | |
2077 } else if (tos_type == atos) { | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2078 VERIFY_OOP(STACK_OBJECT(-1)); |
0 | 2079 obj->obj_field_put(field_offset, STACK_OBJECT(-1)); |
2080 } else if (tos_type == btos) { | |
2081 obj->byte_field_put(field_offset, STACK_INT(-1)); | |
2082 } else if (tos_type == ltos) { | |
2083 obj->long_field_put(field_offset, STACK_LONG(-1)); | |
2084 } else if (tos_type == ctos) { | |
2085 obj->char_field_put(field_offset, STACK_INT(-1)); | |
2086 } else if (tos_type == stos) { | |
2087 obj->short_field_put(field_offset, STACK_INT(-1)); | |
2088 } else if (tos_type == ftos) { | |
2089 obj->float_field_put(field_offset, STACK_FLOAT(-1)); | |
2090 } else { | |
2091 obj->double_field_put(field_offset, STACK_DOUBLE(-1)); | |
2092 } | |
2093 } | |
2094 | |
2095 UPDATE_PC_AND_TOS_AND_CONTINUE(3, count); | |
2096 } | |
2097 | |
2098 CASE(_new): { | |
2099 u2 index = Bytes::get_Java_u2(pc+1); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2100 ConstantPool* constants = istate->method()->constants(); |
0 | 2101 if (!constants->tag_at(index).is_unresolved_klass()) { |
2102 // Make sure klass is initialized and doesn't have a finalizer | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2103 Klass* entry = constants->slot_at(index).get_klass(); |
0 | 2104 assert(entry->is_klass(), "Should be resolved klass"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2105 Klass* k_entry = (Klass*) entry; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2106 assert(k_entry->oop_is_instance(), "Should be InstanceKlass"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2107 InstanceKlass* ik = (InstanceKlass*) k_entry; |
0 | 2108 if ( ik->is_initialized() && ik->can_be_fastpath_allocated() ) { |
2109 size_t obj_size = ik->size_helper(); | |
2110 oop result = NULL; | |
2111 // If the TLAB isn't pre-zeroed then we'll have to do it | |
2112 bool need_zero = !ZeroTLAB; | |
2113 if (UseTLAB) { | |
2114 result = (oop) THREAD->tlab().allocate(obj_size); | |
2115 } | |
2116 if (result == NULL) { | |
2117 need_zero = true; | |
2118 // Try allocate in shared eden | |
2119 retry: | |
2120 HeapWord* compare_to = *Universe::heap()->top_addr(); | |
2121 HeapWord* new_top = compare_to + obj_size; | |
2122 if (new_top <= *Universe::heap()->end_addr()) { | |
2123 if (Atomic::cmpxchg_ptr(new_top, Universe::heap()->top_addr(), compare_to) != compare_to) { | |
2124 goto retry; | |
2125 } | |
2126 result = (oop) compare_to; | |
2127 } | |
2128 } | |
2129 if (result != NULL) { | |
2130 // Initialize object (if nonzero size and need) and then the header | |
2131 if (need_zero ) { | |
2132 HeapWord* to_zero = (HeapWord*) result + sizeof(oopDesc) / oopSize; | |
2133 obj_size -= sizeof(oopDesc) / oopSize; | |
2134 if (obj_size > 0 ) { | |
2135 memset(to_zero, 0, obj_size * HeapWordSize); | |
2136 } | |
2137 } | |
2138 if (UseBiasedLocking) { | |
2139 result->set_mark(ik->prototype_header()); | |
2140 } else { | |
2141 result->set_mark(markOopDesc::prototype()); | |
2142 } | |
167
feeb96a45707
6696264: assert("narrow oop can never be zero") for GCBasher & ParNewGC
coleenp
parents:
123
diff
changeset
|
2143 result->set_klass_gap(0); |
0 | 2144 result->set_klass(k_entry); |
2145 SET_STACK_OBJECT(result, 0); | |
2146 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); | |
2147 } | |
2148 } | |
2149 } | |
2150 // Slow case allocation | |
2151 CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index), | |
2152 handle_exception); | |
2153 SET_STACK_OBJECT(THREAD->vm_result(), 0); | |
2154 THREAD->set_vm_result(NULL); | |
2155 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); | |
2156 } | |
2157 CASE(_anewarray): { | |
2158 u2 index = Bytes::get_Java_u2(pc+1); | |
2159 jint size = STACK_INT(-1); | |
2160 CALL_VM(InterpreterRuntime::anewarray(THREAD, METHOD->constants(), index, size), | |
2161 handle_exception); | |
2162 SET_STACK_OBJECT(THREAD->vm_result(), -1); | |
2163 THREAD->set_vm_result(NULL); | |
2164 UPDATE_PC_AND_CONTINUE(3); | |
2165 } | |
2166 CASE(_multianewarray): { | |
2167 jint dims = *(pc+3); | |
2168 jint size = STACK_INT(-1); | |
2169 // stack grows down, dimensions are up! | |
2170 jint *dimarray = | |
1509 | 2171 (jint*)&topOfStack[dims * Interpreter::stackElementWords+ |
2172 Interpreter::stackElementWords-1]; | |
0 | 2173 //adjust pointer to start of stack element |
2174 CALL_VM(InterpreterRuntime::multianewarray(THREAD, dimarray), | |
2175 handle_exception); | |
2176 SET_STACK_OBJECT(THREAD->vm_result(), -dims); | |
2177 THREAD->set_vm_result(NULL); | |
2178 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -(dims-1)); | |
2179 } | |
2180 CASE(_checkcast): | |
2181 if (STACK_OBJECT(-1) != NULL) { | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2182 VERIFY_OOP(STACK_OBJECT(-1)); |
0 | 2183 u2 index = Bytes::get_Java_u2(pc+1); |
2184 if (ProfileInterpreter) { | |
2185 // needs Profile_checkcast QQQ | |
2186 ShouldNotReachHere(); | |
2187 } | |
2188 // Constant pool may have actual klass or unresolved klass. If it is | |
2189 // unresolved we must resolve it | |
2190 if (METHOD->constants()->tag_at(index).is_unresolved_klass()) { | |
2191 CALL_VM(InterpreterRuntime::quicken_io_cc(THREAD), handle_exception); | |
2192 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2193 Klass* klassOf = (Klass*) METHOD->constants()->slot_at(index).get_klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2194 Klass* objKlassOop = STACK_OBJECT(-1)->klass(); //ebx |
0 | 2195 // |
2196 // Check for compatibilty. This check must not GC!! | |
2197 // Seems way more expensive now that we must dispatch | |
2198 // | |
2199 if (objKlassOop != klassOf && | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2200 !objKlassOop->is_subtype_of(klassOf)) { |
0 | 2201 ResourceMark rm(THREAD); |
6983 | 2202 const char* objName = objKlassOop->external_name(); |
2203 const char* klassName = klassOf->external_name(); | |
0 | 2204 char* message = SharedRuntime::generate_class_cast_message( |
2205 objName, klassName); | |
2206 VM_JAVA_ERROR(vmSymbols::java_lang_ClassCastException(), message); | |
2207 } | |
2208 } else { | |
2209 if (UncommonNullCast) { | |
2210 // istate->method()->set_null_cast_seen(); | |
2211 // [RGV] Not sure what to do here! | |
2212 | |
2213 } | |
2214 } | |
2215 UPDATE_PC_AND_CONTINUE(3); | |
2216 | |
2217 CASE(_instanceof): | |
2218 if (STACK_OBJECT(-1) == NULL) { | |
2219 SET_STACK_INT(0, -1); | |
2220 } else { | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2221 VERIFY_OOP(STACK_OBJECT(-1)); |
0 | 2222 u2 index = Bytes::get_Java_u2(pc+1); |
2223 // Constant pool may have actual klass or unresolved klass. If it is | |
2224 // unresolved we must resolve it | |
2225 if (METHOD->constants()->tag_at(index).is_unresolved_klass()) { | |
2226 CALL_VM(InterpreterRuntime::quicken_io_cc(THREAD), handle_exception); | |
2227 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2228 Klass* klassOf = (Klass*) METHOD->constants()->slot_at(index).get_klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2229 Klass* objKlassOop = STACK_OBJECT(-1)->klass(); |
0 | 2230 // |
2231 // Check for compatibilty. This check must not GC!! | |
2232 // Seems way more expensive now that we must dispatch | |
2233 // | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2234 if ( objKlassOop == klassOf || objKlassOop->is_subtype_of(klassOf)) { |
0 | 2235 SET_STACK_INT(1, -1); |
2236 } else { | |
2237 SET_STACK_INT(0, -1); | |
2238 } | |
2239 } | |
2240 UPDATE_PC_AND_CONTINUE(3); | |
2241 | |
2242 CASE(_ldc_w): | |
2243 CASE(_ldc): | |
2244 { | |
2245 u2 index; | |
2246 bool wide = false; | |
2247 int incr = 2; // frequent case | |
2248 if (opcode == Bytecodes::_ldc) { | |
2249 index = pc[1]; | |
2250 } else { | |
2251 index = Bytes::get_Java_u2(pc+1); | |
2252 incr = 3; | |
2253 wide = true; | |
2254 } | |
2255 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2256 ConstantPool* constants = METHOD->constants(); |
0 | 2257 switch (constants->tag_at(index).value()) { |
2258 case JVM_CONSTANT_Integer: | |
2259 SET_STACK_INT(constants->int_at(index), 0); | |
2260 break; | |
2261 | |
2262 case JVM_CONSTANT_Float: | |
2263 SET_STACK_FLOAT(constants->float_at(index), 0); | |
2264 break; | |
2265 | |
2266 case JVM_CONSTANT_String: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2267 { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2268 oop result = constants->resolved_references()->obj_at(index); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2269 if (result == NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2270 CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode), handle_exception); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2271 SET_STACK_OBJECT(THREAD->vm_result(), 0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2272 THREAD->set_vm_result(NULL); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2273 } else { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2274 VERIFY_OOP(result); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2275 SET_STACK_OBJECT(result, 0); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2276 } |
0 | 2277 break; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2278 } |
0 | 2279 |
2280 case JVM_CONSTANT_Class: | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2260
diff
changeset
|
2281 VERIFY_OOP(constants->resolved_klass_at(index)->java_mirror()); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2260
diff
changeset
|
2282 SET_STACK_OBJECT(constants->resolved_klass_at(index)->java_mirror(), 0); |
0 | 2283 break; |
2284 | |
2285 case JVM_CONSTANT_UnresolvedClass: | |
2286 case JVM_CONSTANT_UnresolvedClassInError: | |
2287 CALL_VM(InterpreterRuntime::ldc(THREAD, wide), handle_exception); | |
2288 SET_STACK_OBJECT(THREAD->vm_result(), 0); | |
2289 THREAD->set_vm_result(NULL); | |
2290 break; | |
2291 | |
2292 default: ShouldNotReachHere(); | |
2293 } | |
2294 UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1); | |
2295 } | |
2296 | |
2297 CASE(_ldc2_w): | |
2298 { | |
2299 u2 index = Bytes::get_Java_u2(pc+1); | |
2300 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2301 ConstantPool* constants = METHOD->constants(); |
0 | 2302 switch (constants->tag_at(index).value()) { |
2303 | |
2304 case JVM_CONSTANT_Long: | |
2305 SET_STACK_LONG(constants->long_at(index), 1); | |
2306 break; | |
2307 | |
2308 case JVM_CONSTANT_Double: | |
2309 SET_STACK_DOUBLE(constants->double_at(index), 1); | |
2310 break; | |
2311 default: ShouldNotReachHere(); | |
2312 } | |
2313 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 2); | |
2314 } | |
2315 | |
2480 | 2316 CASE(_fast_aldc_w): |
2317 CASE(_fast_aldc): { | |
2318 u2 index; | |
2319 int incr; | |
2320 if (opcode == Bytecodes::_fast_aldc) { | |
2321 index = pc[1]; | |
2322 incr = 2; | |
2323 } else { | |
2324 index = Bytes::get_native_u2(pc+1); | |
2325 incr = 3; | |
2326 } | |
2327 | |
2328 // We are resolved if the f1 field contains a non-null object (CallSite, etc.) | |
2329 // This kind of CP cache entry does not need to match the flags byte, because | |
2330 // there is a 1-1 relation between bytecode type and CP entry type. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2331 ConstantPool* constants = METHOD->constants(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2332 oop result = constants->resolved_references()->obj_at(index); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2333 if (result == NULL) { |
2480 | 2334 CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode), |
2335 handle_exception); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2336 result = THREAD->vm_result(); |
2480 | 2337 } |
2338 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2339 VERIFY_OOP(result); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2340 SET_STACK_OBJECT(result, 0); |
2480 | 2341 UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1); |
2342 } | |
2343 | |
2344 CASE(_invokedynamic): { | |
6926 | 2345 |
2480 | 2346 if (!EnableInvokeDynamic) { |
2347 // We should not encounter this bytecode if !EnableInvokeDynamic. | |
2348 // The verifier will stop it. However, if we get past the verifier, | |
2349 // this will stop the thread in a reasonable way, without crashing the JVM. | |
2350 CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD), | |
2351 handle_exception); | |
2352 ShouldNotReachHere(); | |
2353 } | |
2354 | |
6926 | 2355 u4 index = Bytes::get_native_u4(pc+1); |
2356 ConstantPoolCacheEntry* cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index); | |
2480 | 2357 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2358 // We are resolved if the resolved_references field contains a non-null object (CallSite, etc.) |
2480 | 2359 // This kind of CP cache entry does not need to match the flags byte, because |
2360 // there is a 1-1 relation between bytecode type and CP entry type. | |
6926 | 2361 if (! cache->is_resolved((Bytecodes::Code) opcode)) { |
2480 | 2362 CALL_VM(InterpreterRuntime::resolve_invokedynamic(THREAD), |
2363 handle_exception); | |
6926 | 2364 cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index); |
2365 } | |
2366 | |
2367 Method* method = cache->f1_as_method(); | |
11046
6a0ead6dc6db
8017531: 8010460 changes broke bytecodeInterpreter.cpp
goetz
parents:
10393
diff
changeset
|
2368 if (VerifyOops) method->verify(); |
6926 | 2369 |
2370 if (cache->has_appendix()) { | |
2371 ConstantPool* constants = METHOD->constants(); | |
2372 SET_STACK_OBJECT(cache->appendix_if_resolved(constants), 0); | |
2373 MORE_STACK(1); | |
2374 } | |
2375 | |
2376 istate->set_msg(call_method); | |
2377 istate->set_callee(method); | |
2378 istate->set_callee_entry_point(method->from_interpreted_entry()); | |
2379 istate->set_bcp_advance(5); | |
2380 | |
2381 UPDATE_PC_AND_RETURN(0); // I'll be back... | |
2382 } | |
2383 | |
2384 CASE(_invokehandle): { | |
2385 | |
2386 if (!EnableInvokeDynamic) { | |
2387 ShouldNotReachHere(); | |
2480 | 2388 } |
2389 | |
6926 | 2390 u2 index = Bytes::get_native_u2(pc+1); |
2391 ConstantPoolCacheEntry* cache = cp->entry_at(index); | |
2392 | |
2393 if (! cache->is_resolved((Bytecodes::Code) opcode)) { | |
2394 CALL_VM(InterpreterRuntime::resolve_invokehandle(THREAD), | |
2395 handle_exception); | |
2396 cache = cp->entry_at(index); | |
2397 } | |
2398 | |
2399 Method* method = cache->f1_as_method(); | |
11046
6a0ead6dc6db
8017531: 8010460 changes broke bytecodeInterpreter.cpp
goetz
parents:
10393
diff
changeset
|
2400 if (VerifyOops) method->verify(); |
6926 | 2401 |
2402 if (cache->has_appendix()) { | |
2403 ConstantPool* constants = METHOD->constants(); | |
2404 SET_STACK_OBJECT(cache->appendix_if_resolved(constants), 0); | |
2405 MORE_STACK(1); | |
2406 } | |
2407 | |
2408 istate->set_msg(call_method); | |
2409 istate->set_callee(method); | |
2410 istate->set_callee_entry_point(method->from_interpreted_entry()); | |
2411 istate->set_bcp_advance(3); | |
2480 | 2412 |
2413 UPDATE_PC_AND_RETURN(0); // I'll be back... | |
2414 } | |
2415 | |
0 | 2416 CASE(_invokeinterface): { |
2417 u2 index = Bytes::get_native_u2(pc+1); | |
2418 | |
2419 // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases | |
2420 // out so c++ compiler has a chance for constant prop to fold everything possible away. | |
2421 | |
2422 ConstantPoolCacheEntry* cache = cp->entry_at(index); | |
2423 if (!cache->is_resolved((Bytecodes::Code)opcode)) { | |
2424 CALL_VM(InterpreterRuntime::resolve_invoke(THREAD, (Bytecodes::Code)opcode), | |
2425 handle_exception); | |
2426 cache = cp->entry_at(index); | |
2427 } | |
2428 | |
2429 istate->set_msg(call_method); | |
2430 | |
2431 // Special case of invokeinterface called for virtual method of | |
2432 // java.lang.Object. See cpCacheOop.cpp for details. | |
2433 // This code isn't produced by javac, but could be produced by | |
2434 // another compliant java compiler. | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2435 if (cache->is_forced_virtual()) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2436 Method* callee; |
0 | 2437 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size()))); |
2438 if (cache->is_vfinal()) { | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2439 callee = cache->f2_as_vfinal_method(); |
0 | 2440 } else { |
2441 // get receiver | |
2442 int parms = cache->parameter_size(); | |
2443 // Same comments as invokevirtual apply here | |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2444 VERIFY_OOP(STACK_OBJECT(-parms)); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2445 InstanceKlass* rcvrKlass = (InstanceKlass*) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2446 STACK_OBJECT(-parms)->klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2447 callee = (Method*) rcvrKlass->start_of_vtable()[ cache->f2_as_index()]; |
0 | 2448 } |
2449 istate->set_callee(callee); | |
2450 istate->set_callee_entry_point(callee->from_interpreted_entry()); | |
2451 #ifdef VM_JVMTI | |
2452 if (JvmtiExport::can_post_interpreter_events() && THREAD->is_interp_only_mode()) { | |
2453 istate->set_callee_entry_point(callee->interpreter_entry()); | |
2454 } | |
2455 #endif /* VM_JVMTI */ | |
2456 istate->set_bcp_advance(5); | |
2457 UPDATE_PC_AND_RETURN(0); // I'll be back... | |
2458 } | |
2459 | |
2460 // this could definitely be cleaned up QQQ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2461 Method* callee; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2462 Klass* iclass = cache->f1_as_klass(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2463 // InstanceKlass* interface = (InstanceKlass*) iclass; |
0 | 2464 // get receiver |
2465 int parms = cache->parameter_size(); | |
2466 oop rcvr = STACK_OBJECT(-parms); | |
2467 CHECK_NULL(rcvr); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2468 InstanceKlass* int2 = (InstanceKlass*) rcvr->klass(); |
0 | 2469 itableOffsetEntry* ki = (itableOffsetEntry*) int2->start_of_itable(); |
2470 int i; | |
2471 for ( i = 0 ; i < int2->itable_length() ; i++, ki++ ) { | |
2472 if (ki->interface_klass() == iclass) break; | |
2473 } | |
2474 // If the interface isn't found, this class doesn't implement this | |
2475 // interface. The link resolver checks this but only for the first | |
2476 // time this interface is called. | |
2477 if (i == int2->itable_length()) { | |
2478 VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), ""); | |
2479 } | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2480 int mindex = cache->f2_as_index(); |
0 | 2481 itableMethodEntry* im = ki->first_method_entry(rcvr->klass()); |
2482 callee = im[mindex].method(); | |
2483 if (callee == NULL) { | |
2484 VM_JAVA_ERROR(vmSymbols::java_lang_AbstractMethodError(), ""); | |
2485 } | |
2486 | |
2487 istate->set_callee(callee); | |
2488 istate->set_callee_entry_point(callee->from_interpreted_entry()); | |
2489 #ifdef VM_JVMTI | |
2490 if (JvmtiExport::can_post_interpreter_events() && THREAD->is_interp_only_mode()) { | |
2491 istate->set_callee_entry_point(callee->interpreter_entry()); | |
2492 } | |
2493 #endif /* VM_JVMTI */ | |
2494 istate->set_bcp_advance(5); | |
2495 UPDATE_PC_AND_RETURN(0); // I'll be back... | |
2496 } | |
2497 | |
2498 CASE(_invokevirtual): | |
2499 CASE(_invokespecial): | |
2500 CASE(_invokestatic): { | |
2501 u2 index = Bytes::get_native_u2(pc+1); | |
2502 | |
2503 ConstantPoolCacheEntry* cache = cp->entry_at(index); | |
2504 // QQQ Need to make this as inlined as possible. Probably need to split all the bytecode cases | |
2505 // out so c++ compiler has a chance for constant prop to fold everything possible away. | |
2506 | |
2507 if (!cache->is_resolved((Bytecodes::Code)opcode)) { | |
2508 CALL_VM(InterpreterRuntime::resolve_invoke(THREAD, (Bytecodes::Code)opcode), | |
2509 handle_exception); | |
2510 cache = cp->entry_at(index); | |
2511 } | |
2512 | |
2513 istate->set_msg(call_method); | |
2514 { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2515 Method* callee; |
0 | 2516 if ((Bytecodes::Code)opcode == Bytecodes::_invokevirtual) { |
2517 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size()))); | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2518 if (cache->is_vfinal()) callee = cache->f2_as_vfinal_method(); |
0 | 2519 else { |
2520 // get receiver | |
2521 int parms = cache->parameter_size(); | |
2522 // this works but needs a resourcemark and seems to create a vtable on every call: | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2523 // Method* callee = rcvr->klass()->vtable()->method_at(cache->f2_as_index()); |
0 | 2524 // |
2525 // this fails with an assert | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2526 // InstanceKlass* rcvrKlass = InstanceKlass::cast(STACK_OBJECT(-parms)->klass()); |
0 | 2527 // but this works |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
2528 VERIFY_OOP(STACK_OBJECT(-parms)); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2529 InstanceKlass* rcvrKlass = (InstanceKlass*) STACK_OBJECT(-parms)->klass(); |
0 | 2530 /* |
2531 Executing this code in java.lang.String: | |
2532 public String(char value[]) { | |
2533 this.count = value.length; | |
2534 this.value = (char[])value.clone(); | |
2535 } | |
2536 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2537 a find on rcvr->klass() reports: |
0 | 2538 {type array char}{type array class} |
2539 - klass: {other class} | |
2540 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2541 but using InstanceKlass::cast(STACK_OBJECT(-parms)->klass()) causes in assertion failure |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2542 because rcvr->klass()->oop_is_instance() == 0 |
0 | 2543 However it seems to have a vtable in the right location. Huh? |
2544 | |
2545 */ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2546 callee = (Method*) rcvrKlass->start_of_vtable()[ cache->f2_as_index()]; |
0 | 2547 } |
2548 } else { | |
2549 if ((Bytecodes::Code)opcode == Bytecodes::_invokespecial) { | |
2550 CHECK_NULL(STACK_OBJECT(-(cache->parameter_size()))); | |
2551 } | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
3960
diff
changeset
|
2552 callee = cache->f1_as_method(); |
0 | 2553 } |
2554 | |
2555 istate->set_callee(callee); | |
2556 istate->set_callee_entry_point(callee->from_interpreted_entry()); | |
2557 #ifdef VM_JVMTI | |
2558 if (JvmtiExport::can_post_interpreter_events() && THREAD->is_interp_only_mode()) { | |
2559 istate->set_callee_entry_point(callee->interpreter_entry()); | |
2560 } | |
2561 #endif /* VM_JVMTI */ | |
2562 istate->set_bcp_advance(3); | |
2563 UPDATE_PC_AND_RETURN(0); // I'll be back... | |
2564 } | |
2565 } | |
2566 | |
2567 /* Allocate memory for a new java object. */ | |
2568 | |
2569 CASE(_newarray): { | |
2570 BasicType atype = (BasicType) *(pc+1); | |
2571 jint size = STACK_INT(-1); | |
2572 CALL_VM(InterpreterRuntime::newarray(THREAD, atype, size), | |
2573 handle_exception); | |
2574 SET_STACK_OBJECT(THREAD->vm_result(), -1); | |
2575 THREAD->set_vm_result(NULL); | |
2576 | |
2577 UPDATE_PC_AND_CONTINUE(2); | |
2578 } | |
2579 | |
2580 /* Throw an exception. */ | |
2581 | |
2582 CASE(_athrow): { | |
2583 oop except_oop = STACK_OBJECT(-1); | |
2584 CHECK_NULL(except_oop); | |
2585 // set pending_exception so we use common code | |
2586 THREAD->set_pending_exception(except_oop, NULL, 0); | |
2587 goto handle_exception; | |
2588 } | |
2589 | |
2590 /* goto and jsr. They are exactly the same except jsr pushes | |
2591 * the address of the next instruction first. | |
2592 */ | |
2593 | |
2594 CASE(_jsr): { | |
2595 /* push bytecode index on stack */ | |
2596 SET_STACK_ADDR(((address)pc - (intptr_t)(istate->method()->code_base()) + 3), 0); | |
2597 MORE_STACK(1); | |
2598 /* FALL THROUGH */ | |
2599 } | |
2600 | |
2601 CASE(_goto): | |
2602 { | |
2603 int16_t offset = (int16_t)Bytes::get_Java_u2(pc + 1); | |
2604 address branch_pc = pc; | |
2605 UPDATE_PC(offset); | |
2606 DO_BACKEDGE_CHECKS(offset, branch_pc); | |
2607 CONTINUE; | |
2608 } | |
2609 | |
2610 CASE(_jsr_w): { | |
2611 /* push return address on the stack */ | |
2612 SET_STACK_ADDR(((address)pc - (intptr_t)(istate->method()->code_base()) + 5), 0); | |
2613 MORE_STACK(1); | |
2614 /* FALL THROUGH */ | |
2615 } | |
2616 | |
2617 CASE(_goto_w): | |
2618 { | |
2619 int32_t offset = Bytes::get_Java_u4(pc + 1); | |
2620 address branch_pc = pc; | |
2621 UPDATE_PC(offset); | |
2622 DO_BACKEDGE_CHECKS(offset, branch_pc); | |
2623 CONTINUE; | |
2624 } | |
2625 | |
2626 /* return from a jsr or jsr_w */ | |
2627 | |
2628 CASE(_ret): { | |
2629 pc = istate->method()->code_base() + (intptr_t)(LOCALS_ADDR(pc[1])); | |
2630 UPDATE_PC_AND_CONTINUE(0); | |
2631 } | |
2632 | |
2633 /* debugger breakpoint */ | |
2634 | |
2635 CASE(_breakpoint): { | |
2636 Bytecodes::Code original_bytecode; | |
2637 DECACHE_STATE(); | |
2638 SET_LAST_JAVA_FRAME(); | |
2639 original_bytecode = InterpreterRuntime::get_original_bytecode_at(THREAD, | |
2640 METHOD, pc); | |
2641 RESET_LAST_JAVA_FRAME(); | |
2642 CACHE_STATE(); | |
2643 if (THREAD->has_pending_exception()) goto handle_exception; | |
2644 CALL_VM(InterpreterRuntime::_breakpoint(THREAD, METHOD, pc), | |
2645 handle_exception); | |
2646 | |
2647 opcode = (jubyte)original_bytecode; | |
2648 goto opcode_switch; | |
2649 } | |
2650 | |
2651 DEFAULT: | |
1490
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1347
diff
changeset
|
2652 fatal(err_msg("Unimplemented opcode %d = %s", opcode, |
f03d0a26bf83
6888954: argument formatting for assert() and friends
jcoomes
parents:
1347
diff
changeset
|
2653 Bytecodes::name((Bytecodes::Code)opcode))); |
0 | 2654 goto finish; |
2655 | |
2656 } /* switch(opc) */ | |
2657 | |
2658 | |
2659 #ifdef USELABELS | |
2660 check_for_exception: | |
2661 #endif | |
2662 { | |
2663 if (!THREAD->has_pending_exception()) { | |
2664 CONTINUE; | |
2665 } | |
2666 /* We will be gcsafe soon, so flush our state. */ | |
2667 DECACHE_PC(); | |
2668 goto handle_exception; | |
2669 } | |
2670 do_continue: ; | |
2671 | |
2672 } /* while (1) interpreter loop */ | |
2673 | |
2674 | |
2675 // An exception exists in the thread state see whether this activation can handle it | |
2676 handle_exception: { | |
2677 | |
2678 HandleMarkCleaner __hmc(THREAD); | |
2679 Handle except_oop(THREAD, THREAD->pending_exception()); | |
2680 // Prevent any subsequent HandleMarkCleaner in the VM | |
2681 // from freeing the except_oop handle. | |
2682 HandleMark __hm(THREAD); | |
2683 | |
2684 THREAD->clear_pending_exception(); | |
2685 assert(except_oop(), "No exception to process"); | |
2686 intptr_t continuation_bci; | |
2687 // expression stack is emptied | |
1509 | 2688 topOfStack = istate->stack_base() - Interpreter::stackElementWords; |
0 | 2689 CALL_VM(continuation_bci = (intptr_t)InterpreterRuntime::exception_handler_for_exception(THREAD, except_oop()), |
2690 handle_exception); | |
2691 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2692 except_oop = THREAD->vm_result(); |
0 | 2693 THREAD->set_vm_result(NULL); |
2694 if (continuation_bci >= 0) { | |
2695 // Place exception on top of stack | |
2696 SET_STACK_OBJECT(except_oop(), 0); | |
2697 MORE_STACK(1); | |
2698 pc = METHOD->code_base() + continuation_bci; | |
2699 if (TraceExceptions) { | |
2700 ttyLocker ttyl; | |
2701 ResourceMark rm; | |
2702 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), except_oop()); | |
2703 tty->print_cr(" thrown in interpreter method <%s>", METHOD->print_value_string()); | |
2704 tty->print_cr(" at bci %d, continuing at %d for thread " INTPTR_FORMAT, | |
2705 pc - (intptr_t)METHOD->code_base(), | |
2706 continuation_bci, THREAD); | |
2707 } | |
2708 // for AbortVMOnException flag | |
2709 NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); | |
2710 goto run; | |
2711 } | |
2712 if (TraceExceptions) { | |
2713 ttyLocker ttyl; | |
2714 ResourceMark rm; | |
2715 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), except_oop()); | |
2716 tty->print_cr(" thrown in interpreter method <%s>", METHOD->print_value_string()); | |
2717 tty->print_cr(" at bci %d, unwinding for thread " INTPTR_FORMAT, | |
2718 pc - (intptr_t) METHOD->code_base(), | |
2719 THREAD); | |
2720 } | |
2721 // for AbortVMOnException flag | |
2722 NOT_PRODUCT(Exceptions::debug_check_abort(except_oop)); | |
2723 // No handler in this activation, unwind and try again | |
2724 THREAD->set_pending_exception(except_oop(), NULL, 0); | |
2725 goto handle_return; | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2726 } // handle_exception: |
0 | 2727 |
2728 // Return from an interpreter invocation with the result of the interpretation | |
2729 // on the top of the Java Stack (or a pending exception) | |
2730 | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2731 handle_Pop_Frame: { |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2732 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2733 // We don't really do anything special here except we must be aware |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2734 // that we can get here without ever locking the method (if sync). |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2735 // Also we skip the notification of the exit. |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2736 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2737 istate->set_msg(popping_frame); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2738 // Clear pending so while the pop is in process |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2739 // we don't start another one if a call_vm is done. |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2740 THREAD->clr_pop_frame_pending(); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2741 // Let interpreter (only) see the we're in the process of popping a frame |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2742 THREAD->set_pop_frame_in_process(); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2743 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2744 goto handle_return; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2745 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2746 } // handle_Pop_Frame |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2747 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2748 // ForceEarlyReturn ends a method, and returns to the caller with a return value |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2749 // given by the invoker of the early return. |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2750 handle_Early_Return: { |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2751 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2752 istate->set_msg(early_return); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2753 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2754 // Clear expression stack. |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2755 topOfStack = istate->stack_base() - Interpreter::stackElementWords; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2756 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2757 JvmtiThreadState *ts = THREAD->jvmti_thread_state(); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2758 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2759 // Push the value to be returned. |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2760 switch (istate->method()->result_type()) { |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2761 case T_BOOLEAN: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2762 case T_SHORT: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2763 case T_BYTE: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2764 case T_CHAR: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2765 case T_INT: |
14401
0014add32e54
8020121: PPC64: fix build in cppInterpreter after 8019519
goetz
parents:
14400
diff
changeset
|
2766 SET_STACK_INT(ts->earlyret_value().i, 0); |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2767 MORE_STACK(1); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2768 break; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2769 case T_LONG: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2770 SET_STACK_LONG(ts->earlyret_value().j, 1); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2771 MORE_STACK(2); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2772 break; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2773 case T_FLOAT: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2774 SET_STACK_FLOAT(ts->earlyret_value().f, 0); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2775 MORE_STACK(1); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2776 break; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2777 case T_DOUBLE: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2778 SET_STACK_DOUBLE(ts->earlyret_value().d, 1); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2779 MORE_STACK(2); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2780 break; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2781 case T_ARRAY: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2782 case T_OBJECT: |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2783 SET_STACK_OBJECT(ts->earlyret_oop(), 0); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2784 MORE_STACK(1); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2785 break; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2786 } |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2787 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2788 ts->clr_earlyret_value(); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2789 ts->set_earlyret_oop(NULL); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2790 ts->clr_earlyret_pending(); |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2791 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2792 // Fall through to handle_return. |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2793 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2794 } // handle_Early_Return |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2795 |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2796 handle_return: { |
0 | 2797 DECACHE_STATE(); |
2798 | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2799 bool suppress_error = istate->msg() == popping_frame || istate->msg() == early_return; |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
2800 bool suppress_exit_event = THREAD->has_pending_exception() || istate->msg() == popping_frame; |
0 | 2801 Handle original_exception(THREAD, THREAD->pending_exception()); |
2802 Handle illegal_state_oop(THREAD, NULL); | |
2803 | |
2804 // We'd like a HandleMark here to prevent any subsequent HandleMarkCleaner | |
2805 // in any following VM entries from freeing our live handles, but illegal_state_oop | |
2806 // isn't really allocated yet and so doesn't become live until later and | |
2807 // in unpredicatable places. Instead we must protect the places where we enter the | |
2808 // VM. It would be much simpler (and safer) if we could allocate a real handle with | |
2809 // a NULL oop in it and then overwrite the oop later as needed. This isn't | |
2810 // unfortunately isn't possible. | |
2811 | |
2812 THREAD->clear_pending_exception(); | |
2813 | |
2814 // | |
2815 // As far as we are concerned we have returned. If we have a pending exception | |
2816 // that will be returned as this invocation's result. However if we get any | |
2817 // exception(s) while checking monitor state one of those IllegalMonitorStateExceptions | |
2818 // will be our final result (i.e. monitor exception trumps a pending exception). | |
2819 // | |
2820 | |
2821 // If we never locked the method (or really passed the point where we would have), | |
2822 // there is no need to unlock it (or look for other monitors), since that | |
2823 // could not have happened. | |
2824 | |
2825 if (THREAD->do_not_unlock()) { | |
2826 | |
2827 // Never locked, reset the flag now because obviously any caller must | |
2828 // have passed their point of locking for us to have gotten here. | |
2829 | |
2830 THREAD->clr_do_not_unlock(); | |
2831 } else { | |
2832 // At this point we consider that we have returned. We now check that the | |
2833 // locks were properly block structured. If we find that they were not | |
2834 // used properly we will return with an illegal monitor exception. | |
2835 // The exception is checked by the caller not the callee since this | |
2836 // checking is considered to be part of the invocation and therefore | |
2837 // in the callers scope (JVM spec 8.13). | |
2838 // | |
2839 // Another weird thing to watch for is if the method was locked | |
2840 // recursively and then not exited properly. This means we must | |
2841 // examine all the entries in reverse time(and stack) order and | |
2842 // unlock as we find them. If we find the method monitor before | |
2843 // we are at the initial entry then we should throw an exception. | |
2844 // It is not clear the template based interpreter does this | |
2845 // correctly | |
2846 | |
2847 BasicObjectLock* base = istate->monitor_base(); | |
2848 BasicObjectLock* end = (BasicObjectLock*) istate->stack_base(); | |
2849 bool method_unlock_needed = METHOD->is_synchronized(); | |
2850 // We know the initial monitor was used for the method don't check that | |
2851 // slot in the loop | |
2852 if (method_unlock_needed) base--; | |
2853 | |
2854 // Check all the monitors to see they are unlocked. Install exception if found to be locked. | |
2855 while (end < base) { | |
2856 oop lockee = end->obj(); | |
2857 if (lockee != NULL) { | |
2858 BasicLock* lock = end->lock(); | |
2859 markOop header = lock->displaced_header(); | |
2860 end->set_obj(NULL); | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2861 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2862 if (!lockee->mark()->has_bias_pattern()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2863 // If it isn't recursive we either must swap old header or call the runtime |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2864 if (header != NULL) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2865 if (Atomic::cmpxchg_ptr(header, lockee->mark_addr(), lock) != lock) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2866 // restore object for the slow case |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2867 end->set_obj(lockee); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2868 { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2869 // Prevent any HandleMarkCleaner from freeing our live handles |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2870 HandleMark __hm(THREAD); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2871 CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(THREAD, end)); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2872 } |
0 | 2873 } |
2874 } | |
2875 } | |
2876 // One error is plenty | |
2877 if (illegal_state_oop() == NULL && !suppress_error) { | |
2878 { | |
2879 // Prevent any HandleMarkCleaner from freeing our live handles | |
2880 HandleMark __hm(THREAD); | |
2881 CALL_VM_NOCHECK(InterpreterRuntime::throw_illegal_monitor_state_exception(THREAD)); | |
2882 } | |
2883 assert(THREAD->has_pending_exception(), "Lost our exception!"); | |
2884 illegal_state_oop = THREAD->pending_exception(); | |
2885 THREAD->clear_pending_exception(); | |
2886 } | |
2887 } | |
2888 end++; | |
2889 } | |
2890 // Unlock the method if needed | |
2891 if (method_unlock_needed) { | |
2892 if (base->obj() == NULL) { | |
2893 // The method is already unlocked this is not good. | |
2894 if (illegal_state_oop() == NULL && !suppress_error) { | |
2895 { | |
2896 // Prevent any HandleMarkCleaner from freeing our live handles | |
2897 HandleMark __hm(THREAD); | |
2898 CALL_VM_NOCHECK(InterpreterRuntime::throw_illegal_monitor_state_exception(THREAD)); | |
2899 } | |
2900 assert(THREAD->has_pending_exception(), "Lost our exception!"); | |
2901 illegal_state_oop = THREAD->pending_exception(); | |
2902 THREAD->clear_pending_exception(); | |
2903 } | |
2904 } else { | |
2905 // | |
2906 // The initial monitor is always used for the method | |
2907 // However if that slot is no longer the oop for the method it was unlocked | |
2908 // and reused by something that wasn't unlocked! | |
2909 // | |
2910 // deopt can come in with rcvr dead because c2 knows | |
2911 // its value is preserved in the monitor. So we can't use locals[0] at all | |
2912 // and must use first monitor slot. | |
2913 // | |
2914 oop rcvr = base->obj(); | |
2915 if (rcvr == NULL) { | |
2916 if (!suppress_error) { | |
2917 VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), ""); | |
2918 illegal_state_oop = THREAD->pending_exception(); | |
2919 THREAD->clear_pending_exception(); | |
2920 } | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2921 } else if (UseHeavyMonitors) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2922 { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2923 // Prevent any HandleMarkCleaner from freeing our live handles. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2924 HandleMark __hm(THREAD); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2925 CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(THREAD, base)); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2926 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2927 if (THREAD->has_pending_exception()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2928 if (!suppress_error) illegal_state_oop = THREAD->pending_exception(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2929 THREAD->clear_pending_exception(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2930 } |
0 | 2931 } else { |
2932 BasicLock* lock = base->lock(); | |
2933 markOop header = lock->displaced_header(); | |
2934 base->set_obj(NULL); | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2935 |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2936 if (!rcvr->mark()->has_bias_pattern()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2937 base->set_obj(NULL); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2938 // If it isn't recursive we either must swap old header or call the runtime |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2939 if (header != NULL) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2940 if (Atomic::cmpxchg_ptr(header, rcvr->mark_addr(), lock) != lock) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2941 // restore object for the slow case |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2942 base->set_obj(rcvr); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2943 { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2944 // Prevent any HandleMarkCleaner from freeing our live handles |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2945 HandleMark __hm(THREAD); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2946 CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(THREAD, base)); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2947 } |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2948 if (THREAD->has_pending_exception()) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2949 if (!suppress_error) illegal_state_oop = THREAD->pending_exception(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2950 THREAD->clear_pending_exception(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2951 } |
0 | 2952 } |
2953 } | |
2954 } | |
2955 } | |
2956 } | |
2957 } | |
2958 } | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2959 // Clear the do_not_unlock flag now. |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
2960 THREAD->clr_do_not_unlock(); |
0 | 2961 |
2962 // | |
2963 // Notify jvmti/jvmdi | |
2964 // | |
2965 // NOTE: we do not notify a method_exit if we have a pending exception, | |
2966 // including an exception we generate for unlocking checks. In the former | |
2967 // case, JVMDI has already been notified by our call for the exception handler | |
2968 // and in both cases as far as JVMDI is concerned we have already returned. | |
2969 // If we notify it again JVMDI will be all confused about how many frames | |
2970 // are still on the stack (4340444). | |
2971 // | |
2972 // NOTE Further! It turns out the the JVMTI spec in fact expects to see | |
2973 // method_exit events whenever we leave an activation unless it was done | |
2974 // for popframe. This is nothing like jvmdi. However we are passing the | |
2975 // tests at the moment (apparently because they are jvmdi based) so rather | |
2976 // than change this code and possibly fail tests we will leave it alone | |
2977 // (with this note) in anticipation of changing the vm and the tests | |
2978 // simultaneously. | |
2979 | |
2980 | |
2981 // | |
2982 suppress_exit_event = suppress_exit_event || illegal_state_oop() != NULL; | |
2983 | |
2984 | |
2985 | |
2986 #ifdef VM_JVMTI | |
2987 if (_jvmti_interp_events) { | |
2988 // Whenever JVMTI puts a thread in interp_only_mode, method | |
2989 // entry/exit events are sent for that thread to track stack depth. | |
2990 if ( !suppress_exit_event && THREAD->is_interp_only_mode() ) { | |
2991 { | |
2992 // Prevent any HandleMarkCleaner from freeing our live handles | |
2993 HandleMark __hm(THREAD); | |
2994 CALL_VM_NOCHECK(InterpreterRuntime::post_method_exit(THREAD)); | |
2995 } | |
2996 } | |
2997 } | |
2998 #endif /* VM_JVMTI */ | |
2999 | |
3000 // | |
3001 // See if we are returning any exception | |
3002 // A pending exception that was pending prior to a possible popping frame | |
3003 // overrides the popping frame. | |
3004 // | |
3005 assert(!suppress_error || suppress_error && illegal_state_oop() == NULL, "Error was not suppressed"); | |
3006 if (illegal_state_oop() != NULL || original_exception() != NULL) { | |
3007 // inform the frame manager we have no result | |
3008 istate->set_msg(throwing_exception); | |
3009 if (illegal_state_oop() != NULL) | |
3010 THREAD->set_pending_exception(illegal_state_oop(), NULL, 0); | |
3011 else | |
3012 THREAD->set_pending_exception(original_exception(), NULL, 0); | |
3013 UPDATE_PC_AND_RETURN(0); | |
3014 } | |
3015 | |
3016 if (istate->msg() == popping_frame) { | |
3017 // Make it simpler on the assembly code and set the message for the frame pop. | |
3018 // returns | |
3019 if (istate->prev() == NULL) { | |
3020 // We must be returning to a deoptimized frame (because popframe only happens between | |
3021 // two interpreted frames). We need to save the current arguments in C heap so that | |
3022 // the deoptimized frame when it restarts can copy the arguments to its expression | |
3023 // stack and re-execute the call. We also have to notify deoptimization that this | |
605 | 3024 // has occurred and to pick the preserved args copy them to the deoptimized frame's |
0 | 3025 // java expression stack. Yuck. |
3026 // | |
3027 THREAD->popframe_preserve_args(in_ByteSize(METHOD->size_of_parameters() * wordSize), | |
3028 LOCALS_SLOT(METHOD->size_of_parameters() - 1)); | |
3029 THREAD->set_popframe_condition_bit(JavaThread::popframe_force_deopt_reexecution_bit); | |
3030 } | |
14400
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
3031 } else { |
bfd9d884693d
8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.
goetz
parents:
14399
diff
changeset
|
3032 istate->set_msg(return_from_method); |
0 | 3033 } |
1681
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
3034 |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
3035 // Normal return |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
3036 // Advance the pc and return to frame manager |
126ea7725993
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
1552
diff
changeset
|
3037 UPDATE_PC_AND_RETURN(1); |
0 | 3038 } /* handle_return: */ |
3039 | |
3040 // This is really a fatal error return | |
3041 | |
3042 finish: | |
3043 DECACHE_TOS(); | |
3044 DECACHE_PC(); | |
3045 | |
3046 return; | |
3047 } | |
3048 | |
3049 /* | |
3050 * All the code following this point is only produced once and is not present | |
3051 * in the JVMTI version of the interpreter | |
3052 */ | |
3053 | |
3054 #ifndef VM_JVMTI | |
3055 | |
3056 // This constructor should only be used to contruct the object to signal | |
3057 // interpreter initialization. All other instances should be created by | |
3058 // the frame manager. | |
3059 BytecodeInterpreter::BytecodeInterpreter(messages msg) { | |
3060 if (msg != initialize) ShouldNotReachHere(); | |
3061 _msg = msg; | |
3062 _self_link = this; | |
3063 _prev_link = NULL; | |
3064 } | |
3065 | |
3066 // Inline static functions for Java Stack and Local manipulation | |
3067 | |
3068 // The implementations are platform dependent. We have to worry about alignment | |
3069 // issues on some machines which can change on the same platform depending on | |
3070 // whether it is an LP64 machine also. | |
3071 address BytecodeInterpreter::stack_slot(intptr_t *tos, int offset) { | |
3072 return (address) tos[Interpreter::expr_index_at(-offset)]; | |
3073 } | |
3074 | |
3075 jint BytecodeInterpreter::stack_int(intptr_t *tos, int offset) { | |
3076 return *((jint*) &tos[Interpreter::expr_index_at(-offset)]); | |
3077 } | |
3078 | |
3079 jfloat BytecodeInterpreter::stack_float(intptr_t *tos, int offset) { | |
3080 return *((jfloat *) &tos[Interpreter::expr_index_at(-offset)]); | |
3081 } | |
3082 | |
3083 oop BytecodeInterpreter::stack_object(intptr_t *tos, int offset) { | |
3084 return (oop)tos [Interpreter::expr_index_at(-offset)]; | |
3085 } | |
3086 | |
3087 jdouble BytecodeInterpreter::stack_double(intptr_t *tos, int offset) { | |
3088 return ((VMJavaVal64*) &tos[Interpreter::expr_index_at(-offset)])->d; | |
3089 } | |
3090 | |
3091 jlong BytecodeInterpreter::stack_long(intptr_t *tos, int offset) { | |
3092 return ((VMJavaVal64 *) &tos[Interpreter::expr_index_at(-offset)])->l; | |
3093 } | |
3094 | |
3095 // only used for value types | |
3096 void BytecodeInterpreter::set_stack_slot(intptr_t *tos, address value, | |
3097 int offset) { | |
3098 *((address *)&tos[Interpreter::expr_index_at(-offset)]) = value; | |
3099 } | |
3100 | |
3101 void BytecodeInterpreter::set_stack_int(intptr_t *tos, int value, | |
3102 int offset) { | |
3103 *((jint *)&tos[Interpreter::expr_index_at(-offset)]) = value; | |
3104 } | |
3105 | |
3106 void BytecodeInterpreter::set_stack_float(intptr_t *tos, jfloat value, | |
3107 int offset) { | |
3108 *((jfloat *)&tos[Interpreter::expr_index_at(-offset)]) = value; | |
3109 } | |
3110 | |
3111 void BytecodeInterpreter::set_stack_object(intptr_t *tos, oop value, | |
3112 int offset) { | |
3113 *((oop *)&tos[Interpreter::expr_index_at(-offset)]) = value; | |
3114 } | |
3115 | |
3116 // needs to be platform dep for the 32 bit platforms. | |
3117 void BytecodeInterpreter::set_stack_double(intptr_t *tos, jdouble value, | |
3118 int offset) { | |
3119 ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->d = value; | |
3120 } | |
3121 | |
3122 void BytecodeInterpreter::set_stack_double_from_addr(intptr_t *tos, | |
3123 address addr, int offset) { | |
3124 (((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->d = | |
3125 ((VMJavaVal64*)addr)->d); | |
3126 } | |
3127 | |
3128 void BytecodeInterpreter::set_stack_long(intptr_t *tos, jlong value, | |
3129 int offset) { | |
3130 ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset+1)])->l = 0xdeedbeeb; | |
3131 ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->l = value; | |
3132 } | |
3133 | |
3134 void BytecodeInterpreter::set_stack_long_from_addr(intptr_t *tos, | |
3135 address addr, int offset) { | |
3136 ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset+1)])->l = 0xdeedbeeb; | |
3137 ((VMJavaVal64*)&tos[Interpreter::expr_index_at(-offset)])->l = | |
3138 ((VMJavaVal64*)addr)->l; | |
3139 } | |
3140 | |
3141 // Locals | |
3142 | |
3143 address BytecodeInterpreter::locals_slot(intptr_t* locals, int offset) { | |
3144 return (address)locals[Interpreter::local_index_at(-offset)]; | |
3145 } | |
3146 jint BytecodeInterpreter::locals_int(intptr_t* locals, int offset) { | |
3147 return (jint)locals[Interpreter::local_index_at(-offset)]; | |
3148 } | |
3149 jfloat BytecodeInterpreter::locals_float(intptr_t* locals, int offset) { | |
3150 return (jfloat)locals[Interpreter::local_index_at(-offset)]; | |
3151 } | |
3152 oop BytecodeInterpreter::locals_object(intptr_t* locals, int offset) { | |
3153 return (oop)locals[Interpreter::local_index_at(-offset)]; | |
3154 } | |
3155 jdouble BytecodeInterpreter::locals_double(intptr_t* locals, int offset) { | |
3156 return ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->d; | |
3157 } | |
3158 jlong BytecodeInterpreter::locals_long(intptr_t* locals, int offset) { | |
3159 return ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->l; | |
3160 } | |
3161 | |
3162 // Returns the address of locals value. | |
3163 address BytecodeInterpreter::locals_long_at(intptr_t* locals, int offset) { | |
3164 return ((address)&locals[Interpreter::local_index_at(-(offset+1))]); | |
3165 } | |
3166 address BytecodeInterpreter::locals_double_at(intptr_t* locals, int offset) { | |
3167 return ((address)&locals[Interpreter::local_index_at(-(offset+1))]); | |
3168 } | |
3169 | |
3170 // Used for local value or returnAddress | |
3171 void BytecodeInterpreter::set_locals_slot(intptr_t *locals, | |
3172 address value, int offset) { | |
3173 *((address*)&locals[Interpreter::local_index_at(-offset)]) = value; | |
3174 } | |
3175 void BytecodeInterpreter::set_locals_int(intptr_t *locals, | |
3176 jint value, int offset) { | |
3177 *((jint *)&locals[Interpreter::local_index_at(-offset)]) = value; | |
3178 } | |
3179 void BytecodeInterpreter::set_locals_float(intptr_t *locals, | |
3180 jfloat value, int offset) { | |
3181 *((jfloat *)&locals[Interpreter::local_index_at(-offset)]) = value; | |
3182 } | |
3183 void BytecodeInterpreter::set_locals_object(intptr_t *locals, | |
3184 oop value, int offset) { | |
3185 *((oop *)&locals[Interpreter::local_index_at(-offset)]) = value; | |
3186 } | |
3187 void BytecodeInterpreter::set_locals_double(intptr_t *locals, | |
3188 jdouble value, int offset) { | |
3189 ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->d = value; | |
3190 } | |
3191 void BytecodeInterpreter::set_locals_long(intptr_t *locals, | |
3192 jlong value, int offset) { | |
3193 ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->l = value; | |
3194 } | |
3195 void BytecodeInterpreter::set_locals_double_from_addr(intptr_t *locals, | |
3196 address addr, int offset) { | |
3197 ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->d = ((VMJavaVal64*)addr)->d; | |
3198 } | |
3199 void BytecodeInterpreter::set_locals_long_from_addr(intptr_t *locals, | |
3200 address addr, int offset) { | |
3201 ((VMJavaVal64*)&locals[Interpreter::local_index_at(-(offset+1))])->l = ((VMJavaVal64*)addr)->l; | |
3202 } | |
3203 | |
3204 void BytecodeInterpreter::astore(intptr_t* tos, int stack_offset, | |
3205 intptr_t* locals, int locals_offset) { | |
3206 intptr_t value = tos[Interpreter::expr_index_at(-stack_offset)]; | |
3207 locals[Interpreter::local_index_at(-locals_offset)] = value; | |
3208 } | |
3209 | |
3210 | |
3211 void BytecodeInterpreter::copy_stack_slot(intptr_t *tos, int from_offset, | |
3212 int to_offset) { | |
3213 tos[Interpreter::expr_index_at(-to_offset)] = | |
3214 (intptr_t)tos[Interpreter::expr_index_at(-from_offset)]; | |
3215 } | |
3216 | |
3217 void BytecodeInterpreter::dup(intptr_t *tos) { | |
3218 copy_stack_slot(tos, -1, 0); | |
3219 } | |
3220 void BytecodeInterpreter::dup2(intptr_t *tos) { | |
3221 copy_stack_slot(tos, -2, 0); | |
3222 copy_stack_slot(tos, -1, 1); | |
3223 } | |
3224 | |
3225 void BytecodeInterpreter::dup_x1(intptr_t *tos) { | |
3226 /* insert top word two down */ | |
3227 copy_stack_slot(tos, -1, 0); | |
3228 copy_stack_slot(tos, -2, -1); | |
3229 copy_stack_slot(tos, 0, -2); | |
3230 } | |
3231 | |
3232 void BytecodeInterpreter::dup_x2(intptr_t *tos) { | |
3233 /* insert top word three down */ | |
3234 copy_stack_slot(tos, -1, 0); | |
3235 copy_stack_slot(tos, -2, -1); | |
3236 copy_stack_slot(tos, -3, -2); | |
3237 copy_stack_slot(tos, 0, -3); | |
3238 } | |
3239 void BytecodeInterpreter::dup2_x1(intptr_t *tos) { | |
3240 /* insert top 2 slots three down */ | |
3241 copy_stack_slot(tos, -1, 1); | |
3242 copy_stack_slot(tos, -2, 0); | |
3243 copy_stack_slot(tos, -3, -1); | |
3244 copy_stack_slot(tos, 1, -2); | |
3245 copy_stack_slot(tos, 0, -3); | |
3246 } | |
3247 void BytecodeInterpreter::dup2_x2(intptr_t *tos) { | |
3248 /* insert top 2 slots four down */ | |
3249 copy_stack_slot(tos, -1, 1); | |
3250 copy_stack_slot(tos, -2, 0); | |
3251 copy_stack_slot(tos, -3, -1); | |
3252 copy_stack_slot(tos, -4, -2); | |
3253 copy_stack_slot(tos, 1, -3); | |
3254 copy_stack_slot(tos, 0, -4); | |
3255 } | |
3256 | |
3257 | |
3258 void BytecodeInterpreter::swap(intptr_t *tos) { | |
3259 // swap top two elements | |
3260 intptr_t val = tos[Interpreter::expr_index_at(1)]; | |
3261 // Copy -2 entry to -1 | |
3262 copy_stack_slot(tos, -2, -1); | |
3263 // Store saved -1 entry into -2 | |
3264 tos[Interpreter::expr_index_at(2)] = val; | |
3265 } | |
3266 // -------------------------------------------------------------------------------- | |
3267 // Non-product code | |
3268 #ifndef PRODUCT | |
3269 | |
3270 const char* BytecodeInterpreter::C_msg(BytecodeInterpreter::messages msg) { | |
3271 switch (msg) { | |
3272 case BytecodeInterpreter::no_request: return("no_request"); | |
3273 case BytecodeInterpreter::initialize: return("initialize"); | |
3274 // status message to C++ interpreter | |
3275 case BytecodeInterpreter::method_entry: return("method_entry"); | |
3276 case BytecodeInterpreter::method_resume: return("method_resume"); | |
3277 case BytecodeInterpreter::got_monitors: return("got_monitors"); | |
3278 case BytecodeInterpreter::rethrow_exception: return("rethrow_exception"); | |
3279 // requests to frame manager from C++ interpreter | |
3280 case BytecodeInterpreter::call_method: return("call_method"); | |
3281 case BytecodeInterpreter::return_from_method: return("return_from_method"); | |
3282 case BytecodeInterpreter::more_monitors: return("more_monitors"); | |
3283 case BytecodeInterpreter::throwing_exception: return("throwing_exception"); | |
3284 case BytecodeInterpreter::popping_frame: return("popping_frame"); | |
3285 case BytecodeInterpreter::do_osr: return("do_osr"); | |
3286 // deopt | |
3287 case BytecodeInterpreter::deopt_resume: return("deopt_resume"); | |
3288 case BytecodeInterpreter::deopt_resume2: return("deopt_resume2"); | |
3289 default: return("BAD MSG"); | |
3290 } | |
3291 } | |
3292 void | |
3293 BytecodeInterpreter::print() { | |
3294 tty->print_cr("thread: " INTPTR_FORMAT, (uintptr_t) this->_thread); | |
3295 tty->print_cr("bcp: " INTPTR_FORMAT, (uintptr_t) this->_bcp); | |
3296 tty->print_cr("locals: " INTPTR_FORMAT, (uintptr_t) this->_locals); | |
3297 tty->print_cr("constants: " INTPTR_FORMAT, (uintptr_t) this->_constants); | |
3298 { | |
3299 ResourceMark rm; | |
3300 char *method_name = _method->name_and_sig_as_C_string(); | |
3301 tty->print_cr("method: " INTPTR_FORMAT "[ %s ]", (uintptr_t) this->_method, method_name); | |
3302 } | |
3303 tty->print_cr("mdx: " INTPTR_FORMAT, (uintptr_t) this->_mdx); | |
3304 tty->print_cr("stack: " INTPTR_FORMAT, (uintptr_t) this->_stack); | |
3305 tty->print_cr("msg: %s", C_msg(this->_msg)); | |
3306 tty->print_cr("result_to_call._callee: " INTPTR_FORMAT, (uintptr_t) this->_result._to_call._callee); | |
3307 tty->print_cr("result_to_call._callee_entry_point: " INTPTR_FORMAT, (uintptr_t) this->_result._to_call._callee_entry_point); | |
3308 tty->print_cr("result_to_call._bcp_advance: %d ", this->_result._to_call._bcp_advance); | |
3309 tty->print_cr("osr._osr_buf: " INTPTR_FORMAT, (uintptr_t) this->_result._osr._osr_buf); | |
3310 tty->print_cr("osr._osr_entry: " INTPTR_FORMAT, (uintptr_t) this->_result._osr._osr_entry); | |
3311 tty->print_cr("prev_link: " INTPTR_FORMAT, (uintptr_t) this->_prev_link); | |
3312 tty->print_cr("native_mirror: " INTPTR_FORMAT, (uintptr_t) this->_oop_temp); | |
3313 tty->print_cr("stack_base: " INTPTR_FORMAT, (uintptr_t) this->_stack_base); | |
3314 tty->print_cr("stack_limit: " INTPTR_FORMAT, (uintptr_t) this->_stack_limit); | |
3315 tty->print_cr("monitor_base: " INTPTR_FORMAT, (uintptr_t) this->_monitor_base); | |
3316 #ifdef SPARC | |
3317 tty->print_cr("last_Java_pc: " INTPTR_FORMAT, (uintptr_t) this->_last_Java_pc); | |
3318 tty->print_cr("frame_bottom: " INTPTR_FORMAT, (uintptr_t) this->_frame_bottom); | |
3319 tty->print_cr("&native_fresult: " INTPTR_FORMAT, (uintptr_t) &this->_native_fresult); | |
3320 tty->print_cr("native_lresult: " INTPTR_FORMAT, (uintptr_t) this->_native_lresult); | |
3321 #endif | |
7994 | 3322 #if !defined(ZERO) |
0 | 3323 tty->print_cr("last_Java_fp: " INTPTR_FORMAT, (uintptr_t) this->_last_Java_fp); |
7994 | 3324 #endif // !ZERO |
0 | 3325 tty->print_cr("self_link: " INTPTR_FORMAT, (uintptr_t) this->_self_link); |
3326 } | |
3327 | |
3328 extern "C" { | |
14395
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
3329 void PI(uintptr_t arg) { |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
3330 ((BytecodeInterpreter*)arg)->print(); |
48d3d0eb193b
8017317: PPC64 (part 7): cppInterpreter: implement support for biased locking
goetz
parents:
10393
diff
changeset
|
3331 } |
0 | 3332 } |
3333 #endif // PRODUCT | |
3334 | |
3335 #endif // JVMTI | |
3336 #endif // CC_INTERP |