< prev index next >

src/hotspot/cpu/zero/cppInterpreter_zero.cpp

Print this page




 256       CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method));
 257       if (HAS_PENDING_EXCEPTION)
 258         goto unwind_and_return;
 259     }
 260     InvocationCounter *counter = mcs->invocation_counter();
 261     counter->increment();
 262     if (counter->reached_InvocationLimit(mcs->backedge_counter())) {
 263       CALL_VM_NOCHECK(
 264         InterpreterRuntime::frequency_counter_overflow(thread, NULL));
 265       if (HAS_PENDING_EXCEPTION)
 266         goto unwind_and_return;
 267     }
 268   }
 269 
 270   // Lock if necessary
 271   BasicObjectLock *monitor;
 272   monitor = NULL;
 273   if (method->is_synchronized()) {
 274     monitor = (BasicObjectLock*) istate->stack_base();
 275     oop lockee = monitor->obj();
 276     markWord disp = lockee->mark().set_unlocked();
 277 
 278     monitor->lock()->set_displaced_header(disp);
 279     if (lockee->cas_set_mark(markWord::from_pointer(monitor), disp) != disp) {
 280       if (thread->is_lock_owned((address) disp.clear_lock_bits().to_pointer())) {
 281         monitor->lock()->set_displaced_header(markWord::from_pointer(NULL));
 282       }
 283       else {
 284         CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
 285         if (HAS_PENDING_EXCEPTION)
 286           goto unwind_and_return;
 287       }
 288     }
 289   }
 290 
 291   // Get the signature handler
 292   InterpreterRuntime::SignatureHandler *handler; {
 293     address handlerAddr = method->signature_handler();
 294     if (handlerAddr == NULL) {
 295       CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
 296       if (HAS_PENDING_EXCEPTION)
 297         goto unlock_unwind_and_return;
 298 
 299       handlerAddr = method->signature_handler();
 300       assert(handlerAddr != NULL, "eh?");
 301     }


 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] == 0) {
 401       istate->set_oop_temp(NULL);
 402     } else {
 403       jobject handle = reinterpret_cast<jobject>(result[0]);
 404       istate->set_oop_temp(JNIHandles::resolve(handle));
 405     }
 406   }
 407 
 408   // Reset handle block
 409   thread->active_handles()->clear();
 410 
 411  unlock_unwind_and_return:
 412 
 413   // Unlock if necessary
 414   if (monitor) {
 415     BasicLock *lock = monitor->lock();
 416     markWord header = lock->displaced_header();
 417     oop rcvr = monitor->obj();
 418     monitor->set_obj(NULL);
 419 
 420     if (header.to_pointer() != NULL) {
 421       markWord old_header = markWord::encode(lock);
 422       if (rcvr->cas_set_mark(header, old_header) != old_header) {
 423         monitor->set_obj(rcvr); {
 424           HandleMark hm(thread);
 425           CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(thread, monitor));
 426         }
 427       }
 428     }
 429   }
 430 
 431  unwind_and_return:
 432 
 433   // Unwind the current activation
 434   thread->pop_zero_frame();
 435 
 436   // Pop our parameters
 437   stack->set_sp(stack->sp() + method->size_of_parameters());
 438 
 439   // Push our result
 440   if (!HAS_PENDING_EXCEPTION) {
 441     BasicType type = method->result_type();




 256       CALL_VM_NOCHECK(mcs = InterpreterRuntime::build_method_counters(thread, method));
 257       if (HAS_PENDING_EXCEPTION)
 258         goto unwind_and_return;
 259     }
 260     InvocationCounter *counter = mcs->invocation_counter();
 261     counter->increment();
 262     if (counter->reached_InvocationLimit(mcs->backedge_counter())) {
 263       CALL_VM_NOCHECK(
 264         InterpreterRuntime::frequency_counter_overflow(thread, NULL));
 265       if (HAS_PENDING_EXCEPTION)
 266         goto unwind_and_return;
 267     }
 268   }
 269 
 270   // Lock if necessary
 271   BasicObjectLock *monitor;
 272   monitor = NULL;
 273   if (method->is_synchronized()) {
 274     monitor = (BasicObjectLock*) istate->stack_base();
 275     oop lockee = monitor->obj();
 276     markOop disp = lockee->mark()->set_unlocked();
 277 
 278     monitor->lock()->set_displaced_header(disp);
 279     if (lockee->cas_set_mark((markOop)monitor, disp) != disp) {
 280       if (thread->is_lock_owned((address) disp->clear_lock_bits())) {
 281         monitor->lock()->set_displaced_header(NULL);
 282       }
 283       else {
 284         CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
 285         if (HAS_PENDING_EXCEPTION)
 286           goto unwind_and_return;
 287       }
 288     }
 289   }
 290 
 291   // Get the signature handler
 292   InterpreterRuntime::SignatureHandler *handler; {
 293     address handlerAddr = method->signature_handler();
 294     if (handlerAddr == NULL) {
 295       CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
 296       if (HAS_PENDING_EXCEPTION)
 297         goto unlock_unwind_and_return;
 298 
 299       handlerAddr = method->signature_handler();
 300       assert(handlerAddr != NULL, "eh?");
 301     }


 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] == 0) {
 401       istate->set_oop_temp(NULL);
 402     } else {
 403       jobject handle = reinterpret_cast<jobject>(result[0]);
 404       istate->set_oop_temp(JNIHandles::resolve(handle));
 405     }
 406   }
 407 
 408   // Reset handle block
 409   thread->active_handles()->clear();
 410 
 411  unlock_unwind_and_return:
 412 
 413   // Unlock if necessary
 414   if (monitor) {
 415     BasicLock *lock = monitor->lock();
 416     markOop header = lock->displaced_header();
 417     oop rcvr = monitor->obj();
 418     monitor->set_obj(NULL);
 419 
 420     if (header != NULL) {
 421       markOop old_header = markOopDesc::encode(lock);
 422       if (rcvr->cas_set_mark(header, old_header) != old_header) {
 423         monitor->set_obj(rcvr); {
 424           HandleMark hm(thread);
 425           CALL_VM_NOCHECK(InterpreterRuntime::monitorexit(thread, monitor));
 426         }
 427       }
 428     }
 429   }
 430 
 431  unwind_and_return:
 432 
 433   // Unwind the current activation
 434   thread->pop_zero_frame();
 435 
 436   // Pop our parameters
 437   stack->set_sp(stack->sp() + method->size_of_parameters());
 438 
 439   // Push our result
 440   if (!HAS_PENDING_EXCEPTION) {
 441     BasicType type = method->result_type();


< prev index next >