src/hotspot/share/runtime/objectMonitor.hpp
changeset 59156 14fa9e70ae71
parent 58488 165b193b30dd
equal deleted inserted replaced
59154:0c2e1808f800 59156:14fa9e70ae71
   142   DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE,
   142   DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE,
   143                         sizeof(volatile markWord) + sizeof(void* volatile) +
   143                         sizeof(volatile markWord) + sizeof(void* volatile) +
   144                         sizeof(ObjectMonitor *));
   144                         sizeof(ObjectMonitor *));
   145   void* volatile _owner;            // pointer to owning thread OR BasicLock
   145   void* volatile _owner;            // pointer to owning thread OR BasicLock
   146   volatile jlong _previous_owner_tid;  // thread id of the previous owner of the monitor
   146   volatile jlong _previous_owner_tid;  // thread id of the previous owner of the monitor
   147   volatile intptr_t _recursions;    // recursion count, 0 for first entry
   147   volatile intx _recursions;        // recursion count, 0 for first entry
   148   ObjectWaiter* volatile _EntryList;  // Threads blocked on entry or reentry.
   148   ObjectWaiter* volatile _EntryList;  // Threads blocked on entry or reentry.
   149                                       // The list is actually composed of WaitNodes,
   149                                       // The list is actually composed of WaitNodes,
   150                                       // acting as proxies for Threads.
   150                                       // acting as proxies for Threads.
   151 
   151 
   152   ObjectWaiter* volatile _cxq;      // LL of recently-arrived threads blocked on entry.
   152   ObjectWaiter* volatile _cxq;      // LL of recently-arrived threads blocked on entry.
   235   void      set_owner(void* owner);
   235   void      set_owner(void* owner);
   236 
   236 
   237   jint      waiters() const;
   237   jint      waiters() const;
   238 
   238 
   239   jint      contentions() const;
   239   jint      contentions() const;
   240   intptr_t  recursions() const                                         { return _recursions; }
   240   intx      recursions() const                                         { return _recursions; }
   241 
   241 
   242   // JVM/TI GetObjectMonitorUsage() needs this:
   242   // JVM/TI GetObjectMonitorUsage() needs this:
   243   ObjectWaiter* first_waiter()                                         { return _WaitSet; }
   243   ObjectWaiter* first_waiter()                                         { return _WaitSet; }
   244   ObjectWaiter* next_waiter(ObjectWaiter* o)                           { return o->_next; }
   244   ObjectWaiter* next_waiter(ObjectWaiter* o)                           { return o->_next; }
   245   Thread* thread_of_waiter(ObjectWaiter* o)                            { return o->_thread; }
   245   Thread* thread_of_waiter(ObjectWaiter* o)                            { return o->_thread; }
   261     // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
   261     // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
   262     // _contentions == 0 EntryList  == NULL
   262     // _contentions == 0 EntryList  == NULL
   263     // _recursions == 0 _WaitSet == NULL
   263     // _recursions == 0 _WaitSet == NULL
   264     DEBUG_ONLY(stringStream ss;)
   264     DEBUG_ONLY(stringStream ss;)
   265     assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, "
   265     assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, "
   266            "recursions=" INTPTR_FORMAT, is_busy_to_string(&ss), _recursions);
   266            "recursions=" INTX_FORMAT, is_busy_to_string(&ss), _recursions);
   267     _succ          = NULL;
   267     _succ          = NULL;
   268     _EntryList     = NULL;
   268     _EntryList     = NULL;
   269     _cxq           = NULL;
   269     _cxq           = NULL;
   270     _WaitSet       = NULL;
   270     _WaitSet       = NULL;
   271     _recursions    = 0;
   271     _recursions    = 0;
   287   void      wait(jlong millis, bool interruptable, TRAPS);
   287   void      wait(jlong millis, bool interruptable, TRAPS);
   288   void      notify(TRAPS);
   288   void      notify(TRAPS);
   289   void      notifyAll(TRAPS);
   289   void      notifyAll(TRAPS);
   290 
   290 
   291   void      print() const;
   291   void      print() const;
       
   292 #ifdef ASSERT
       
   293   void      print_debug_style_on(outputStream* st) const;
       
   294 #endif
   292   void      print_on(outputStream* st) const;
   295   void      print_on(outputStream* st) const;
   293 
   296 
   294 // Use the following at your own risk
   297 // Use the following at your own risk
   295   intptr_t  complete_exit(TRAPS);
   298   intx      complete_exit(TRAPS);
   296   void      reenter(intptr_t recursions, TRAPS);
   299   void      reenter(intx recursions, TRAPS);
   297 
   300 
   298  private:
   301  private:
   299   void      AddWaiter(ObjectWaiter* waiter);
   302   void      AddWaiter(ObjectWaiter* waiter);
   300   void      INotify(Thread* self);
   303   void      INotify(Thread* self);
   301   ObjectWaiter* DequeueWaiter();
   304   ObjectWaiter* DequeueWaiter();