annotate src/share/vm/interpreter/bytecodeInterpreter.cpp @ 24234:ea6f94ab283b default tip

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