51 CardTableModRef, // CardTableModRefBS
52 CardTableForRS, // CardTableModRefBSForCTRS
53 CardTableExtension, // CardTableExtension
54 G1SATBCT, // G1SATBCardTableModRefBS
55 G1SATBCTLogging // G1SATBCardTableLoggingModRefBS
56 };
57
58 protected:
59 typedef FakeRttiSupport<BarrierSet, Name> FakeRtti;
60
61 private:
62 FakeRtti _fake_rtti;
63
64 // Metafunction mapping a class derived from BarrierSet to the
65 // corresponding Name enum tag.
66 template<typename T> struct GetName;
67
68 // Downcast argument to a derived barrier set type.
69 // The cast is checked in a debug build.
70 // T must have a specialization for BarrierSet::GetName<T>.
71 template<typename T>
72 friend T* barrier_set_cast(BarrierSet* bs) {
73 assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
74 return static_cast<T*>(bs);
75 }
76
77 public:
78 // Note: This is not presently the Name corresponding to the
79 // concrete class of this object.
80 BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
81
82 // Test whether this object is of the type corresponding to bsn.
83 bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); }
84
85 // End of fake RTTI support.
86
87 public:
88 enum Flags {
89 None = 0,
90 TargetUninitialized = 1
91 };
92
93 protected:
94 // Some barrier sets create tables whose elements correspond to parts of
95 // the heap; the CardTableModRefBS is an example. Such barrier sets will
198
199 // (For efficiency reasons, this operation is specialized for certain
200 // barrier types. Semantically, it should be thought of as a call to the
201 // virtual "_work" function below, which must implement the barrier.)
202 void write_region(MemRegion mr);
203 protected:
204 virtual void write_region_work(MemRegion mr) = 0;
205 public:
206 // Inform the BarrierSet that the the covered heap region that starts
207 // with "base" has been changed to have the given size (possibly from 0,
208 // for initialization.)
209 virtual void resize_covered_region(MemRegion new_region) = 0;
210
211 // If the barrier set imposes any alignment restrictions on boundaries
212 // within the heap, this function tells whether they are met.
213 virtual bool is_aligned(HeapWord* addr) = 0;
214
215 // Print a description of the memory for the barrier set
216 virtual void print_on(outputStream* st) const = 0;
217 };
218
219 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
|
51 CardTableModRef, // CardTableModRefBS
52 CardTableForRS, // CardTableModRefBSForCTRS
53 CardTableExtension, // CardTableExtension
54 G1SATBCT, // G1SATBCardTableModRefBS
55 G1SATBCTLogging // G1SATBCardTableLoggingModRefBS
56 };
57
58 protected:
59 typedef FakeRttiSupport<BarrierSet, Name> FakeRtti;
60
61 private:
62 FakeRtti _fake_rtti;
63
64 // Metafunction mapping a class derived from BarrierSet to the
65 // corresponding Name enum tag.
66 template<typename T> struct GetName;
67
68 // Downcast argument to a derived barrier set type.
69 // The cast is checked in a debug build.
70 // T must have a specialization for BarrierSet::GetName<T>.
71 template<typename T> friend T* barrier_set_cast(BarrierSet* bs);
72
73 public:
74 // Note: This is not presently the Name corresponding to the
75 // concrete class of this object.
76 BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
77
78 // Test whether this object is of the type corresponding to bsn.
79 bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); }
80
81 // End of fake RTTI support.
82
83 public:
84 enum Flags {
85 None = 0,
86 TargetUninitialized = 1
87 };
88
89 protected:
90 // Some barrier sets create tables whose elements correspond to parts of
91 // the heap; the CardTableModRefBS is an example. Such barrier sets will
194
195 // (For efficiency reasons, this operation is specialized for certain
196 // barrier types. Semantically, it should be thought of as a call to the
197 // virtual "_work" function below, which must implement the barrier.)
198 void write_region(MemRegion mr);
199 protected:
200 virtual void write_region_work(MemRegion mr) = 0;
201 public:
202 // Inform the BarrierSet that the the covered heap region that starts
203 // with "base" has been changed to have the given size (possibly from 0,
204 // for initialization.)
205 virtual void resize_covered_region(MemRegion new_region) = 0;
206
207 // If the barrier set imposes any alignment restrictions on boundaries
208 // within the heap, this function tells whether they are met.
209 virtual bool is_aligned(HeapWord* addr) = 0;
210
211 // Print a description of the memory for the barrier set
212 virtual void print_on(outputStream* st) const = 0;
213 };
214
215 template<typename T>
216 inline T* barrier_set_cast(BarrierSet* bs) {
217 assert(bs->is_a(BarrierSet::GetName<T>::value), "wrong type of barrier set");
218 return static_cast<T*>(bs);
219 }
220
221 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
|