< prev index next >

src/hotspot/cpu/zero/zeroInterpreter_zero.cpp

Print this page
@@ -329,28 +329,14 @@
    BasicObjectLock *monitor;
    monitor = NULL;
    if (method->is_synchronized()) {
      monitor = (BasicObjectLock*) istate->stack_base();
      oop lockee = monitor->obj();
-     markWord disp = lockee->mark().set_unlocked();
-     monitor->lock()->set_displaced_header(disp);
-     bool call_vm = UseHeavyMonitors;
-     bool inc_monitor_count = true;
-     if (call_vm || lockee->cas_set_mark(markWord::from_pointer(monitor), disp) != disp) {
-       // Is it simple recursive case?
-       if (!call_vm && thread->is_lock_owned((address) disp.clear_lock_bits().to_pointer())) {
-         monitor->lock()->set_displaced_header(markWord::from_pointer(NULL));
-       } else {
-         inc_monitor_count = false;
-         CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
-         if (HAS_PENDING_EXCEPTION)
-           goto unwind_and_return;
-       }
-     }
-     if (inc_monitor_count) {
-       THREAD->inc_held_monitor_count();
-     }
+ 
+     CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, lockee));
+     if (HAS_PENDING_EXCEPTION)
+       goto unwind_and_return;
    }
  
    // Get the signature handler
    InterpreterRuntime::SignatureHandler *handler; {
      address handlerAddr = method->signature_handler();

@@ -477,27 +463,13 @@
  
   unlock_unwind_and_return:
  
    // Unlock if necessary
    if (monitor) {
-     BasicLock *lock = monitor->lock();
-     markWord header = lock->displaced_header();
      oop rcvr = monitor->obj();
      monitor->set_obj(NULL);
- 
-     bool dec_monitor_count = true;
-     if (header.to_pointer() != NULL) {
-       markWord old_header = markWord::encode(lock);
-       if (rcvr->cas_set_mark(header, old_header) != old_header) {
-         monitor->set_obj(rcvr);
-         dec_monitor_count = false;
-         InterpreterRuntime::monitorexit(monitor);
-       }
-     }
-     if (dec_monitor_count) {
-       THREAD->dec_held_monitor_count();
-     }
+     InterpreterRuntime::monitorexit(rcvr);
    }
  
   unwind_and_return:
  
    // Unwind the current activation
< prev index next >