< prev index next >

src/hotspot/share/runtime/lockStack.cpp

Print this page
*** 38,10 ***
--- 38,11 ---
  #include "utilities/copy.hpp"
  #include "utilities/debug.hpp"
  #include "utilities/globalDefinitions.hpp"
  #include "utilities/growableArray.hpp"
  #include "utilities/ostream.hpp"
+ #include "utilities/sizes.hpp"
  
  #include <type_traits>
  
  const int LockStack::lock_stack_offset =      in_bytes(JavaThread::lock_stack_offset());
  const int LockStack::lock_stack_top_offset =  in_bytes(JavaThread::lock_stack_top_offset());

*** 136,22 ***
      }
  
      lock_index = lock_order.length();
    }
  
    while (lock_index-- > 0) {
      const oop obj = lock_order.at(lock_index);
      const markWord mark = obj->mark_acquire();
      assert(obj->is_locked(), "must be locked");
      if (top_index > 0 && obj == _base[top_index - 1]) {
!       assert(mark.is_fast_locked() || mark.monitor()->is_owner_anonymous(),
               "must be fast_locked or inflated by other thread");
        top_index--;
      } else {
        assert(!mark.is_fast_locked(), "must be inflated");
!       assert(mark.monitor()->owner_raw() == get_thread() ||
!              (!leaf_frame && get_thread()->current_waiting_monitor() == mark.monitor()),
               "must be owned by (or waited on by) thread");
        assert(!contains(obj), "must not be on lock_stack");
      }
    }
  }
--- 137,28 ---
      }
  
      lock_index = lock_order.length();
    }
  
+   JavaThread* thread = get_thread();
+   Thread* current = Thread::current();
    while (lock_index-- > 0) {
      const oop obj = lock_order.at(lock_index);
      const markWord mark = obj->mark_acquire();
      assert(obj->is_locked(), "must be locked");
+     ObjectMonitor* monitor = nullptr;
+     if (mark.has_monitor()) {
+       monitor = LightweightSynchronizer::read_monitor(current, obj);
+     }
      if (top_index > 0 && obj == _base[top_index - 1]) {
!       assert(mark.is_fast_locked() || monitor->is_owner_anonymous(),
               "must be fast_locked or inflated by other thread");
        top_index--;
      } else {
        assert(!mark.is_fast_locked(), "must be inflated");
!       assert(monitor->owner_raw() == thread ||
!              (!leaf_frame && thread->current_waiting_monitor() == monitor),
               "must be owned by (or waited on by) thread");
        assert(!contains(obj), "must not be on lock_stack");
      }
    }
  }

*** 166,5 ***
--- 173,13 ---
      } else {
        st->print_cr("not an oop: " PTR_FORMAT, p2i(o));
      }
    }
  }
+ 
+ OMCache::OMCache(JavaThread* jt) : _entries() {
+   STATIC_ASSERT(std::is_standard_layout<OMCache>::value);
+   STATIC_ASSERT(std::is_standard_layout<OMCache::OMCacheEntry>::value);
+   STATIC_ASSERT(offsetof(OMCache, _null_sentinel) == offsetof(OMCache, _entries) +
+                 offsetof(OMCache::OMCacheEntry, _oop) +
+                 OMCache::CAPACITY * in_bytes(oop_to_oop_difference()));
+ }
< prev index next >