< prev index next >

src/hotspot/share/oops/oopHandle.hpp

Print this page




  35 // These classes help with allocation, release, and NativeAccess loads and
  36 // stores with the appropriate barriers.
  37 
  38 class OopHandle {
  39   friend class VMStructs;
  40 private:
  41   oop* _obj;
  42 
  43 public:
  44   OopHandle() : _obj(NULL) {}
  45   explicit OopHandle(oop* w) : _obj(w) {}
  46   OopHandle(OopStorage* storage, oop obj);
  47 
  48   inline oop resolve() const;
  49   inline oop peek() const;
  50 
  51   bool is_empty() const { return _obj == NULL; }
  52 
  53   inline void release(OopStorage* storage);
  54 


  55   // Used only for removing handle.
  56   oop* ptr_raw() const { return _obj; }
  57 };
  58 
  59 // Convert OopHandle to oop*
  60 
  61 template<>
  62 struct PrimitiveConversions::Translate<OopHandle> : public TrueType {
  63   typedef OopHandle Value;
  64   typedef oop* Decayed;
  65 
  66   static Decayed decay(Value x) { return x.ptr_raw(); }
  67   static Value recover(Decayed x) { return OopHandle(x); }
  68 };
  69 
  70 #endif // SHARE_OOPS_OOPHANDLE_HPP


  35 // These classes help with allocation, release, and NativeAccess loads and
  36 // stores with the appropriate barriers.
  37 
  38 class OopHandle {
  39   friend class VMStructs;
  40 private:
  41   oop* _obj;
  42 
  43 public:
  44   OopHandle() : _obj(NULL) {}
  45   explicit OopHandle(oop* w) : _obj(w) {}
  46   OopHandle(OopStorage* storage, oop obj);
  47 
  48   inline oop resolve() const;
  49   inline oop peek() const;
  50 
  51   bool is_empty() const { return _obj == NULL; }
  52 
  53   inline void release(OopStorage* storage);
  54 
  55   inline void replace(oop obj);
  56 
  57   // Used only for removing handle.
  58   oop* ptr_raw() const { return _obj; }
  59 };
  60 
  61 // Convert OopHandle to oop*
  62 
  63 template<>
  64 struct PrimitiveConversions::Translate<OopHandle> : public TrueType {
  65   typedef OopHandle Value;
  66   typedef oop* Decayed;
  67 
  68   static Decayed decay(Value x) { return x.ptr_raw(); }
  69   static Value recover(Decayed x) { return OopHandle(x); }
  70 };
  71 
  72 #endif // SHARE_OOPS_OOPHANDLE_HPP
< prev index next >