107
108 // Invoke the barrier, if any, necessary when writing the "bytes"-byte
109 // value(s) "val1" (and "val2") into the primitive "field".
110 virtual void write_prim_field(HeapWord* field, size_t bytes,
111 juint val1, juint val2) = 0;
112
113 // Operations on arrays, or general regions (e.g., for "clone") may be
114 // optimized by some barriers.
115
116 // The first six operations tell whether such an optimization exists for
117 // the particular barrier.
118 virtual bool has_read_ref_array_opt() = 0;
119 virtual bool has_read_prim_array_opt() = 0;
120 virtual bool has_write_ref_array_pre_opt() { return true; }
121 virtual bool has_write_ref_array_opt() = 0;
122 virtual bool has_write_prim_array_opt() = 0;
123
124 virtual bool has_read_region_opt() = 0;
125 virtual bool has_write_region_opt() = 0;
126
127 // These operations should assert false unless the correponding operation
128 // above returns true. Otherwise, they should perform an appropriate
129 // barrier for an array whose elements are all in the given memory region.
130 virtual void read_ref_array(MemRegion mr) = 0;
131 virtual void read_prim_array(MemRegion mr) = 0;
132
133 // Below length is the # array elements being written
134 virtual void write_ref_array_pre(oop* dst, int length,
135 bool dest_uninitialized = false) {}
136 virtual void write_ref_array_pre(narrowOop* dst, int length,
137 bool dest_uninitialized = false) {}
138 // Below count is the # array elements being written, starting
139 // at the address "start", which may not necessarily be HeapWord-aligned
140 inline void write_ref_array(HeapWord* start, size_t count);
141
142 // Static versions, suitable for calling from generated code;
143 // count is # array elements being written, starting with "start",
144 // which may not necessarily be HeapWord-aligned.
145 static void static_write_ref_array_pre(HeapWord* start, size_t count);
146 static void static_write_ref_array_post(HeapWord* start, size_t count);
147
148 protected:
149 virtual void write_ref_array_work(MemRegion mr) = 0;
150 public:
151 virtual void write_prim_array(MemRegion mr) = 0;
152
153 virtual void read_region(MemRegion mr) = 0;
154
155 // (For efficiency reasons, this operation is specialized for certain
156 // barrier types. Semantically, it should be thought of as a call to the
157 // virtual "_work" function below, which must implement the barrier.)
158 inline void write_region(MemRegion mr);
159 protected:
160 virtual void write_region_work(MemRegion mr) = 0;
161 public:
162
163 // Some barrier sets create tables whose elements correspond to parts of
164 // the heap; the CardTableModRefBS is an example. Such barrier sets will
165 // normally reserve space for such tables, and commit parts of the table
166 // "covering" parts of the heap that are committed. The constructor is
167 // passed the maximum number of independently committable subregions to
168 // be covered, and the "resize_covoered_region" function allows the
169 // sub-parts of the heap to inform the barrier set of changes of their
170 // sizes.
171 BarrierSet(int max_covered_regions) :
172 _max_covered_regions(max_covered_regions) {}
173
174 // Inform the BarrierSet that the the covered heap region that starts
175 // with "base" has been changed to have the given size (possibly from 0,
176 // for initialization.)
177 virtual void resize_covered_region(MemRegion new_region) = 0;
178
179 // If the barrier set imposes any alignment restrictions on boundaries
180 // within the heap, this function tells whether they are met.
181 virtual bool is_aligned(HeapWord* addr) = 0;
182
183 // Print a description of the memory for the barrier set
184 virtual void print_on(outputStream* st) const = 0;
185 };
186
187 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
|
107
108 // Invoke the barrier, if any, necessary when writing the "bytes"-byte
109 // value(s) "val1" (and "val2") into the primitive "field".
110 virtual void write_prim_field(HeapWord* field, size_t bytes,
111 juint val1, juint val2) = 0;
112
113 // Operations on arrays, or general regions (e.g., for "clone") may be
114 // optimized by some barriers.
115
116 // The first six operations tell whether such an optimization exists for
117 // the particular barrier.
118 virtual bool has_read_ref_array_opt() = 0;
119 virtual bool has_read_prim_array_opt() = 0;
120 virtual bool has_write_ref_array_pre_opt() { return true; }
121 virtual bool has_write_ref_array_opt() = 0;
122 virtual bool has_write_prim_array_opt() = 0;
123
124 virtual bool has_read_region_opt() = 0;
125 virtual bool has_write_region_opt() = 0;
126
127 // These operations should assert false unless the corresponding operation
128 // above returns true. Otherwise, they should perform an appropriate
129 // barrier for an array whose elements are all in the given memory region.
130 virtual void read_ref_array(MemRegion mr) = 0;
131 virtual void read_prim_array(MemRegion mr) = 0;
132
133 // Below length is the # array elements being written
134 virtual void write_ref_array_pre(oop* dst, int length,
135 bool dest_uninitialized = false) {}
136 virtual void write_ref_array_pre(narrowOop* dst, int length,
137 bool dest_uninitialized = false) {}
138 // Below count is the # array elements being written, starting
139 // at the address "start", which may not necessarily be HeapWord-aligned
140 inline void write_ref_array(HeapWord* start, size_t count);
141
142 // Static versions, suitable for calling from generated code;
143 // count is # array elements being written, starting with "start",
144 // which may not necessarily be HeapWord-aligned.
145 static void static_write_ref_array_pre(HeapWord* start, size_t count);
146 static void static_write_ref_array_post(HeapWord* start, size_t count);
147
148 protected:
149 virtual void write_ref_array_work(MemRegion mr) = 0;
150 public:
151 virtual void write_prim_array(MemRegion mr) = 0;
152
153 virtual void read_region(MemRegion mr) = 0;
154
155 // (For efficiency reasons, this operation is specialized for certain
156 // barrier types. Semantically, it should be thought of as a call to the
157 // virtual "_work" function below, which must implement the barrier.)
158 inline void write_region(MemRegion mr);
159 protected:
160 virtual void write_region_work(MemRegion mr) = 0;
161 public:
162
163 // Some barrier sets create tables whose elements correspond to parts of
164 // the heap; the CardTableModRefBS is an example. Such barrier sets will
165 // normally reserve space for such tables, and commit parts of the table
166 // "covering" parts of the heap that are committed. The constructor is
167 // passed the maximum number of independently committable subregions to
168 // be covered, and the "resize_covered_region" function allows the
169 // sub-parts of the heap to inform the barrier set of changes of their
170 // sizes.
171 BarrierSet(int max_covered_regions) :
172 _max_covered_regions(max_covered_regions) {}
173
174 // Inform the BarrierSet that the the covered heap region that starts
175 // with "base" has been changed to have the given size (possibly from 0,
176 // for initialization.)
177 virtual void resize_covered_region(MemRegion new_region) = 0;
178
179 // If the barrier set imposes any alignment restrictions on boundaries
180 // within the heap, this function tells whether they are met.
181 virtual bool is_aligned(HeapWord* addr) = 0;
182
183 // Print a description of the memory for the barrier set
184 virtual void print_on(outputStream* st) const = 0;
185 };
186
187 #endif // SHARE_VM_MEMORY_BARRIERSET_HPP
|