< prev index next >

src/hotspot/share/runtime/objectMonitor.hpp

Print this page
*** 57,11 ***
    void wait_reenter_begin(ObjectMonitor *mon);
    void wait_reenter_end(ObjectMonitor *mon);
  };
  
  // The ObjectMonitor class implements the heavyweight version of a
! // JavaMonitor. The lightweight BasicLock/stack lock version has been
  // inflated into an ObjectMonitor. This inflation is typically due to
  // contention or use of Object.wait().
  //
  // WARNING: This is a very sensitive and fragile class. DO NOT make any
  // changes unless you are fully aware of the underlying semantics.
--- 57,11 ---
    void wait_reenter_begin(ObjectMonitor *mon);
    void wait_reenter_end(ObjectMonitor *mon);
  };
  
  // The ObjectMonitor class implements the heavyweight version of a
! // JavaMonitor. The lightweight fast-lock version has been
  // inflated into an ObjectMonitor. This inflation is typically due to
  // contention or use of Object.wait().
  //
  // WARNING: This is a very sensitive and fragile class. DO NOT make any
  // changes unless you are fully aware of the underlying semantics.

*** 144,11 ***
    // its cache line with _header.
    DEFINE_PAD_MINUS_SIZE(0, OM_CACHE_LINE_SIZE, sizeof(volatile markWord) +
                          sizeof(WeakHandle));
    // Used by async deflation as a marker in the _owner field:
    #define DEFLATER_MARKER reinterpret_cast<void*>(-1)
!   void* volatile _owner;            // pointer to owning thread OR BasicLock
    volatile uint64_t _previous_owner_tid;  // thread id of the previous owner of the monitor
    // Separate _owner and _next_om on different cache lines since
    // both can have busy multi-threaded access. _previous_owner_tid is only
    // changed by ObjectMonitor::exit() so it is a good choice to share the
    // cache line with _owner.
--- 144,12 ---
    // its cache line with _header.
    DEFINE_PAD_MINUS_SIZE(0, OM_CACHE_LINE_SIZE, sizeof(volatile markWord) +
                          sizeof(WeakHandle));
    // Used by async deflation as a marker in the _owner field:
    #define DEFLATER_MARKER reinterpret_cast<void*>(-1)
!   #define ANONYMOUS_OWNER reinterpret_cast<void*>(1)
+   void* volatile _owner;            // pointer to owning thread
    volatile uint64_t _previous_owner_tid;  // thread id of the previous owner of the monitor
    // Separate _owner and _next_om on different cache lines since
    // both can have busy multi-threaded access. _previous_owner_tid is only
    // changed by ObjectMonitor::exit() so it is a good choice to share the
    // cache line with _owner.

*** 254,12 ***
    bool      is_being_async_deflated();
    // Clear _owner field; current value must match old_value.
    void      release_clear_owner(void* old_value);
    // Simply set _owner field to new_value; current value must match old_value.
    void      set_owner_from(void* old_value, void* new_value);
-   // Simply set _owner field to current; current value must match basic_lock_p.
-   void      set_owner_from_BasicLock(void* basic_lock_p, JavaThread* current);
    // Try to set _owner field to new_value if the current value matches
    // old_value, using Atomic::cmpxchg(). Otherwise, does not change the
    // _owner field. Returns the prior value of the _owner field.
    void*     try_set_owner_from(void* old_value, void* new_value);
  
--- 255,10 ---

*** 274,10 ***
--- 273,22 ---
    // Try to set _next_om field to new_value if the current value matches
    // old_value, using Atomic::cmpxchg(). Otherwise, does not change the
    // _next_om field. Returns the prior value of the _next_om field.
    ObjectMonitor* try_set_next_om(ObjectMonitor* old_value, ObjectMonitor* new_value);
  
+   void set_owner_anonymous() {
+     set_owner_from(NULL, ANONYMOUS_OWNER);
+   }
+ 
+   bool is_owner_anonymous() const {
+     return _owner == ANONYMOUS_OWNER;
+   }
+ 
+   void set_owner_from_anonymous(Thread* owner) {
+     set_owner_from(ANONYMOUS_OWNER, owner);
+   }
+ 
    int       waiters() const;
  
    int       contentions() const;
    void      add_to_contentions(int value);
    intx      recursions() const                                         { return _recursions; }

*** 329,10 ***
--- 340,12 ---
  
    // Use the following at your own risk
    intx      complete_exit(JavaThread* current);
    bool      reenter(intx recursions, JavaThread* current);
  
+   static void maybe_deflate_dead(oop* p);
+ 
   private:
    void      AddWaiter(ObjectWaiter* waiter);
    void      INotify(JavaThread* current);
    ObjectWaiter* DequeueWaiter();
    void      DequeueSpecificWaiter(ObjectWaiter* waiter);
< prev index next >