< prev index next >

src/hotspot/share/oops/access.hpp

Print this page




 154 public:
 155   // Primitive heap accesses
 156   static inline AccessInternal::LoadAtProxy<decorators> load_at(oop base, ptrdiff_t offset) {
 157     verify_primitive_decorators<load_mo_decorators>();
 158     return AccessInternal::LoadAtProxy<decorators>(base, offset);
 159   }
 160 
 161   template <typename T>
 162   static inline void store_at(oop base, ptrdiff_t offset, T value) {
 163     verify_primitive_decorators<store_mo_decorators>();
 164     AccessInternal::store_at<decorators>(base, offset, value);
 165   }
 166 
 167   template <typename T>
 168   static inline T atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) {
 169     verify_primitive_decorators<atomic_cmpxchg_mo_decorators>();
 170     return AccessInternal::atomic_cmpxchg_at<decorators>(new_value, base, offset, compare_value);
 171   }
 172 
 173   template <typename T>
 174   static inline T atomic_xchg_at(T new_value, oop base, ptrdiff_t offset) {
 175     verify_primitive_decorators<atomic_xchg_mo_decorators>();
 176     return AccessInternal::atomic_xchg_at<decorators>(new_value, base, offset);
 177   }
 178 
 179   // Oop heap accesses
 180   static inline AccessInternal::OopLoadAtProxy<decorators> oop_load_at(oop base, ptrdiff_t offset) {
 181     verify_heap_oop_decorators<load_mo_decorators>();
 182     return AccessInternal::OopLoadAtProxy<decorators>(base, offset);
 183   }
 184 
 185   template <typename T>
 186   static inline void oop_store_at(oop base, ptrdiff_t offset, T value) {
 187     verify_heap_oop_decorators<store_mo_decorators>();
 188     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 189     OopType oop_value = value;
 190     AccessInternal::store_at<decorators | INTERNAL_VALUE_IS_OOP>(base, offset, oop_value);
 191   }
 192 
 193   template <typename T>
 194   static inline T oop_atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) {
 195     verify_heap_oop_decorators<atomic_cmpxchg_mo_decorators>();
 196     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 197     OopType new_oop_value = new_value;
 198     OopType compare_oop_value = compare_value;
 199     return AccessInternal::atomic_cmpxchg_at<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, base, offset, compare_oop_value);
 200   }
 201 
 202   template <typename T>
 203   static inline T oop_atomic_xchg_at(T new_value, oop base, ptrdiff_t offset) {
 204     verify_heap_oop_decorators<atomic_xchg_mo_decorators>();
 205     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 206     OopType new_oop_value = new_value;
 207     return AccessInternal::atomic_xchg_at<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, base, offset);
 208   }
 209 
 210   // Clone an object from src to dst
 211   static inline void clone(oop src, oop dst, size_t size) {
 212     verify_decorators<IN_HEAP>();
 213     AccessInternal::clone<decorators>(src, dst, size);
 214   }
 215 
 216   // Primitive accesses
 217   template <typename P>
 218   static inline P load(P* addr) {
 219     verify_primitive_decorators<load_mo_decorators>();
 220     return AccessInternal::load<decorators, P, P>(addr);
 221   }
 222 
 223   template <typename P, typename T>
 224   static inline void store(P* addr, T value) {
 225     verify_primitive_decorators<store_mo_decorators>();
 226     AccessInternal::store<decorators>(addr, value);
 227   }
 228 
 229   template <typename P, typename T>
 230   static inline T atomic_cmpxchg(T new_value, P* addr, T compare_value) {
 231     verify_primitive_decorators<atomic_cmpxchg_mo_decorators>();
 232     return AccessInternal::atomic_cmpxchg<decorators>(new_value, addr, compare_value);
 233   }
 234 
 235   template <typename P, typename T>
 236   static inline T atomic_xchg(T new_value, P* addr) {
 237     verify_primitive_decorators<atomic_xchg_mo_decorators>();
 238     return AccessInternal::atomic_xchg<decorators>(new_value, addr);
 239   }
 240 
 241   // Oop accesses
 242   template <typename P>
 243   static inline AccessInternal::OopLoadProxy<P, decorators> oop_load(P* addr) {
 244     verify_oop_decorators<load_mo_decorators>();
 245     return AccessInternal::OopLoadProxy<P, decorators>(addr);
 246   }
 247 
 248   template <typename P, typename T>
 249   static inline void oop_store(P* addr, T value) {
 250     verify_oop_decorators<store_mo_decorators>();
 251     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 252     OopType oop_value = value;
 253     AccessInternal::store<decorators | INTERNAL_VALUE_IS_OOP>(addr, oop_value);
 254   }
 255 
 256   template <typename P, typename T>
 257   static inline T oop_atomic_cmpxchg(T new_value, P* addr, T compare_value) {
 258     verify_oop_decorators<atomic_cmpxchg_mo_decorators>();
 259     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 260     OopType new_oop_value = new_value;
 261     OopType compare_oop_value = compare_value;
 262     return AccessInternal::atomic_cmpxchg<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, addr, compare_oop_value);
 263   }
 264 
 265   template <typename P, typename T>
 266   static inline T oop_atomic_xchg(T new_value, P* addr) {
 267     verify_oop_decorators<atomic_xchg_mo_decorators>();
 268     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 269     OopType new_oop_value = new_value;
 270     return AccessInternal::atomic_xchg<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, addr);
 271   }
 272 
 273   static oop resolve(oop obj) {
 274     verify_decorators<DECORATORS_NONE>();
 275     return AccessInternal::resolve<decorators>(obj);
 276   }
 277 };
 278 
 279 // Helper for performing raw accesses (knows only of memory ordering
 280 // atomicity decorators as well as compressed oops)
 281 template <DecoratorSet decorators = DECORATORS_NONE>
 282 class RawAccess: public Access<AS_RAW | decorators> {};
 283 
 284 // Helper for performing normal accesses on the heap. These accesses
 285 // may resolve an accessor on a GC barrier set
 286 template <DecoratorSet decorators = DECORATORS_NONE>
 287 class HeapAccess: public Access<IN_HEAP | decorators> {};
 288 
 289 // Helper for performing normal accesses in roots. These accesses
 290 // may resolve an accessor on a GC barrier set




 154 public:
 155   // Primitive heap accesses
 156   static inline AccessInternal::LoadAtProxy<decorators> load_at(oop base, ptrdiff_t offset) {
 157     verify_primitive_decorators<load_mo_decorators>();
 158     return AccessInternal::LoadAtProxy<decorators>(base, offset);
 159   }
 160 
 161   template <typename T>
 162   static inline void store_at(oop base, ptrdiff_t offset, T value) {
 163     verify_primitive_decorators<store_mo_decorators>();
 164     AccessInternal::store_at<decorators>(base, offset, value);
 165   }
 166 
 167   template <typename T>
 168   static inline T atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) {
 169     verify_primitive_decorators<atomic_cmpxchg_mo_decorators>();
 170     return AccessInternal::atomic_cmpxchg_at<decorators>(new_value, base, offset, compare_value);
 171   }
 172 
 173   template <typename T>
 174   static inline T atomic_xchg_at(oop base, ptrdiff_t offset, T new_value) {
 175     verify_primitive_decorators<atomic_xchg_mo_decorators>();
 176     return AccessInternal::atomic_xchg_at<decorators>(base, offset, new_value);
 177   }
 178 
 179   // Oop heap accesses
 180   static inline AccessInternal::OopLoadAtProxy<decorators> oop_load_at(oop base, ptrdiff_t offset) {
 181     verify_heap_oop_decorators<load_mo_decorators>();
 182     return AccessInternal::OopLoadAtProxy<decorators>(base, offset);
 183   }
 184 
 185   template <typename T>
 186   static inline void oop_store_at(oop base, ptrdiff_t offset, T value) {
 187     verify_heap_oop_decorators<store_mo_decorators>();
 188     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 189     OopType oop_value = value;
 190     AccessInternal::store_at<decorators | INTERNAL_VALUE_IS_OOP>(base, offset, oop_value);
 191   }
 192 
 193   template <typename T>
 194   static inline T oop_atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value) {
 195     verify_heap_oop_decorators<atomic_cmpxchg_mo_decorators>();
 196     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 197     OopType new_oop_value = new_value;
 198     OopType compare_oop_value = compare_value;
 199     return AccessInternal::atomic_cmpxchg_at<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, base, offset, compare_oop_value);
 200   }
 201 
 202   template <typename T>
 203   static inline T oop_atomic_xchg_at(oop base, ptrdiff_t offset, T new_value) {
 204     verify_heap_oop_decorators<atomic_xchg_mo_decorators>();
 205     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 206     OopType new_oop_value = new_value;
 207     return AccessInternal::atomic_xchg_at<decorators | INTERNAL_VALUE_IS_OOP>(base, offset, new_oop_value);
 208   }
 209 
 210   // Clone an object from src to dst
 211   static inline void clone(oop src, oop dst, size_t size) {
 212     verify_decorators<IN_HEAP>();
 213     AccessInternal::clone<decorators>(src, dst, size);
 214   }
 215 
 216   // Primitive accesses
 217   template <typename P>
 218   static inline P load(P* addr) {
 219     verify_primitive_decorators<load_mo_decorators>();
 220     return AccessInternal::load<decorators, P, P>(addr);
 221   }
 222 
 223   template <typename P, typename T>
 224   static inline void store(P* addr, T value) {
 225     verify_primitive_decorators<store_mo_decorators>();
 226     AccessInternal::store<decorators>(addr, value);
 227   }
 228 
 229   template <typename P, typename T>
 230   static inline T atomic_cmpxchg(T new_value, P* addr, T compare_value) {
 231     verify_primitive_decorators<atomic_cmpxchg_mo_decorators>();
 232     return AccessInternal::atomic_cmpxchg<decorators>(new_value, addr, compare_value);
 233   }
 234 
 235   template <typename P, typename T>
 236   static inline T atomic_xchg(P* addr, T new_value) {
 237     verify_primitive_decorators<atomic_xchg_mo_decorators>();
 238     return AccessInternal::atomic_xchg<decorators>(addr, new_value);
 239   }
 240 
 241   // Oop accesses
 242   template <typename P>
 243   static inline AccessInternal::OopLoadProxy<P, decorators> oop_load(P* addr) {
 244     verify_oop_decorators<load_mo_decorators>();
 245     return AccessInternal::OopLoadProxy<P, decorators>(addr);
 246   }
 247 
 248   template <typename P, typename T>
 249   static inline void oop_store(P* addr, T value) {
 250     verify_oop_decorators<store_mo_decorators>();
 251     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 252     OopType oop_value = value;
 253     AccessInternal::store<decorators | INTERNAL_VALUE_IS_OOP>(addr, oop_value);
 254   }
 255 
 256   template <typename P, typename T>
 257   static inline T oop_atomic_cmpxchg(T new_value, P* addr, T compare_value) {
 258     verify_oop_decorators<atomic_cmpxchg_mo_decorators>();
 259     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 260     OopType new_oop_value = new_value;
 261     OopType compare_oop_value = compare_value;
 262     return AccessInternal::atomic_cmpxchg<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, addr, compare_oop_value);
 263   }
 264 
 265   template <typename P, typename T>
 266   static inline T oop_atomic_xchg(P* addr, T new_value) {
 267     verify_oop_decorators<atomic_xchg_mo_decorators>();
 268     typedef typename AccessInternal::OopOrNarrowOop<T>::type OopType;
 269     OopType new_oop_value = new_value;
 270     return AccessInternal::atomic_xchg<decorators | INTERNAL_VALUE_IS_OOP>(addr, new_oop_value);
 271   }
 272 
 273   static oop resolve(oop obj) {
 274     verify_decorators<DECORATORS_NONE>();
 275     return AccessInternal::resolve<decorators>(obj);
 276   }
 277 };
 278 
 279 // Helper for performing raw accesses (knows only of memory ordering
 280 // atomicity decorators as well as compressed oops)
 281 template <DecoratorSet decorators = DECORATORS_NONE>
 282 class RawAccess: public Access<AS_RAW | decorators> {};
 283 
 284 // Helper for performing normal accesses on the heap. These accesses
 285 // may resolve an accessor on a GC barrier set
 286 template <DecoratorSet decorators = DECORATORS_NONE>
 287 class HeapAccess: public Access<IN_HEAP | decorators> {};
 288 
 289 // Helper for performing normal accesses in roots. These accesses
 290 // may resolve an accessor on a GC barrier set


< prev index next >