30 |
30 |
31 class Klass; |
31 class Klass; |
32 |
32 |
33 class ModRefBarrierSet: public BarrierSet { |
33 class ModRefBarrierSet: public BarrierSet { |
34 protected: |
34 protected: |
35 ModRefBarrierSet(const BarrierSet::FakeRtti& fake_rtti) |
35 ModRefBarrierSet(BarrierSetAssembler* barrier_set_assembler, |
36 : BarrierSet(fake_rtti.add_tag(BarrierSet::ModRef)) { } |
36 const BarrierSet::FakeRtti& fake_rtti) |
|
37 : BarrierSet(barrier_set_assembler, |
|
38 fake_rtti.add_tag(BarrierSet::ModRef)) { } |
37 ~ModRefBarrierSet() { } |
39 ~ModRefBarrierSet() { } |
38 |
40 |
39 public: |
41 public: |
40 template <DecoratorSet decorators, typename T> |
42 template <DecoratorSet decorators, typename T> |
41 inline void write_ref_field_pre(T* addr) {} |
43 inline void write_ref_field_pre(T* addr) {} |
45 |
47 |
46 // Causes all refs in "mr" to be assumed to be modified. |
48 // Causes all refs in "mr" to be assumed to be modified. |
47 virtual void invalidate(MemRegion mr) = 0; |
49 virtual void invalidate(MemRegion mr) = 0; |
48 virtual void write_region(MemRegion mr) = 0; |
50 virtual void write_region(MemRegion mr) = 0; |
49 |
51 |
|
52 // Operations on arrays, or general regions (e.g., for "clone") may be |
|
53 // optimized by some barriers. |
|
54 |
|
55 // Below length is the # array elements being written |
|
56 virtual void write_ref_array_pre(oop* dst, size_t length, |
|
57 bool dest_uninitialized = false) {} |
|
58 virtual void write_ref_array_pre(narrowOop* dst, size_t length, |
|
59 bool dest_uninitialized = false) {} |
|
60 // Below count is the # array elements being written, starting |
|
61 // at the address "start", which may not necessarily be HeapWord-aligned |
|
62 inline void write_ref_array(HeapWord* start, size_t count); |
|
63 |
|
64 protected: |
|
65 virtual void write_ref_array_work(MemRegion mr) = 0; |
|
66 |
|
67 public: |
50 // The ModRef abstraction introduces pre and post barriers |
68 // The ModRef abstraction introduces pre and post barriers |
51 template <DecoratorSet decorators, typename BarrierSetT> |
69 template <DecoratorSet decorators, typename BarrierSetT> |
52 class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> { |
70 class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> { |
53 typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw; |
71 typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw; |
54 |
72 |