20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/assembler.hpp"
28 #include "interpreter/interpreter.hpp"
29 #include "interpreter/interpreterRuntime.hpp"
30 #include "interpreter/zero/bytecodeInterpreter.hpp"
31 #include "interpreter/zero/zeroInterpreter.hpp"
32 #include "interpreter/zero/zeroInterpreterGenerator.hpp"
33 #include "oops/access.inline.hpp"
34 #include "oops/cpCache.inline.hpp"
35 #include "oops/klass.inline.hpp"
36 #include "oops/methodData.hpp"
37 #include "oops/method.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "prims/jvmtiExport.hpp"
40 #include "runtime/frame.inline.hpp"
41 #include "runtime/handles.inline.hpp"
42 #include "runtime/interfaceSupport.inline.hpp"
43 #include "runtime/jniHandles.inline.hpp"
44 #include "runtime/timer.hpp"
45 #include "runtime/timerTrace.hpp"
46 #include "utilities/debug.hpp"
47 #include "utilities/macros.hpp"
48
49 #include "entry_zero.hpp"
50 #include "stack_zero.inline.hpp"
51
52 void ZeroInterpreter::initialize_stub() {
53 if (_code != nullptr) return;
54
55 // generate interpreter
56 int code_size = InterpreterCodeSize;
57 NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
58 _code = new StubQueue(new InterpreterCodeletInterface, code_size, nullptr,
59 "Interpreter");
60 }
61
62 void ZeroInterpreter::initialize_code() {
63 AbstractInterpreter::initialize();
64
65 // generate interpreter
66 { ResourceMark rm;
314
315 int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
316 // Make sure method is native and not abstract
317 assert(method->is_native() && !method->is_abstract(), "should be");
318
319 JavaThread *thread = THREAD;
320 ZeroStack *stack = thread->zero_stack();
321
322 // Allocate and initialize our frame
323 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
324 thread->push_zero_frame(frame);
325 interpreterState istate = frame->interpreter_state();
326 intptr_t *locals = istate->locals();
327
328 // Lock if necessary
329 BasicObjectLock *monitor;
330 monitor = nullptr;
331 if (method->is_synchronized()) {
332 monitor = (BasicObjectLock*) istate->stack_base();
333 oop lockee = monitor->obj();
334 markWord disp = lockee->mark().set_unlocked();
335 monitor->lock()->set_displaced_header(disp);
336 bool call_vm = (LockingMode == LM_MONITOR);
337 bool inc_monitor_count = true;
338 if (call_vm || lockee->cas_set_mark(markWord::from_pointer(monitor), disp) != disp) {
339 // Is it simple recursive case?
340 if (!call_vm && thread->is_lock_owned((address) disp.clear_lock_bits().to_pointer())) {
341 monitor->lock()->set_displaced_header(markWord::from_pointer(nullptr));
342 } else {
343 inc_monitor_count = false;
344 CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
345 if (HAS_PENDING_EXCEPTION)
346 goto unwind_and_return;
347 }
348 }
349 if (inc_monitor_count) {
350 THREAD->inc_held_monitor_count();
351 }
352 }
353
354 // Get the signature handler
355 InterpreterRuntime::SignatureHandler *handler; {
356 address handlerAddr = method->signature_handler();
357 if (handlerAddr == nullptr) {
358 CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
359 if (HAS_PENDING_EXCEPTION)
360 goto unlock_unwind_and_return;
361
362 handlerAddr = method->signature_handler();
363 assert(handlerAddr != nullptr, "eh?");
364 }
365 if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) {
366 CALL_VM_NOCHECK(handlerAddr =
367 InterpreterRuntime::slow_signature_handler(thread, method, nullptr,nullptr));
368 if (HAS_PENDING_EXCEPTION)
369 goto unlock_unwind_and_return;
370 }
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/assembler.hpp"
28 #include "interpreter/interpreter.hpp"
29 #include "interpreter/interpreterRuntime.hpp"
30 #include "interpreter/zero/bytecodeInterpreter.hpp"
31 #include "interpreter/zero/zeroInterpreter.hpp"
32 #include "interpreter/zero/zeroInterpreterGenerator.hpp"
33 #include "oops/access.inline.hpp"
34 #include "oops/cpCache.inline.hpp"
35 #include "oops/klass.inline.hpp"
36 #include "oops/methodData.hpp"
37 #include "oops/method.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "prims/jvmtiExport.hpp"
40 #include "runtime/basicLock.inline.hpp"
41 #include "runtime/frame.inline.hpp"
42 #include "runtime/handles.inline.hpp"
43 #include "runtime/interfaceSupport.inline.hpp"
44 #include "runtime/jniHandles.inline.hpp"
45 #include "runtime/timer.hpp"
46 #include "runtime/timerTrace.hpp"
47 #include "utilities/debug.hpp"
48 #include "utilities/globalDefinitions.hpp"
49 #include "utilities/macros.hpp"
50
51 #include "entry_zero.hpp"
52 #include "stack_zero.inline.hpp"
53
54 void ZeroInterpreter::initialize_stub() {
55 if (_code != nullptr) return;
56
57 // generate interpreter
58 int code_size = InterpreterCodeSize;
59 NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
60 _code = new StubQueue(new InterpreterCodeletInterface, code_size, nullptr,
61 "Interpreter");
62 }
63
64 void ZeroInterpreter::initialize_code() {
65 AbstractInterpreter::initialize();
66
67 // generate interpreter
68 { ResourceMark rm;
316
317 int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
318 // Make sure method is native and not abstract
319 assert(method->is_native() && !method->is_abstract(), "should be");
320
321 JavaThread *thread = THREAD;
322 ZeroStack *stack = thread->zero_stack();
323
324 // Allocate and initialize our frame
325 InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
326 thread->push_zero_frame(frame);
327 interpreterState istate = frame->interpreter_state();
328 intptr_t *locals = istate->locals();
329
330 // Lock if necessary
331 BasicObjectLock *monitor;
332 monitor = nullptr;
333 if (method->is_synchronized()) {
334 monitor = (BasicObjectLock*) istate->stack_base();
335 oop lockee = monitor->obj();
336 bool success = false;
337 if (LockingMode == LM_LEGACY) {
338 markWord disp = lockee->mark().set_unlocked();
339 monitor->lock()->set_displaced_header(disp);
340 success = true;
341 if (lockee->cas_set_mark(markWord::from_pointer(monitor), disp) != disp) {
342 // Is it simple recursive case?
343 if (thread->is_lock_owned((address) disp.clear_lock_bits().to_pointer())) {
344 monitor->lock()->set_displaced_header(markWord::from_pointer(nullptr));
345 } else {
346 success = false;
347 }
348 }
349 if (success) {
350 THREAD->inc_held_monitor_count();
351 }
352 }
353 if (!success) {
354 CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
355 if (HAS_PENDING_EXCEPTION)
356 goto unwind_and_return;
357 }
358 }
359
360 // Get the signature handler
361 InterpreterRuntime::SignatureHandler *handler; {
362 address handlerAddr = method->signature_handler();
363 if (handlerAddr == nullptr) {
364 CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
365 if (HAS_PENDING_EXCEPTION)
366 goto unlock_unwind_and_return;
367
368 handlerAddr = method->signature_handler();
369 assert(handlerAddr != nullptr, "eh?");
370 }
371 if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) {
372 CALL_VM_NOCHECK(handlerAddr =
373 InterpreterRuntime::slow_signature_handler(thread, method, nullptr,nullptr));
374 if (HAS_PENDING_EXCEPTION)
375 goto unlock_unwind_and_return;
376 }
|