Mercurial > hg > graal-jvmci-8
annotate src/cpu/zero/vm/cppInterpreter_zero.cpp @ 23614:32b682649973 jdk8u75-b04
8132051: Better byte behavior
Reviewed-by: coleenp, roland
author | kevinw |
---|---|
date | Fri, 15 Jan 2016 22:33:15 +0000 |
parents | 6d13c17668d1 |
children | cc78c97abff8 |
rev | line source |
---|---|
1010 | 1 /* |
23614 | 2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
2480 | 3 * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. |
1010 | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | |
6 * This code is free software; you can redistribute it and/or modify it | |
7 * under the terms of the GNU General Public License version 2 only, as | |
8 * published by the Free Software Foundation. | |
9 * | |
10 * This code is distributed in the hope that it will be useful, but WITHOUT | |
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 * version 2 for more details (a copy is included in the LICENSE file that | |
14 * accompanied this code). | |
15 * | |
16 * You should have received a copy of the GNU General Public License version | |
17 * 2 along with this work; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1514
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1514
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1514
diff
changeset
|
22 * questions. |
1010 | 23 * |
24 */ | |
25 | |
1972 | 26 #include "precompiled.hpp" |
27 #include "asm/assembler.hpp" | |
28 #include "interpreter/bytecodeHistogram.hpp" | |
29 #include "interpreter/cppInterpreter.hpp" | |
30 #include "interpreter/interpreter.hpp" | |
31 #include "interpreter/interpreterGenerator.hpp" | |
32 #include "interpreter/interpreterRuntime.hpp" | |
33 #include "oops/arrayOop.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
34 #include "oops/methodData.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
35 #include "oops/method.hpp" |
1972 | 36 #include "oops/oop.inline.hpp" |
37 #include "prims/jvmtiExport.hpp" | |
38 #include "prims/jvmtiThreadState.hpp" | |
39 #include "runtime/arguments.hpp" | |
40 #include "runtime/deoptimization.hpp" | |
41 #include "runtime/frame.inline.hpp" | |
42 #include "runtime/interfaceSupport.hpp" | |
20197
ce8f6bb717c9
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
17980
diff
changeset
|
43 #include "runtime/orderAccess.inline.hpp" |
1972 | 44 #include "runtime/sharedRuntime.hpp" |
45 #include "runtime/stubRoutines.hpp" | |
46 #include "runtime/synchronizer.hpp" | |
47 #include "runtime/timer.hpp" | |
48 #include "runtime/vframeArray.hpp" | |
49 #include "stack_zero.inline.hpp" | |
50 #include "utilities/debug.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7195
diff
changeset
|
51 #include "utilities/macros.hpp" |
1972 | 52 #ifdef SHARK |
53 #include "shark/shark_globals.hpp" | |
54 #endif | |
1010 | 55 |
56 #ifdef CC_INTERP | |
57 | |
58 #define fixup_after_potential_safepoint() \ | |
59 method = istate->method() | |
60 | |
2480 | 61 #define CALL_VM_NOCHECK_NOFIX(func) \ |
1010 | 62 thread->set_last_Java_frame(); \ |
63 func; \ | |
2480 | 64 thread->reset_last_Java_frame(); |
65 | |
66 #define CALL_VM_NOCHECK(func) \ | |
67 CALL_VM_NOCHECK_NOFIX(func) \ | |
1010 | 68 fixup_after_potential_safepoint() |
69 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
70 int CppInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) { |
1010 | 71 JavaThread *thread = (JavaThread *) THREAD; |
72 | |
73 // Allocate and initialize our frame. | |
1514 | 74 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0); |
1010 | 75 thread->push_zero_frame(frame); |
76 | |
77 // Execute those bytecodes! | |
78 main_loop(0, THREAD); | |
1514 | 79 |
80 // No deoptimized frames on the stack | |
81 return 0; | |
1010 | 82 } |
83 | |
23614 | 84 intptr_t narrow(BasicType type, intptr_t result) { |
85 // mask integer result to narrower return type. | |
86 switch (type) { | |
87 case T_BOOLEAN: | |
88 return result&1; | |
89 case T_BYTE: | |
90 return (intptr_t)(jbyte)result; | |
91 case T_CHAR: | |
92 return (intptr_t)(uintptr_t)(jchar)result; | |
93 case T_SHORT: | |
94 return (intptr_t)(jshort)result; | |
95 case T_OBJECT: // nothing to do fall through | |
96 case T_LONG: | |
97 case T_INT: | |
98 case T_FLOAT: | |
99 case T_DOUBLE: | |
100 case T_VOID: | |
101 return result; | |
102 default : ShouldNotReachHere(); | |
103 } | |
104 } | |
105 | |
106 | |
1010 | 107 void CppInterpreter::main_loop(int recurse, TRAPS) { |
108 JavaThread *thread = (JavaThread *) THREAD; | |
109 ZeroStack *stack = thread->zero_stack(); | |
110 | |
111 // If we are entering from a deopt we may need to call | |
112 // ourself a few times in order to get to our frame. | |
113 if (recurse) | |
114 main_loop(recurse - 1, THREAD); | |
115 | |
116 InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame(); | |
117 interpreterState istate = frame->interpreter_state(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
118 Method* method = istate->method(); |
1010 | 119 |
120 intptr_t *result = NULL; | |
121 int result_slots = 0; | |
122 | |
123 while (true) { | |
124 // We can set up the frame anchor with everything we want at | |
125 // this point as we are thread_in_Java and no safepoints can | |
126 // occur until we go to vm mode. We do have to clear flags | |
127 // on return from vm but that is it. | |
128 thread->set_last_Java_frame(); | |
129 | |
130 // Call the interpreter | |
131 if (JvmtiExport::can_post_interpreter_events()) | |
132 BytecodeInterpreter::runWithChecks(istate); | |
133 else | |
134 BytecodeInterpreter::run(istate); | |
135 fixup_after_potential_safepoint(); | |
136 | |
137 // Clear the frame anchor | |
138 thread->reset_last_Java_frame(); | |
139 | |
140 // Examine the message from the interpreter to decide what to do | |
141 if (istate->msg() == BytecodeInterpreter::call_method) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
142 Method* callee = istate->callee(); |
1010 | 143 |
144 // Trim back the stack to put the parameters at the top | |
145 stack->set_sp(istate->stack() + 1); | |
146 | |
147 // Make the call | |
148 Interpreter::invoke_method(callee, istate->callee_entry_point(), THREAD); | |
149 fixup_after_potential_safepoint(); | |
150 | |
151 // Convert the result | |
152 istate->set_stack(stack->sp() - 1); | |
153 | |
154 // Restore the stack | |
155 stack->set_sp(istate->stack_limit() + 1); | |
156 | |
157 // Resume the interpreter | |
158 istate->set_msg(BytecodeInterpreter::method_resume); | |
159 } | |
160 else if (istate->msg() == BytecodeInterpreter::more_monitors) { | |
161 int monitor_words = frame::interpreter_frame_monitor_size(); | |
162 | |
163 // Allocate the space | |
1379 | 164 stack->overflow_check(monitor_words, THREAD); |
165 if (HAS_PENDING_EXCEPTION) | |
166 break; | |
1010 | 167 stack->alloc(monitor_words * wordSize); |
168 | |
169 // Move the expression stack contents | |
170 for (intptr_t *p = istate->stack() + 1; p < istate->stack_base(); p++) | |
171 *(p - monitor_words) = *p; | |
172 | |
173 // Move the expression stack pointers | |
174 istate->set_stack_limit(istate->stack_limit() - monitor_words); | |
175 istate->set_stack(istate->stack() - monitor_words); | |
176 istate->set_stack_base(istate->stack_base() - monitor_words); | |
177 | |
178 // Zero the new monitor so the interpreter can find it. | |
179 ((BasicObjectLock *) istate->stack_base())->set_obj(NULL); | |
180 | |
181 // Resume the interpreter | |
182 istate->set_msg(BytecodeInterpreter::got_monitors); | |
183 } | |
184 else if (istate->msg() == BytecodeInterpreter::return_from_method) { | |
185 // Copy the result into the caller's frame | |
1256 | 186 result_slots = type2size[result_type_of(method)]; |
1010 | 187 assert(result_slots >= 0 && result_slots <= 2, "what?"); |
188 result = istate->stack() + result_slots; | |
189 break; | |
190 } | |
191 else if (istate->msg() == BytecodeInterpreter::throwing_exception) { | |
192 assert(HAS_PENDING_EXCEPTION, "should do"); | |
193 break; | |
194 } | |
195 else if (istate->msg() == BytecodeInterpreter::do_osr) { | |
196 // Unwind the current frame | |
197 thread->pop_zero_frame(); | |
198 | |
199 // Remove any extension of the previous frame | |
200 int extra_locals = method->max_locals() - method->size_of_parameters(); | |
201 stack->set_sp(stack->sp() + extra_locals); | |
202 | |
203 // Jump into the OSR method | |
204 Interpreter::invoke_osr( | |
205 method, istate->osr_entry(), istate->osr_buf(), THREAD); | |
206 return; | |
207 } | |
208 else { | |
209 ShouldNotReachHere(); | |
210 } | |
211 } | |
212 | |
213 // Unwind the current frame | |
214 thread->pop_zero_frame(); | |
215 | |
216 // Pop our local variables | |
217 stack->set_sp(stack->sp() + method->max_locals()); | |
218 | |
219 // Push our result | |
23614 | 220 for (int i = 0; i < result_slots; i++) { |
221 // Adjust result to smaller | |
222 intptr_t res = result[-i]; | |
223 if (result_slots == 1) { | |
224 res = narrow(result_type_of(method), res); | |
225 } | |
226 stack->push(res); | |
227 } | |
1010 | 228 } |
229 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
230 int CppInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) { |
1010 | 231 // Make sure method is native and not abstract |
232 assert(method->is_native() && !method->is_abstract(), "should be"); | |
233 | |
234 JavaThread *thread = (JavaThread *) THREAD; | |
235 ZeroStack *stack = thread->zero_stack(); | |
236 | |
237 // Allocate and initialize our frame | |
1514 | 238 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0); |
1010 | 239 thread->push_zero_frame(frame); |
240 interpreterState istate = frame->interpreter_state(); | |
241 intptr_t *locals = istate->locals(); | |
242 | |
1078 | 243 // Update the invocation counter |
244 if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) { | |
10233 | 245 MethodCounters* mcs = method->method_counters(); |
246 if (mcs == NULL) { | |
247 CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method)); | |
248 if (HAS_PENDING_EXCEPTION) | |
249 goto unwind_and_return; | |
250 } | |
251 InvocationCounter *counter = mcs->invocation_counter(); | |
1078 | 252 counter->increment(); |
14420
abe03600372a
8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
12077
diff
changeset
|
253 if (counter->reached_InvocationLimit(mcs->backedge_counter())) { |
1078 | 254 CALL_VM_NOCHECK( |
255 InterpreterRuntime::frequency_counter_overflow(thread, NULL)); | |
256 if (HAS_PENDING_EXCEPTION) | |
257 goto unwind_and_return; | |
258 } | |
259 } | |
260 | |
1010 | 261 // Lock if necessary |
262 BasicObjectLock *monitor; | |
263 monitor = NULL; | |
264 if (method->is_synchronized()) { | |
265 monitor = (BasicObjectLock*) istate->stack_base(); | |
266 oop lockee = monitor->obj(); | |
267 markOop disp = lockee->mark()->set_unlocked(); | |
268 | |
269 monitor->lock()->set_displaced_header(disp); | |
270 if (Atomic::cmpxchg_ptr(monitor, lockee->mark_addr(), disp) != disp) { | |
271 if (thread->is_lock_owned((address) disp->clear_lock_bits())) { | |
272 monitor->lock()->set_displaced_header(NULL); | |
273 } | |
274 else { | |
275 CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor)); | |
276 if (HAS_PENDING_EXCEPTION) | |
277 goto unwind_and_return; | |
278 } | |
279 } | |
280 } | |
281 | |
282 // Get the signature handler | |
283 InterpreterRuntime::SignatureHandler *handler; { | |
284 address handlerAddr = method->signature_handler(); | |
285 if (handlerAddr == NULL) { | |
286 CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method)); | |
287 if (HAS_PENDING_EXCEPTION) | |
1139
b6f06e395428
6908267: Zero fails to unlock synchronized native methods on exception
never
parents:
1078
diff
changeset
|
288 goto unlock_unwind_and_return; |
1010 | 289 |
290 handlerAddr = method->signature_handler(); | |
291 assert(handlerAddr != NULL, "eh?"); | |
292 } | |
293 if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) { | |
294 CALL_VM_NOCHECK(handlerAddr = | |
295 InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL)); | |
296 if (HAS_PENDING_EXCEPTION) | |
1139
b6f06e395428
6908267: Zero fails to unlock synchronized native methods on exception
never
parents:
1078
diff
changeset
|
297 goto unlock_unwind_and_return; |
1010 | 298 } |
299 handler = \ | |
300 InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr); | |
301 } | |
302 | |
303 // Get the native function entry point | |
304 address function; | |
305 function = method->native_function(); | |
306 assert(function != NULL, "should be set if signature handler is"); | |
307 | |
308 // Build the argument list | |
1379 | 309 stack->overflow_check(handler->argument_count() * 2, THREAD); |
310 if (HAS_PENDING_EXCEPTION) | |
311 goto unlock_unwind_and_return; | |
312 | |
1010 | 313 void **arguments; |
314 void *mirror; { | |
315 arguments = | |
316 (void **) stack->alloc(handler->argument_count() * sizeof(void **)); | |
317 void **dst = arguments; | |
318 | |
319 void *env = thread->jni_environment(); | |
320 *(dst++) = &env; | |
321 | |
322 if (method->is_static()) { | |
323 istate->set_oop_temp( | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
324 method->constants()->pool_holder()->java_mirror()); |
1010 | 325 mirror = istate->oop_temp_addr(); |
326 *(dst++) = &mirror; | |
327 } | |
328 | |
329 intptr_t *src = locals; | |
330 for (int i = dst - arguments; i < handler->argument_count(); i++) { | |
331 ffi_type *type = handler->argument_type(i); | |
332 if (type == &ffi_type_pointer) { | |
333 if (*src) { | |
334 stack->push((intptr_t) src); | |
335 *(dst++) = stack->sp(); | |
336 } | |
337 else { | |
338 *(dst++) = src; | |
339 } | |
340 src--; | |
341 } | |
342 else if (type->size == 4) { | |
343 *(dst++) = src--; | |
344 } | |
345 else if (type->size == 8) { | |
346 src--; | |
347 *(dst++) = src--; | |
348 } | |
349 else { | |
350 ShouldNotReachHere(); | |
351 } | |
352 } | |
353 } | |
354 | |
355 // Set up the Java frame anchor | |
356 thread->set_last_Java_frame(); | |
357 | |
358 // Change the thread state to _thread_in_native | |
359 ThreadStateTransition::transition_from_java(thread, _thread_in_native); | |
360 | |
361 // Make the call | |
362 intptr_t result[4 - LogBytesPerWord]; | |
363 ffi_call(handler->cif(), (void (*)()) function, result, arguments); | |
364 | |
365 // Change the thread state back to _thread_in_Java. | |
366 // ThreadStateTransition::transition_from_native() cannot be used | |
367 // here because it does not check for asynchronous exceptions. | |
368 // We have to manage the transition ourself. | |
369 thread->set_thread_state(_thread_in_native_trans); | |
370 | |
371 // Make sure new state is visible in the GC thread | |
372 if (os::is_MP()) { | |
373 if (UseMembar) { | |
374 OrderAccess::fence(); | |
375 } | |
376 else { | |
377 InterfaceSupport::serialize_memory(thread); | |
378 } | |
379 } | |
380 | |
381 // Handle safepoint operations, pending suspend requests, | |
382 // and pending asynchronous exceptions. | |
383 if (SafepointSynchronize::do_call_back() || | |
384 thread->has_special_condition_for_native_trans()) { | |
385 JavaThread::check_special_condition_for_native_trans(thread); | |
386 CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops()); | |
387 } | |
388 | |
389 // Finally we can change the thread state to _thread_in_Java. | |
390 thread->set_thread_state(_thread_in_Java); | |
391 fixup_after_potential_safepoint(); | |
392 | |
393 // Clear the frame anchor | |
394 thread->reset_last_Java_frame(); | |
395 | |
396 // If the result was an oop then unbox it and store it in | |
397 // oop_temp where the garbage collector can see it before | |
398 // we release the handle it might be protected by. | |
399 if (handler->result_type() == &ffi_type_pointer) { | |
400 if (result[0]) | |
401 istate->set_oop_temp(*(oop *) result[0]); | |
402 else | |
403 istate->set_oop_temp(NULL); | |
404 } | |
405 | |
406 // Reset handle block | |
407 thread->active_handles()->clear(); | |
408 | |
1139
b6f06e395428
6908267: Zero fails to unlock synchronized native methods on exception
never
parents:
1078
diff
changeset
|
409 unlock_unwind_and_return: |
b6f06e395428
6908267: Zero fails to unlock synchronized native methods on exception
never
parents:
1078
diff
changeset
|
410 |
b6f06e395428
6908267: Zero fails to unlock synchronized native methods on exception
never
parents:
1078
diff
changeset
|
411 // Unlock if necessary |
b6f06e395428
6908267: Zero fails to unlock synchronized native methods on exception
never
parents:
1078
diff
changeset
|
412 if (monitor) { |
1010 | 413 BasicLock *lock = monitor->lock(); |
414 markOop header = lock->displaced_header(); | |
415 oop rcvr = monitor->obj(); | |
416 monitor->set_obj(NULL); | |
417 | |
418 if (header != NULL) { | |
419 if (Atomic::cmpxchg_ptr(header, rcvr->mark_addr(), lock) != lock) { | |
420 monitor->set_obj(rcvr); { | |
421 HandleMark hm(thread); | |
422 CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(thread, monitor)); | |
423 } | |
424 } | |
425 } | |
426 } | |
427 | |
428 unwind_and_return: | |
429 | |
430 // Unwind the current activation | |
431 thread->pop_zero_frame(); | |
432 | |
433 // Pop our parameters | |
434 stack->set_sp(stack->sp() + method->size_of_parameters()); | |
435 | |
436 // Push our result | |
437 if (!HAS_PENDING_EXCEPTION) { | |
1256 | 438 BasicType type = result_type_of(method); |
439 stack->set_sp(stack->sp() - type2size[type]); | |
1010 | 440 |
1256 | 441 switch (type) { |
1010 | 442 case T_VOID: |
443 break; | |
444 | |
445 case T_BOOLEAN: | |
446 #ifndef VM_LITTLE_ENDIAN | |
447 result[0] <<= (BitsPerWord - BitsPerByte); | |
448 #endif | |
449 SET_LOCALS_INT(*(jboolean *) result != 0, 0); | |
450 break; | |
451 | |
452 case T_CHAR: | |
453 #ifndef VM_LITTLE_ENDIAN | |
454 result[0] <<= (BitsPerWord - BitsPerShort); | |
455 #endif | |
456 SET_LOCALS_INT(*(jchar *) result, 0); | |
457 break; | |
458 | |
459 case T_BYTE: | |
460 #ifndef VM_LITTLE_ENDIAN | |
461 result[0] <<= (BitsPerWord - BitsPerByte); | |
462 #endif | |
463 SET_LOCALS_INT(*(jbyte *) result, 0); | |
464 break; | |
465 | |
466 case T_SHORT: | |
467 #ifndef VM_LITTLE_ENDIAN | |
468 result[0] <<= (BitsPerWord - BitsPerShort); | |
469 #endif | |
470 SET_LOCALS_INT(*(jshort *) result, 0); | |
471 break; | |
472 | |
473 case T_INT: | |
474 #ifndef VM_LITTLE_ENDIAN | |
475 result[0] <<= (BitsPerWord - BitsPerInt); | |
476 #endif | |
477 SET_LOCALS_INT(*(jint *) result, 0); | |
478 break; | |
479 | |
480 case T_LONG: | |
481 SET_LOCALS_LONG(*(jlong *) result, 0); | |
482 break; | |
483 | |
484 case T_FLOAT: | |
485 SET_LOCALS_FLOAT(*(jfloat *) result, 0); | |
486 break; | |
487 | |
488 case T_DOUBLE: | |
489 SET_LOCALS_DOUBLE(*(jdouble *) result, 0); | |
490 break; | |
491 | |
492 case T_OBJECT: | |
493 case T_ARRAY: | |
494 SET_LOCALS_OBJECT(istate->oop_temp(), 0); | |
495 break; | |
496 | |
497 default: | |
498 ShouldNotReachHere(); | |
499 } | |
500 } | |
1514 | 501 |
502 // No deoptimized frames on the stack | |
503 return 0; | |
1010 | 504 } |
505 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
506 int CppInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) { |
1010 | 507 JavaThread *thread = (JavaThread *) THREAD; |
508 ZeroStack *stack = thread->zero_stack(); | |
509 intptr_t *locals = stack->sp(); | |
510 | |
511 // Drop into the slow path if we need a safepoint check | |
512 if (SafepointSynchronize::do_call_back()) { | |
1514 | 513 return normal_entry(method, 0, THREAD); |
1010 | 514 } |
515 | |
516 // Load the object pointer and drop into the slow path | |
517 // if we have a NullPointerException | |
518 oop object = LOCALS_OBJECT(0); | |
519 if (object == NULL) { | |
1514 | 520 return normal_entry(method, 0, THREAD); |
1010 | 521 } |
522 | |
523 // Read the field index from the bytecode, which looks like this: | |
524 // 0: aload_0 | |
525 // 1: getfield | |
526 // 2: index | |
527 // 3: index | |
528 // 4: ireturn/areturn | |
529 // NB this is not raw bytecode: index is in machine order | |
530 u1 *code = method->code_base(); | |
531 assert(code[0] == Bytecodes::_aload_0 && | |
532 code[1] == Bytecodes::_getfield && | |
533 (code[4] == Bytecodes::_ireturn || | |
534 code[4] == Bytecodes::_areturn), "should do"); | |
535 u2 index = Bytes::get_native_u2(&code[2]); | |
536 | |
537 // Get the entry from the constant pool cache, and drop into | |
538 // the slow path if it has not been resolved | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
539 ConstantPoolCache* cache = method->constants()->cache(); |
1010 | 540 ConstantPoolCacheEntry* entry = cache->entry_at(index); |
541 if (!entry->is_resolved(Bytecodes::_getfield)) { | |
1514 | 542 return normal_entry(method, 0, THREAD); |
1010 | 543 } |
544 | |
545 // Get the result and push it onto the stack | |
546 switch (entry->flag_state()) { | |
547 case ltos: | |
548 case dtos: | |
1514 | 549 stack->overflow_check(1, CHECK_0); |
1010 | 550 stack->alloc(wordSize); |
551 break; | |
552 } | |
553 if (entry->is_volatile()) { | |
554 switch (entry->flag_state()) { | |
555 case ctos: | |
6926 | 556 SET_LOCALS_INT(object->char_field_acquire(entry->f2_as_index()), 0); |
1010 | 557 break; |
558 | |
559 case btos: | |
23614 | 560 case ztos: |
6926 | 561 SET_LOCALS_INT(object->byte_field_acquire(entry->f2_as_index()), 0); |
1010 | 562 break; |
563 | |
564 case stos: | |
6926 | 565 SET_LOCALS_INT(object->short_field_acquire(entry->f2_as_index()), 0); |
1010 | 566 break; |
567 | |
568 case itos: | |
6926 | 569 SET_LOCALS_INT(object->int_field_acquire(entry->f2_as_index()), 0); |
1010 | 570 break; |
571 | |
572 case ltos: | |
6926 | 573 SET_LOCALS_LONG(object->long_field_acquire(entry->f2_as_index()), 0); |
1010 | 574 break; |
575 | |
576 case ftos: | |
6926 | 577 SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2_as_index()), 0); |
1010 | 578 break; |
579 | |
580 case dtos: | |
6926 | 581 SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2_as_index()), 0); |
1010 | 582 break; |
583 | |
584 case atos: | |
6926 | 585 SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2_as_index()), 0); |
1010 | 586 break; |
587 | |
588 default: | |
589 ShouldNotReachHere(); | |
590 } | |
591 } | |
592 else { | |
593 switch (entry->flag_state()) { | |
594 case ctos: | |
6926 | 595 SET_LOCALS_INT(object->char_field(entry->f2_as_index()), 0); |
1010 | 596 break; |
597 | |
598 case btos: | |
23614 | 599 case ztos: |
6926 | 600 SET_LOCALS_INT(object->byte_field(entry->f2_as_index()), 0); |
1010 | 601 break; |
602 | |
603 case stos: | |
6926 | 604 SET_LOCALS_INT(object->short_field(entry->f2_as_index()), 0); |
1010 | 605 break; |
606 | |
607 case itos: | |
6926 | 608 SET_LOCALS_INT(object->int_field(entry->f2_as_index()), 0); |
1010 | 609 break; |
610 | |
611 case ltos: | |
6926 | 612 SET_LOCALS_LONG(object->long_field(entry->f2_as_index()), 0); |
1010 | 613 break; |
614 | |
615 case ftos: | |
6926 | 616 SET_LOCALS_FLOAT(object->float_field(entry->f2_as_index()), 0); |
1010 | 617 break; |
618 | |
619 case dtos: | |
6926 | 620 SET_LOCALS_DOUBLE(object->double_field(entry->f2_as_index()), 0); |
1010 | 621 break; |
622 | |
623 case atos: | |
6926 | 624 SET_LOCALS_OBJECT(object->obj_field(entry->f2_as_index()), 0); |
1010 | 625 break; |
626 | |
627 default: | |
628 ShouldNotReachHere(); | |
629 } | |
630 } | |
1514 | 631 |
632 // No deoptimized frames on the stack | |
633 return 0; | |
1010 | 634 } |
635 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
636 int CppInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) { |
1010 | 637 JavaThread *thread = (JavaThread *) THREAD; |
638 ZeroStack *stack = thread->zero_stack(); | |
639 | |
640 // Drop into the slow path if we need a safepoint check | |
641 if (SafepointSynchronize::do_call_back()) { | |
1514 | 642 return normal_entry(method, 0, THREAD); |
1010 | 643 } |
644 | |
645 // Pop our parameters | |
646 stack->set_sp(stack->sp() + method->size_of_parameters()); | |
1514 | 647 |
648 // No deoptimized frames on the stack | |
649 return 0; | |
1010 | 650 } |
651 | |
2480 | 652 // The new slots will be inserted before slot insert_before. |
653 // Slots < insert_before will have the same slot number after the insert. | |
654 // Slots >= insert_before will become old_slot + num_slots. | |
655 void CppInterpreter::insert_vmslots(int insert_before, int num_slots, TRAPS) { | |
656 JavaThread *thread = (JavaThread *) THREAD; | |
657 ZeroStack *stack = thread->zero_stack(); | |
658 | |
659 // Allocate the space | |
660 stack->overflow_check(num_slots, CHECK); | |
661 stack->alloc(num_slots * wordSize); | |
662 intptr_t *vmslots = stack->sp(); | |
663 | |
664 // Shuffle everything up | |
665 for (int i = 0; i < insert_before; i++) | |
666 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i + num_slots), i); | |
667 } | |
668 | |
669 void CppInterpreter::remove_vmslots(int first_slot, int num_slots, TRAPS) { | |
670 JavaThread *thread = (JavaThread *) THREAD; | |
671 ZeroStack *stack = thread->zero_stack(); | |
672 intptr_t *vmslots = stack->sp(); | |
673 | |
674 // Move everything down | |
675 for (int i = first_slot - 1; i >= 0; i--) | |
676 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i + num_slots); | |
677 | |
678 // Deallocate the space | |
679 stack->set_sp(stack->sp() + num_slots); | |
680 } | |
681 | |
682 BasicType CppInterpreter::result_type_of_handle(oop method_handle) { | |
683 oop method_type = java_lang_invoke_MethodHandle::type(method_handle); | |
684 oop return_type = java_lang_invoke_MethodType::rtype(method_type); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
685 return java_lang_Class::as_BasicType(return_type, (Klass* *) NULL); |
2480 | 686 } |
687 | |
688 intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack, | |
689 oop method_handle) { | |
690 oop method_type = java_lang_invoke_MethodHandle::type(method_handle); | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6071
diff
changeset
|
691 int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type); |
2480 | 692 |
693 return stack->sp() + argument_slots; | |
694 } | |
695 | |
696 IRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread, | |
697 Symbol* name, | |
698 char* message)) | |
699 THROW_MSG(name, message); | |
700 IRT_END | |
701 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
702 InterpreterFrame *InterpreterFrame::build(Method* const method, TRAPS) { |
1379 | 703 JavaThread *thread = (JavaThread *) THREAD; |
704 ZeroStack *stack = thread->zero_stack(); | |
705 | |
706 // Calculate the size of the frame we'll build, including | |
707 // any adjustments to the caller's frame that we'll make. | |
708 int extra_locals = 0; | |
709 int monitor_words = 0; | |
710 int stack_words = 0; | |
1010 | 711 |
1379 | 712 if (!method->is_native()) { |
713 extra_locals = method->max_locals() - method->size_of_parameters(); | |
714 stack_words = method->max_stack(); | |
1010 | 715 } |
1379 | 716 if (method->is_synchronized()) { |
717 monitor_words = frame::interpreter_frame_monitor_size(); | |
718 } | |
719 stack->overflow_check( | |
720 extra_locals + header_words + monitor_words + stack_words, CHECK_NULL); | |
1010 | 721 |
1379 | 722 // Adjust the caller's stack frame to accomodate any additional |
723 // local variables we have contiguously with our parameters. | |
724 for (int i = 0; i < extra_locals; i++) | |
725 stack->push(0); | |
1010 | 726 |
727 intptr_t *locals; | |
728 if (method->is_native()) | |
729 locals = stack->sp() + (method->size_of_parameters() - 1); | |
730 else | |
731 locals = stack->sp() + (method->max_locals() - 1); | |
732 | |
733 stack->push(0); // next_frame, filled in later | |
734 intptr_t *fp = stack->sp(); | |
735 assert(fp - stack->sp() == next_frame_off, "should be"); | |
736 | |
737 stack->push(INTERPRETER_FRAME); | |
738 assert(fp - stack->sp() == frame_type_off, "should be"); | |
739 | |
740 interpreterState istate = | |
741 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter)); | |
742 assert(fp - stack->sp() == istate_off, "should be"); | |
743 | |
744 istate->set_locals(locals); | |
745 istate->set_method(method); | |
746 istate->set_self_link(istate); | |
747 istate->set_prev_link(NULL); | |
748 istate->set_thread(thread); | |
749 istate->set_bcp(method->is_native() ? NULL : method->code_base()); | |
750 istate->set_constants(method->constants()->cache()); | |
751 istate->set_msg(BytecodeInterpreter::method_entry); | |
752 istate->set_oop_temp(NULL); | |
753 istate->set_mdx(NULL); | |
754 istate->set_callee(NULL); | |
755 | |
756 istate->set_monitor_base((BasicObjectLock *) stack->sp()); | |
757 if (method->is_synchronized()) { | |
758 BasicObjectLock *monitor = | |
759 (BasicObjectLock *) stack->alloc(monitor_words * wordSize); | |
760 oop object; | |
761 if (method->is_static()) | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
762 object = method->constants()->pool_holder()->java_mirror(); |
1010 | 763 else |
22925 | 764 object = (oop) (void*)locals[0]; |
1010 | 765 monitor->set_obj(object); |
766 } | |
767 | |
768 istate->set_stack_base(stack->sp()); | |
769 istate->set_stack(stack->sp() - 1); | |
770 if (stack_words) | |
771 stack->alloc(stack_words * wordSize); | |
772 istate->set_stack_limit(stack->sp() - 1); | |
773 | |
774 return (InterpreterFrame *) fp; | |
775 } | |
776 | |
777 int AbstractInterpreter::BasicType_as_index(BasicType type) { | |
778 int i = 0; | |
779 switch (type) { | |
780 case T_BOOLEAN: i = 0; break; | |
781 case T_CHAR : i = 1; break; | |
782 case T_BYTE : i = 2; break; | |
783 case T_SHORT : i = 3; break; | |
784 case T_INT : i = 4; break; | |
785 case T_LONG : i = 5; break; | |
786 case T_VOID : i = 6; break; | |
787 case T_FLOAT : i = 7; break; | |
788 case T_DOUBLE : i = 8; break; | |
789 case T_OBJECT : i = 9; break; | |
790 case T_ARRAY : i = 9; break; | |
791 default : ShouldNotReachHere(); | |
792 } | |
793 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, | |
794 "index out of bounds"); | |
795 return i; | |
796 } | |
797 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
798 BasicType CppInterpreter::result_type_of(Method* method) { |
1256 | 799 BasicType t; |
800 switch (method->result_index()) { | |
801 case 0 : t = T_BOOLEAN; break; | |
802 case 1 : t = T_CHAR; break; | |
803 case 2 : t = T_BYTE; break; | |
804 case 3 : t = T_SHORT; break; | |
805 case 4 : t = T_INT; break; | |
806 case 5 : t = T_LONG; break; | |
807 case 6 : t = T_VOID; break; | |
808 case 7 : t = T_FLOAT; break; | |
809 case 8 : t = T_DOUBLE; break; | |
810 case 9 : t = T_OBJECT; break; | |
811 default: ShouldNotReachHere(); | |
812 } | |
813 assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(), | |
814 "out of step with AbstractInterpreter::BasicType_as_index"); | |
815 return t; | |
816 } | |
817 | |
1010 | 818 address InterpreterGenerator::generate_empty_entry() { |
819 if (!UseFastEmptyMethods) | |
820 return NULL; | |
821 | |
822 return generate_entry((address) CppInterpreter::empty_entry); | |
823 } | |
824 | |
825 address InterpreterGenerator::generate_accessor_entry() { | |
826 if (!UseFastAccessorMethods) | |
827 return NULL; | |
828 | |
829 return generate_entry((address) CppInterpreter::accessor_entry); | |
830 } | |
831 | |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
832 address InterpreterGenerator::generate_Reference_get_entry(void) { |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7195
diff
changeset
|
833 #if INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
834 if (UseG1GC) { |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
835 // We need to generate have a routine that generates code to: |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
836 // * load the value in the referent field |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
837 // * passes that value to the pre-barrier. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
838 // |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
839 // In the case of G1 this will record the value of the |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
840 // referent in an SATB buffer if marking is active. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
841 // This will cause concurrent marking to mark the referent |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
842 // field as live. |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
843 Unimplemented(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
844 } |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
7195
diff
changeset
|
845 #endif // INCLUDE_ALL_GCS |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
846 |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
847 // If G1 is not enabled then attempt to go through the accessor entry point |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
848 // Reference.get is an accessor |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
849 return generate_accessor_entry(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
850 } |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
851 |
1010 | 852 address InterpreterGenerator::generate_native_entry(bool synchronized) { |
853 assert(synchronized == false, "should be"); | |
854 | |
855 return generate_entry((address) CppInterpreter::native_entry); | |
856 } | |
857 | |
858 address InterpreterGenerator::generate_normal_entry(bool synchronized) { | |
859 assert(synchronized == false, "should be"); | |
860 | |
861 return generate_entry((address) CppInterpreter::normal_entry); | |
862 } | |
863 | |
864 address AbstractInterpreterGenerator::generate_method_entry( | |
865 AbstractInterpreter::MethodKind kind) { | |
866 address entry_point = NULL; | |
867 | |
868 switch (kind) { | |
869 case Interpreter::zerolocals: | |
870 case Interpreter::zerolocals_synchronized: | |
871 break; | |
872 | |
873 case Interpreter::native: | |
874 entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); | |
875 break; | |
876 | |
877 case Interpreter::native_synchronized: | |
878 entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); | |
879 break; | |
880 | |
881 case Interpreter::empty: | |
882 entry_point = ((InterpreterGenerator*) this)->generate_empty_entry(); | |
883 break; | |
884 | |
885 case Interpreter::accessor: | |
886 entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry(); | |
887 break; | |
888 | |
889 case Interpreter::abstract: | |
890 entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry(); | |
891 break; | |
892 | |
893 case Interpreter::java_lang_math_sin: | |
894 case Interpreter::java_lang_math_cos: | |
895 case Interpreter::java_lang_math_tan: | |
896 case Interpreter::java_lang_math_abs: | |
897 case Interpreter::java_lang_math_log: | |
898 case Interpreter::java_lang_math_log10: | |
899 case Interpreter::java_lang_math_sqrt: | |
6926 | 900 case Interpreter::java_lang_math_pow: |
901 case Interpreter::java_lang_math_exp: | |
1010 | 902 entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); |
903 break; | |
904 | |
3249
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
905 case Interpreter::java_lang_ref_reference_get: |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
906 entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
907 break; |
e1162778c1c8
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
2376
diff
changeset
|
908 |
1010 | 909 default: |
910 ShouldNotReachHere(); | |
911 } | |
912 | |
913 if (entry_point == NULL) | |
914 entry_point = ((InterpreterGenerator*) this)->generate_normal_entry(false); | |
915 | |
916 return entry_point; | |
917 } | |
918 | |
919 InterpreterGenerator::InterpreterGenerator(StubQueue* code) | |
920 : CppInterpreterGenerator(code) { | |
921 generate_all(); | |
922 } | |
923 | |
924 // Deoptimization helpers | |
925 | |
1379 | 926 InterpreterFrame *InterpreterFrame::build(int size, TRAPS) { |
927 ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack(); | |
928 | |
1010 | 929 int size_in_words = size >> LogBytesPerWord; |
930 assert(size_in_words * wordSize == size, "unaligned"); | |
931 assert(size_in_words >= header_words, "too small"); | |
1379 | 932 stack->overflow_check(size_in_words, CHECK_NULL); |
1010 | 933 |
934 stack->push(0); // next_frame, filled in later | |
935 intptr_t *fp = stack->sp(); | |
936 assert(fp - stack->sp() == next_frame_off, "should be"); | |
937 | |
938 stack->push(INTERPRETER_FRAME); | |
939 assert(fp - stack->sp() == frame_type_off, "should be"); | |
940 | |
941 interpreterState istate = | |
942 (interpreterState) stack->alloc(sizeof(BytecodeInterpreter)); | |
943 assert(fp - stack->sp() == istate_off, "should be"); | |
944 istate->set_self_link(NULL); // mark invalid | |
945 | |
946 stack->alloc((size_in_words - header_words) * wordSize); | |
947 | |
948 return (InterpreterFrame *) fp; | |
949 } | |
950 | |
17980
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
951 int AbstractInterpreter::size_activation(int max_stack, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
952 int tempcount, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
953 int extra_args, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
954 int moncount, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
955 int callee_param_count, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
956 int callee_locals, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
957 bool is_top_frame) { |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
958 int header_words = InterpreterFrame::header_words; |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
959 int monitor_words = moncount * frame::interpreter_frame_monitor_size(); |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
960 int stack_words = is_top_frame ? max_stack : tempcount; |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
961 int callee_extra_locals = callee_locals - callee_param_count; |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
962 |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
963 return header_words + monitor_words + stack_words + callee_extra_locals; |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
964 } |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
965 |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
966 void AbstractInterpreter::layout_activation(Method* method, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
967 int tempcount, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
968 int popframe_extra_args, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
969 int moncount, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
970 int caller_actual_parameters, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
971 int callee_param_count, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
972 int callee_locals, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
973 frame* caller, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
974 frame* interpreter_frame, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
975 bool is_top_frame, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
976 bool is_bottom_frame) { |
1010 | 977 assert(popframe_extra_args == 0, "what to do?"); |
978 assert(!is_top_frame || (!callee_locals && !callee_param_count), | |
1605 | 979 "top frame should have no caller"); |
1010 | 980 |
981 // This code must exactly match what InterpreterFrame::build | |
982 // does (the full InterpreterFrame::build, that is, not the | |
983 // one that creates empty frames for the deoptimizer). | |
984 // | |
17980
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
985 // interpreter_frame will be filled in. It's size is determined by |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
986 // a previous call to the size_activation() method, |
1010 | 987 // |
988 // Note that tempcount is the current size of the expression | |
989 // stack. For top most frames we will allocate a full sized | |
990 // expression stack and not the trimmed version that non-top | |
991 // frames have. | |
992 | |
993 int monitor_words = moncount * frame::interpreter_frame_monitor_size(); | |
17980
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
994 intptr_t *locals = interpreter_frame->fp() + method->max_locals(); |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
995 interpreterState istate = interpreter_frame->get_interpreterState(); |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
996 intptr_t *monitor_base = (intptr_t*) istate; |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
997 intptr_t *stack_base = monitor_base - monitor_words; |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
998 intptr_t *stack = stack_base - tempcount - 1; |
1010 | 999 |
17980
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1000 BytecodeInterpreter::layout_interpreterState(istate, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1001 caller, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1002 NULL, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1003 method, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1004 locals, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1005 stack, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1006 stack_base, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1007 monitor_base, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1008 NULL, |
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17795
diff
changeset
|
1009 is_top_frame); |
1010 | 1010 } |
1011 | |
1012 void BytecodeInterpreter::layout_interpreterState(interpreterState istate, | |
1013 frame* caller, | |
1014 frame* current, | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1015 Method* method, |
1010 | 1016 intptr_t* locals, |
1017 intptr_t* stack, | |
1018 intptr_t* stack_base, | |
1019 intptr_t* monitor_base, | |
1020 intptr_t* frame_bottom, | |
1021 bool is_top_frame) { | |
1022 istate->set_locals(locals); | |
1023 istate->set_method(method); | |
1024 istate->set_self_link(istate); | |
1025 istate->set_prev_link(NULL); | |
1026 // thread will be set by a hacky repurposing of frame::patch_pc() | |
1027 // bcp will be set by vframeArrayElement::unpack_on_stack() | |
1028 istate->set_constants(method->constants()->cache()); | |
1029 istate->set_msg(BytecodeInterpreter::method_resume); | |
1030 istate->set_bcp_advance(0); | |
1031 istate->set_oop_temp(NULL); | |
1032 istate->set_mdx(NULL); | |
1033 if (caller->is_interpreted_frame()) { | |
1034 interpreterState prev = caller->get_interpreterState(); | |
1035 prev->set_callee(method); | |
1036 if (*prev->bcp() == Bytecodes::_invokeinterface) | |
1037 prev->set_bcp_advance(5); | |
1038 else | |
1039 prev->set_bcp_advance(3); | |
1040 } | |
1041 istate->set_callee(NULL); | |
1042 istate->set_monitor_base((BasicObjectLock *) monitor_base); | |
1043 istate->set_stack_base(stack_base); | |
1044 istate->set_stack(stack); | |
1045 istate->set_stack_limit(stack_base - method->max_stack() - 1); | |
1046 } | |
1047 | |
13010
bd3237e0e18d
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
12077
diff
changeset
|
1048 address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { |
1010 | 1049 ShouldNotCallThis(); |
12077
e16282db4946
8022956: Clang: enable return type warnings on BSD
twisti
parents:
10233
diff
changeset
|
1050 return NULL; |
1010 | 1051 } |
1052 | |
1053 address CppInterpreter::deopt_entry(TosState state, int length) { | |
1054 return NULL; | |
1055 } | |
1056 | |
1057 // Helper for (runtime) stack overflow checks | |
1058 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1059 int AbstractInterpreter::size_top_interpreter_activation(Method* method) { |
1010 | 1060 return 0; |
1061 } | |
1062 | |
1063 // Helper for figuring out if frames are interpreter frames | |
1064 | |
1065 bool CppInterpreter::contains(address pc) { | |
1066 return false; // make frame::print_value_on work | |
1067 } | |
1068 | |
1069 // Result handlers and convertors | |
1070 | |
1071 address CppInterpreterGenerator::generate_result_handler_for( | |
1072 BasicType type) { | |
1073 assembler()->advance(1); | |
1074 return ShouldNotCallThisStub(); | |
1075 } | |
1076 | |
1077 address CppInterpreterGenerator::generate_tosca_to_stack_converter( | |
1078 BasicType type) { | |
1079 assembler()->advance(1); | |
1080 return ShouldNotCallThisStub(); | |
1081 } | |
1082 | |
1083 address CppInterpreterGenerator::generate_stack_to_stack_converter( | |
1084 BasicType type) { | |
1085 assembler()->advance(1); | |
1086 return ShouldNotCallThisStub(); | |
1087 } | |
1088 | |
1089 address CppInterpreterGenerator::generate_stack_to_native_abi_converter( | |
1090 BasicType type) { | |
1091 assembler()->advance(1); | |
1092 return ShouldNotCallThisStub(); | |
1093 } | |
1094 | |
1095 #endif // CC_INTERP |