< prev index next >

src/share/vm/oops/oopHandle.hpp

Print this page




  29 #include "runtime/atomic.hpp"
  30 #include "runtime/orderAccess.hpp"
  31 
  32 // Simple class for encapsulating oop pointers stored in metadata.
  33 // These are different from Handle.  The Handle class stores pointers
  34 // to oops on the stack, and manages the allocation from a thread local
  35 // area in the constructor.
  36 // This assumes that the caller will allocate the handle in the appropriate
  37 // area.  The reason for the encapsulation is to help with naming and to allow
  38 // future uses for read barriers.
  39 
  40 class OopHandle {
  41 private:
  42   oop* _obj;
  43 
  44 public:
  45   OopHandle() : _obj(NULL) {}
  46   OopHandle(oop* w) : _obj(w) {}
  47 
  48   oop resolve() const { return (_obj == NULL) ? (oop)NULL : *_obj; }



  49 };
  50 
  51 #endif // SHARE_VM_OOPS_OOPHANDLE_HPP


  29 #include "runtime/atomic.hpp"
  30 #include "runtime/orderAccess.hpp"
  31 
  32 // Simple class for encapsulating oop pointers stored in metadata.
  33 // These are different from Handle.  The Handle class stores pointers
  34 // to oops on the stack, and manages the allocation from a thread local
  35 // area in the constructor.
  36 // This assumes that the caller will allocate the handle in the appropriate
  37 // area.  The reason for the encapsulation is to help with naming and to allow
  38 // future uses for read barriers.
  39 
  40 class OopHandle {
  41 private:
  42   oop* _obj;
  43 
  44 public:
  45   OopHandle() : _obj(NULL) {}
  46   OopHandle(oop* w) : _obj(w) {}
  47 
  48   oop resolve() const { return (_obj == NULL) ? (oop)NULL : *_obj; }
  49 
  50   // Used only for removing handle.
  51   oop* ptr_raw() { return _obj; }
  52 };
  53 
  54 #endif // SHARE_VM_OOPS_OOPHANDLE_HPP
< prev index next >