< prev index next >

src/hotspot/share/runtime/basicLock.hpp

Print this page

55 };
56 
57 // A BasicObjectLock associates a specific Java object with a BasicLock.
58 // It is currently embedded in an interpreter frame.
59 
60 // Because some machines have alignment restrictions on the control stack,
61 // the actual space allocated by the interpreter may include padding words
62 // after the end of the BasicObjectLock.  Also, in order to guarantee
63 // alignment of the embedded BasicLock objects on such machines, we
64 // put the embedded BasicLock at the beginning of the struct.
65 
66 class BasicObjectLock {
67   friend class VMStructs;
68  private:
69   BasicLock _lock;                                    // the lock, must be double word aligned
70   oop       _obj;                                     // object holds the lock;
71 
72  public:
73   // Manipulation
74   oop      obj() const                                { return _obj;  }

75   void set_obj(oop obj)                               { _obj = obj; }
76   BasicLock* lock()                                   { return &_lock; }
77 
78   // Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks
79   //       in interpreter activation frames since it includes machine-specific padding.
80   static int size()                                   { return sizeof(BasicObjectLock)/wordSize; }
81 
82   // GC support
83   void oops_do(OopClosure* f) { f->do_oop(&_obj); }
84 
85   static ByteSize obj_offset()                { return byte_offset_of(BasicObjectLock, _obj);  }
86   static ByteSize lock_offset()               { return byte_offset_of(BasicObjectLock, _lock); }
87 };
88 
89 
90 #endif // SHARE_RUNTIME_BASICLOCK_HPP

55 };
56 
57 // A BasicObjectLock associates a specific Java object with a BasicLock.
58 // It is currently embedded in an interpreter frame.
59 
60 // Because some machines have alignment restrictions on the control stack,
61 // the actual space allocated by the interpreter may include padding words
62 // after the end of the BasicObjectLock.  Also, in order to guarantee
63 // alignment of the embedded BasicLock objects on such machines, we
64 // put the embedded BasicLock at the beginning of the struct.
65 
66 class BasicObjectLock {
67   friend class VMStructs;
68  private:
69   BasicLock _lock;                                    // the lock, must be double word aligned
70   oop       _obj;                                     // object holds the lock;
71 
72  public:
73   // Manipulation
74   oop      obj() const                                { return _obj;  }
75   oop*     obj_adr()                                  { return &_obj; }
76   void set_obj(oop obj)                               { _obj = obj; }
77   BasicLock* lock()                                   { return &_lock; }
78 
79   // Note: Use frame::interpreter_frame_monitor_size() for the size of BasicObjectLocks
80   //       in interpreter activation frames since it includes machine-specific padding.
81   static int size()                                   { return sizeof(BasicObjectLock)/wordSize; }
82 
83   // GC support
84   void oops_do(OopClosure* f) { f->do_oop(&_obj); }
85 
86   static ByteSize obj_offset()                { return byte_offset_of(BasicObjectLock, _obj);  }
87   static ByteSize lock_offset()               { return byte_offset_of(BasicObjectLock, _lock); }
88 };
89 
90 
91 #endif // SHARE_RUNTIME_BASICLOCK_HPP
< prev index next >