< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page
@@ -36,10 +36,11 @@
  #include "memory/resourceArea.hpp"
  #include "oops/oop.inline.hpp"
  #include "runtime/atomic.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/javaThread.inline.hpp"
+ #include "runtime/lockStack.inline.hpp"
  #include "runtime/nonJavaThread.hpp"
  #include "runtime/orderAccess.hpp"
  #include "runtime/osThread.hpp"
  #include "runtime/safepoint.hpp"
  #include "runtime/safepointMechanism.inline.hpp"

@@ -70,11 +71,12 @@
  // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread,
  // JavaThread
  
  DEBUG_ONLY(Thread* Thread::_starting_thread = NULL;)
  
- Thread::Thread() {
+ Thread::Thread():
+   _lock_stack() {
  
    DEBUG_ONLY(_run_state = PRE_CALL_RUN;)
  
    // stack and get_thread
    set_stack_base(NULL);

@@ -412,10 +414,13 @@
  
  void Thread::oops_do_no_frames(OopClosure* f, CodeBlobClosure* cf) {
    // Do oop for ThreadShadow
    f->do_oop((oop*)&_pending_exception);
    handle_area()->oops_do(f);
+   if (!UseHeavyMonitors) {
+     lock_stack().oops_do(f);
+   }
  }
  
  // If the caller is a NamedThread, then remember, in the current scope,
  // the given JavaThread in its _processed_thread field.
  class RememberProcessedThread: public StackObj {

@@ -539,11 +544,12 @@
  // However, there is a note in JavaThread::is_lock_owned() about the VM threads not being
  // used for compilation in the future. If that change is made, the need for these methods
  // should be revisited, and they should be removed if possible.
  
  bool Thread::is_lock_owned(address adr) const {
-   return is_in_full_stack(adr);
+   assert(adr != ANONYMOUS_OWNER, "must convert to lock object");
+   return !UseHeavyMonitors && lock_stack().contains(cast_to_oop(adr));
  }
  
  bool Thread::set_as_starting_thread() {
    assert(_starting_thread == NULL, "already initialized: "
           "_starting_thread=" INTPTR_FORMAT, p2i(_starting_thread));
< prev index next >