< prev index next >

src/hotspot/share/runtime/basicLock.hpp

Print this page
@@ -26,34 +26,50 @@
  #define SHARE_RUNTIME_BASICLOCK_HPP
  
  #include "oops/markWord.hpp"
  #include "runtime/atomic.hpp"
  #include "runtime/handles.hpp"
+ #include "utilities/globalDefinitions.hpp"
  #include "utilities/sizes.hpp"
  
  class BasicLock {
    friend class VMStructs;
    friend class JVMCIVMStructs;
   private:
+   // * For LM_MONITOR
+   // Unused.
+   // * For LM_LEGACY
    // This is either the actual displaced header from a locked object, or
    // a sentinel zero value indicating a recursive stack-lock.
-   volatile markWord _displaced_header;
+   // * For LM_LIGHTWEIGHT
+   // Used as a cache the ObjectMonitor* used when locking. Must either
+   // be nullptr or the ObjectMonitor* used when locking.
+   volatile uintptr_t _metadata;
+ 
+   uintptr_t get_metadata() const { return Atomic::load(&_metadata); }
+   void set_metadata(uintptr_t value) { Atomic::store(&_metadata, value); }
+   static int metadata_offset_in_bytes() { return (int)offset_of(BasicLock, _metadata); }
+ 
   public:
-   markWord displaced_header() const {
-     return Atomic::load(&_displaced_header);
-   }
+   // LM_MONITOR
+   void set_bad_metadata_deopt() { set_metadata(badDispHeaderDeopt); }
  
-   void set_displaced_header(markWord header) {
-     Atomic::store(&_displaced_header, header);
-   }
+   // LM_LEGACY
+   inline markWord displaced_header() const;
+   inline void set_displaced_header(markWord header);
+   static int displaced_header_offset_in_bytes() { return metadata_offset_in_bytes(); }
+ 
+   // LM_LIGHTWEIGHT
+   inline ObjectMonitor* object_monitor_cache() const;
+   inline void clear_object_monitor_cache();
+   inline void set_object_monitor_cache(ObjectMonitor* mon);
+   static int object_monitor_cache_offset_in_bytes() { return metadata_offset_in_bytes(); }
  
    void print_on(outputStream* st, oop owner) const;
  
    // move a basic lock (used during deoptimization)
    void move_to(oop obj, BasicLock* dest);
- 
-   static int displaced_header_offset_in_bytes() { return (int)offset_of(BasicLock, _displaced_header); }
  };
  
  // A BasicObjectLock associates a specific Java object with a BasicLock.
  // It is currently embedded in an interpreter frame.
  
< prev index next >