< prev index next >

src/hotspot/share/gc/shared/modRefBarrierSet.hpp

Print this page

 51   inline void write_ref_field_post(T *addr, oop new_value) {}
 52 
 53   // Causes all refs in "mr" to be assumed to be modified.
 54   virtual void invalidate(MemRegion mr) = 0;
 55   virtual void write_region(MemRegion mr) = 0;
 56 
 57   // Operations on arrays, or general regions (e.g., for "clone") may be
 58   // optimized by some barriers.
 59 
 60   // Below length is the # array elements being written
 61   virtual void write_ref_array_pre(oop* dst, size_t length,
 62                                    bool dest_uninitialized = false) {}
 63   virtual void write_ref_array_pre(narrowOop* dst, size_t length,
 64                                    bool dest_uninitialized = false) {}
 65   // Below count is the # array elements being written, starting
 66   // at the address "start", which may not necessarily be HeapWord-aligned
 67   inline void write_ref_array(HeapWord* start, size_t count);
 68 
 69  protected:
 70   virtual void write_ref_array_work(MemRegion mr) = 0;
 71 
 72  public:
 73   // The ModRef abstraction introduces pre and post barriers
 74   template <DecoratorSet decorators, typename BarrierSetT>
 75   class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
 76     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
 77 
 78   public:
 79     template <typename T>
 80     static void oop_store_in_heap(T* addr, oop value);
 81     template <typename T>
 82     static oop oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value);
 83     template <typename T>
 84     static oop oop_atomic_xchg_in_heap(T* addr, oop new_value);
 85 
 86     template <typename T>
 87     static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 88                                       arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 89                                       size_t length);
 90 




 91     static void clone_in_heap(oop src, oop dst, size_t size);
 92 
 93     static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) {
 94       oop_store_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), value);
 95     }
 96 
 97     static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value) {
 98       return oop_atomic_xchg_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), new_value);
 99     }
100 
101     static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value) {
102       return oop_atomic_cmpxchg_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), compare_value, new_value);
103     }


104   };
105 };
106 
107 template<>
108 struct BarrierSet::GetName<ModRefBarrierSet> {
109   static const BarrierSet::Name value = BarrierSet::ModRef;
110 };
111 
112 #endif // SHARE_GC_SHARED_MODREFBARRIERSET_HPP

 51   inline void write_ref_field_post(T *addr, oop new_value) {}
 52 
 53   // Causes all refs in "mr" to be assumed to be modified.
 54   virtual void invalidate(MemRegion mr) = 0;
 55   virtual void write_region(MemRegion mr) = 0;
 56 
 57   // Operations on arrays, or general regions (e.g., for "clone") may be
 58   // optimized by some barriers.
 59 
 60   // Below length is the # array elements being written
 61   virtual void write_ref_array_pre(oop* dst, size_t length,
 62                                    bool dest_uninitialized = false) {}
 63   virtual void write_ref_array_pre(narrowOop* dst, size_t length,
 64                                    bool dest_uninitialized = false) {}
 65   // Below count is the # array elements being written, starting
 66   // at the address "start", which may not necessarily be HeapWord-aligned
 67   inline void write_ref_array(HeapWord* start, size_t count);
 68 
 69  protected:
 70   virtual void write_ref_array_work(MemRegion mr) = 0;

 71  public:
 72   // The ModRef abstraction introduces pre and post barriers
 73   template <DecoratorSet decorators, typename BarrierSetT>
 74   class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
 75     typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
 76 
 77   public:
 78     template <typename T>
 79     static void oop_store_in_heap(T* addr, oop value);
 80     template <typename T>
 81     static oop oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value);
 82     template <typename T>
 83     static oop oop_atomic_xchg_in_heap(T* addr, oop new_value);
 84 
 85     template <typename T>
 86     static void oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 87                                       arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 88                                       size_t length);
 89   private:
 90     // Failing checkcast or check null during copy, still needs barrier
 91     template <typename T>
 92     static inline void oop_arraycopy_partial_barrier(BarrierSetT *bs, T* dst_raw, T* p);
 93   public:
 94     static void clone_in_heap(oop src, oop dst, size_t size);
 95 
 96     static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) {
 97       oop_store_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), value);
 98     }
 99 
100     static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value) {
101       return oop_atomic_xchg_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), new_value);
102     }
103 
104     static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value) {
105       return oop_atomic_cmpxchg_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), compare_value, new_value);
106     }
107 
108     static void value_copy_in_heap(void* src, void* dst, InlineKlass* md);
109   };
110 };
111 
112 template<>
113 struct BarrierSet::GetName<ModRefBarrierSet> {
114   static const BarrierSet::Name value = BarrierSet::ModRef;
115 };
116 
117 #endif // SHARE_GC_SHARED_MODREFBARRIERSET_HPP
< prev index next >