< prev index next >

src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp

Print this page
*** 622,26 ***
          // The initial monitor is ours for the taking.
          BasicObjectLock* mon = &istate->monitor_base()[-1];
          mon->set_obj(rcvr);
  
          // Traditional lightweight locking.
!         markWord displaced = rcvr->mark().set_unlocked();
-         mon->lock()->set_displaced_header(displaced);
-         bool call_vm = UseHeavyMonitors;
-         bool inc_monitor_count = true;
-         if (call_vm || rcvr->cas_set_mark(markWord::from_pointer(mon), displaced) != displaced) {
-           // Is it simple recursive case?
-           if (!call_vm && THREAD->is_lock_owned((address) displaced.clear_lock_bits().to_pointer())) {
-             mon->lock()->set_displaced_header(markWord::from_pointer(NULL));
-           } else {
-             inc_monitor_count = false;
-             CALL_VM(InterpreterRuntime::monitorenter(THREAD, mon), handle_exception);
-           }
-         }
-         if (inc_monitor_count) {
-           THREAD->inc_held_monitor_count();
-         }
        }
        THREAD->clr_do_not_unlock();
  
        // Notify jvmti.
        // Whenever JVMTI puts a thread in interp_only_mode, method
--- 622,11 ---
          // The initial monitor is ours for the taking.
          BasicObjectLock* mon = &istate->monitor_base()[-1];
          mon->set_obj(rcvr);
  
          // Traditional lightweight locking.
!         CALL_VM(InterpreterRuntime::monitorenter(THREAD, rcvr), handle_exception);
        }
        THREAD->clr_do_not_unlock();
  
        // Notify jvmti.
        // Whenever JVMTI puts a thread in interp_only_mode, method

*** 721,26 ***
        BasicObjectLock* entry = (BasicObjectLock*) istate->stack_base();
        assert(entry->obj() == NULL, "Frame manager didn't allocate the monitor");
        entry->set_obj(lockee);
  
        // traditional lightweight locking
!       markWord displaced = lockee->mark().set_unlocked();
-       entry->lock()->set_displaced_header(displaced);
-       bool call_vm = UseHeavyMonitors;
-       bool inc_monitor_count = true;
-       if (call_vm || lockee->cas_set_mark(markWord::from_pointer(entry), displaced) != displaced) {
-         // Is it simple recursive case?
-         if (!call_vm && THREAD->is_lock_owned((address) displaced.clear_lock_bits().to_pointer())) {
-           entry->lock()->set_displaced_header(markWord::from_pointer(NULL));
-         } else {
-           inc_monitor_count = false;
-           CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
-         }
-       }
-       if (inc_monitor_count) {
-         THREAD->inc_held_monitor_count();
-       }
        UPDATE_PC_AND_TOS(1, -1);
        goto run;
      }
      default: {
        fatal("Unexpected message from frame manager");
--- 706,11 ---
        BasicObjectLock* entry = (BasicObjectLock*) istate->stack_base();
        assert(entry->obj() == NULL, "Frame manager didn't allocate the monitor");
        entry->set_obj(lockee);
  
        // traditional lightweight locking
!       CALL_VM(InterpreterRuntime::monitorenter(THREAD, lockee), handle_exception);
        UPDATE_PC_AND_TOS(1, -1);
        goto run;
      }
      default: {
        fatal("Unexpected message from frame manager");

*** 1651,26 ***
          }
          if (entry != NULL) {
            entry->set_obj(lockee);
  
            // traditional lightweight locking
!           markWord displaced = lockee->mark().set_unlocked();
-           entry->lock()->set_displaced_header(displaced);
-           bool call_vm = UseHeavyMonitors;
-           bool inc_monitor_count = true;
-           if (call_vm || lockee->cas_set_mark(markWord::from_pointer(entry), displaced) != displaced) {
-             // Is it simple recursive case?
-             if (!call_vm && THREAD->is_lock_owned((address) displaced.clear_lock_bits().to_pointer())) {
-               entry->lock()->set_displaced_header(markWord::from_pointer(NULL));
-             } else {
-               inc_monitor_count = false;
-               CALL_VM(InterpreterRuntime::monitorenter(THREAD, entry), handle_exception);
-             }
-           }
-           if (inc_monitor_count) {
-             THREAD->inc_held_monitor_count();
-           }
            UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1);
          } else {
            istate->set_msg(more_monitors);
            UPDATE_PC_AND_RETURN(0); // Re-execute
          }
--- 1621,11 ---
          }
          if (entry != NULL) {
            entry->set_obj(lockee);
  
            // traditional lightweight locking
!           CALL_VM(InterpreterRuntime::monitorenter(THREAD, lockee), handle_exception);
            UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1);
          } else {
            istate->set_msg(more_monitors);
            UPDATE_PC_AND_RETURN(0); // Re-execute
          }

*** 1683,29 ***
          // find our monitor slot
          BasicObjectLock* limit = istate->monitor_base();
          BasicObjectLock* most_recent = (BasicObjectLock*) istate->stack_base();
          while (most_recent != limit ) {
            if ((most_recent)->obj() == lockee) {
-             BasicLock* lock = most_recent->lock();
-             markWord header = lock->displaced_header();
              most_recent->set_obj(NULL);
! 
-             // If it isn't recursive we either must swap old header or call the runtime
-             bool dec_monitor_count = true;
-             bool call_vm = UseHeavyMonitors;
-             if (header.to_pointer() != NULL || call_vm) {
-               markWord old_header = markWord::encode(lock);
-               if (call_vm || lockee->cas_set_mark(header, old_header) != old_header) {
-                 // restore object for the slow case
-                 most_recent->set_obj(lockee);
-                 dec_monitor_count = false;
-                 InterpreterRuntime::monitorexit(most_recent);
-               }
-             }
-             if (dec_monitor_count) {
-               THREAD->dec_held_monitor_count();
-             }
              UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1);
            }
            most_recent++;
          }
          // Need to throw illegal monitor state exception
--- 1638,12 ---
          // find our monitor slot
          BasicObjectLock* limit = istate->monitor_base();
          BasicObjectLock* most_recent = (BasicObjectLock*) istate->stack_base();
          while (most_recent != limit ) {
            if ((most_recent)->obj() == lockee) {
              most_recent->set_obj(NULL);
!             InterpreterRuntime::monitorexit(lockee);
              UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1);
            }
            most_recent++;
          }
          // Need to throw illegal monitor state exception

*** 1999,14 ***
                  size_t hdr_size = oopDesc::header_size();
                  Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
                }
  
                // Initialize header, mirrors MemAllocator.
                oopDesc::set_mark(result, markWord::prototype());
-               oopDesc::set_klass_gap(result, 0);
                oopDesc::release_set_klass(result, ik);
! 
                oop obj = cast_to_oop(result);
  
                // Must prevent reordering of stores for object initialization
                // with stores that publish the new object.
                OrderAccess::storestore();
--- 1937,16 ---
                  size_t hdr_size = oopDesc::header_size();
                  Copy::fill_to_words(result + hdr_size, obj_size - hdr_size, 0);
                }
  
                // Initialize header, mirrors MemAllocator.
+ #ifdef _LP64
+               oopDesc::release_set_mark(result, ik->prototype_header());
+ #else
                oopDesc::set_mark(result, markWord::prototype());
                oopDesc::release_set_klass(result, ik);
! #endif
                oop obj = cast_to_oop(result);
  
                // Must prevent reordering of stores for object initialization
                // with stores that publish the new object.
                OrderAccess::storestore();

*** 3131,28 ***
  
        // Check all the monitors to see they are unlocked. Install exception if found to be locked.
        while (end < base) {
          oop lockee = end->obj();
          if (lockee != NULL) {
-           BasicLock* lock = end->lock();
-           markWord header = lock->displaced_header();
            end->set_obj(NULL);
! 
-           // If it isn't recursive we either must swap old header or call the runtime
-           bool dec_monitor_count = true;
-           if (header.to_pointer() != NULL) {
-             markWord old_header = markWord::encode(lock);
-             if (lockee->cas_set_mark(header, old_header) != old_header) {
-               // restore object for the slow case
-               end->set_obj(lockee);
-               dec_monitor_count = false;
-               InterpreterRuntime::monitorexit(end);
-             }
-           }
-           if (dec_monitor_count) {
-             THREAD->dec_held_monitor_count();
-           }
  
            // One error is plenty
            if (illegal_state_oop() == NULL && !suppress_error) {
              {
                // Prevent any HandleMarkCleaner from freeing our live handles
--- 3071,12 ---
  
        // Check all the monitors to see they are unlocked. Install exception if found to be locked.
        while (end < base) {
          oop lockee = end->obj();
          if (lockee != NULL) {
            end->set_obj(NULL);
!           InterpreterRuntime::monitorexit(lockee);
  
            // One error is plenty
            if (illegal_state_oop() == NULL && !suppress_error) {
              {
                // Prevent any HandleMarkCleaner from freeing our live handles

*** 3195,39 ***
              if (!suppress_error) {
                VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "");
                illegal_state_oop = Handle(THREAD, THREAD->pending_exception());
                THREAD->clear_pending_exception();
              }
!           } else if (UseHeavyMonitors) {
!             InterpreterRuntime::monitorexit(base);
              if (THREAD->has_pending_exception()) {
                if (!suppress_error) illegal_state_oop = Handle(THREAD, THREAD->pending_exception());
                THREAD->clear_pending_exception();
              }
-           } else {
-             BasicLock* lock = base->lock();
-             markWord header = lock->displaced_header();
-             base->set_obj(NULL);
- 
-             // If it isn't recursive we either must swap old header or call the runtime
-             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) {
-                 // restore object for the slow case
-                 base->set_obj(rcvr);
-                 dec_monitor_count = false;
-                 InterpreterRuntime::monitorexit(base);
-                 if (THREAD->has_pending_exception()) {
-                   if (!suppress_error) illegal_state_oop = Handle(THREAD, THREAD->pending_exception());
-                   THREAD->clear_pending_exception();
-                 }
-               }
-             }
-             if (dec_monitor_count) {
-               THREAD->dec_held_monitor_count();
-             }
            }
          }
        }
      }
      // Clear the do_not_unlock flag now.
--- 3119,16 ---
              if (!suppress_error) {
                VM_JAVA_ERROR_NO_JUMP(vmSymbols::java_lang_NullPointerException(), "");
                illegal_state_oop = Handle(THREAD, THREAD->pending_exception());
                THREAD->clear_pending_exception();
              }
!           } else {
!             InterpreterRuntime::monitorexit(rcvr);
              if (THREAD->has_pending_exception()) {
                if (!suppress_error) illegal_state_oop = Handle(THREAD, THREAD->pending_exception());
                THREAD->clear_pending_exception();
              }
            }
          }
        }
      }
      // Clear the do_not_unlock flag now.
< prev index next >