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