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