< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp

Print this page




 125 
 126   template <class T>
 127   oop load_reference_barrier_native_impl(oop obj, T* load_addr);
 128 
 129   static void keep_alive_if_weak(DecoratorSet decorators, oop value) {
 130     assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
 131     const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
 132     const bool peek              = (decorators & AS_NO_KEEPALIVE) != 0;
 133     if (!peek && !on_strong_oop_ref && value != NULL) {
 134       ShenandoahBarrierSet::barrier_set()->keep_alive_barrier(value);
 135     }
 136   }
 137 
 138 public:
 139   // Callbacks for runtime accesses.
 140   template <DecoratorSet decorators, typename BarrierSetT = ShenandoahBarrierSet>
 141   class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
 142     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
 143 
 144     template <typename T>
 145     static oop oop_atomic_cmpxchg_in_heap_impl(oop new_value, T* addr, oop compare_value);
 146 
 147     template <typename T>
 148     static oop oop_atomic_xchg_in_heap_impl(oop new_value, T* addr);
 149 
 150   public:
 151     // Heap oop accesses. These accessors get resolved when
 152     // IN_HEAP is set (e.g. when using the HeapAccess API), it is
 153     // an oop_* overload, and the barrier strength is AS_NORMAL.
 154     template <typename T>
 155     static oop oop_load_in_heap(T* addr);
 156     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
 157 
 158     template <typename T>
 159     static void oop_store_in_heap(T* addr, oop value);
 160     static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value);
 161 
 162     template <typename T>
 163     static oop oop_atomic_cmpxchg_in_heap(oop new_value, T* addr, oop compare_value);
 164     static oop oop_atomic_cmpxchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset, oop compare_value);
 165 
 166     template <typename T>
 167     static oop oop_atomic_xchg_in_heap(oop new_value, T* addr);
 168     static oop oop_atomic_xchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset);
 169 
 170     template <typename T>
 171     static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 172                                       arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 173                                       size_t length);
 174 
 175     // Clone barrier support
 176     static void clone_in_heap(oop src, oop dst, size_t size);
 177 
 178     // Needed for loads on non-heap weak references
 179     template <typename T>
 180     static oop oop_load_not_in_heap(T* addr);
 181 
 182     // Used for catching bad stores
 183     template <typename T>
 184     static void oop_store_not_in_heap(T* addr, oop value);
 185 
 186     template <typename T>
 187     static oop oop_atomic_cmpxchg_not_in_heap(oop new_value, T* addr, oop compare_value);
 188 
 189     template <typename T>
 190     static oop oop_atomic_xchg_not_in_heap(oop new_value, T* addr);
 191 
 192   };
 193 
 194 };
 195 
 196 template<>
 197 struct BarrierSet::GetName<ShenandoahBarrierSet> {
 198   static const BarrierSet::Name value = BarrierSet::ShenandoahBarrierSet;
 199 };
 200 
 201 template<>
 202 struct BarrierSet::GetType<BarrierSet::ShenandoahBarrierSet> {
 203   typedef ::ShenandoahBarrierSet type;
 204 };
 205 
 206 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP


 125 
 126   template <class T>
 127   oop load_reference_barrier_native_impl(oop obj, T* load_addr);
 128 
 129   static void keep_alive_if_weak(DecoratorSet decorators, oop value) {
 130     assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
 131     const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
 132     const bool peek              = (decorators & AS_NO_KEEPALIVE) != 0;
 133     if (!peek && !on_strong_oop_ref && value != NULL) {
 134       ShenandoahBarrierSet::barrier_set()->keep_alive_barrier(value);
 135     }
 136   }
 137 
 138 public:
 139   // Callbacks for runtime accesses.
 140   template <DecoratorSet decorators, typename BarrierSetT = ShenandoahBarrierSet>
 141   class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
 142     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
 143 
 144     template <typename T>
 145     static oop oop_atomic_cmpxchg_in_heap_impl(T* addr, oop compare_value, oop new_value);
 146 
 147     template <typename T>
 148     static oop oop_atomic_xchg_in_heap_impl(T* addr, oop new_value);
 149 
 150   public:
 151     // Heap oop accesses. These accessors get resolved when
 152     // IN_HEAP is set (e.g. when using the HeapAccess API), it is
 153     // an oop_* overload, and the barrier strength is AS_NORMAL.
 154     template <typename T>
 155     static oop oop_load_in_heap(T* addr);
 156     static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
 157 
 158     template <typename T>
 159     static void oop_store_in_heap(T* addr, oop value);
 160     static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value);
 161 
 162     template <typename T>
 163     static oop oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value);
 164     static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value);
 165 
 166     template <typename T>
 167     static oop oop_atomic_xchg_in_heap(T* addr, oop new_value);
 168     static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value);
 169 
 170     template <typename T>
 171     static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 172                                       arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 173                                       size_t length);
 174 
 175     // Clone barrier support
 176     static void clone_in_heap(oop src, oop dst, size_t size);
 177 
 178     // Needed for loads on non-heap weak references
 179     template <typename T>
 180     static oop oop_load_not_in_heap(T* addr);
 181 
 182     // Used for catching bad stores
 183     template <typename T>
 184     static void oop_store_not_in_heap(T* addr, oop value);
 185 
 186     template <typename T>
 187     static oop oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value);
 188 
 189     template <typename T>
 190     static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value);
 191 
 192   };
 193 
 194 };
 195 
 196 template<>
 197 struct BarrierSet::GetName<ShenandoahBarrierSet> {
 198   static const BarrierSet::Name value = BarrierSet::ShenandoahBarrierSet;
 199 };
 200 
 201 template<>
 202 struct BarrierSet::GetType<BarrierSet::ShenandoahBarrierSet> {
 203   typedef ::ShenandoahBarrierSet type;
 204 };
 205 
 206 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP
< prev index next >