175 const DecoratorSet ON_PHANTOM_OOP_REF = UCONST64(1) << 18;
176 const DecoratorSet ON_UNKNOWN_OOP_REF = UCONST64(1) << 19;
177 const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF |
178 ON_PHANTOM_OOP_REF | ON_UNKNOWN_OOP_REF;
179
180 // === Access Location ===
181 // Accesses can take place in, e.g. the heap, old or young generation and different native roots.
182 // The location is important to the GC as it may imply different actions. The following decorators are used:
183 // * IN_HEAP: The access is performed in the heap. Many barriers such as card marking will
184 // be omitted if this decorator is not set.
185 // * IN_HEAP_ARRAY: The access is performed on a heap allocated array. This is sometimes a special case
186 // for some GCs, and implies that it is an IN_HEAP.
187 // * IN_ROOT: The access is performed in an off-heap data structure pointing into the Java heap.
188 // * IN_CONCURRENT_ROOT: The access is performed in an off-heap data structure pointing into the Java heap,
189 // but is notably not scanned during safepoints. This is sometimes a special case for some GCs and
190 // implies that it is also an IN_ROOT.
191 const DecoratorSet IN_HEAP = UCONST64(1) << 20;
192 const DecoratorSet IN_HEAP_ARRAY = UCONST64(1) << 21;
193 const DecoratorSet IN_ROOT = UCONST64(1) << 22;
194 const DecoratorSet IN_CONCURRENT_ROOT = UCONST64(1) << 23;
195 const DecoratorSet IN_ARCHIVE_ROOT = UCONST64(1) << 24;
196 const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_HEAP_ARRAY |
197 IN_ROOT | IN_CONCURRENT_ROOT |
198 IN_ARCHIVE_ROOT;
199
200 // == Value Decorators ==
201 // * OOP_NOT_NULL: This property can make certain barriers faster such as compressing oops.
202 const DecoratorSet OOP_NOT_NULL = UCONST64(1) << 25;
203 const DecoratorSet OOP_DECORATOR_MASK = OOP_NOT_NULL;
204
205 // == Arraycopy Decorators ==
206 // * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source
207 // are not guaranteed to be subclasses of the class of the destination array. This requires
208 // a check-cast barrier during the copying operation. If this is not set, it is assumed
209 // that the array is covariant: (the source array type is-a destination array type)
210 // * ARRAYCOPY_DISJOINT: This property means that it is known that the two array ranges
211 // are disjoint.
212 // * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form.
213 // * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements.
214 // * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord.
215 const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 26;
216 const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 27;
217 const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 28;
218 const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 29;
228 // This class adds implied decorators that follow according to decorator rules.
229 // For example adding default reference strength and default memory ordering
230 // semantics.
231 template <DecoratorSet input_decorators>
232 struct DecoratorFixup: AllStatic {
233 // If no reference strength has been picked, then strong will be picked
234 static const DecoratorSet ref_strength_default = input_decorators |
235 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
236 ON_STRONG_OOP_REF : INTERNAL_EMPTY);
237 // If no memory ordering has been picked, unordered will be picked
238 static const DecoratorSet memory_ordering_default = ref_strength_default |
239 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
240 // If no barrier strength has been picked, normal will be used
241 static const DecoratorSet barrier_strength_default = memory_ordering_default |
242 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
243 // Heap array accesses imply it is a heap access
244 static const DecoratorSet heap_array_is_in_heap = barrier_strength_default |
245 ((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY);
246 static const DecoratorSet conc_root_is_root = heap_array_is_in_heap |
247 ((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY);
248 static const DecoratorSet archive_root_is_root = conc_root_is_root |
249 ((IN_ARCHIVE_ROOT & conc_root_is_root) != 0 ? IN_ROOT : INTERNAL_EMPTY);
250 static const DecoratorSet value = archive_root_is_root | BT_BUILDTIME_DECORATORS;
251 };
252
253 // This function implements the above DecoratorFixup rules, but without meta
254 // programming for code generation that does not use templates.
255 inline DecoratorSet decorator_fixup(DecoratorSet input_decorators) {
256 // If no reference strength has been picked, then strong will be picked
257 DecoratorSet ref_strength_default = input_decorators |
258 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
259 ON_STRONG_OOP_REF : INTERNAL_EMPTY);
260 // If no memory ordering has been picked, unordered will be picked
261 DecoratorSet memory_ordering_default = ref_strength_default |
262 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
263 // If no barrier strength has been picked, normal will be used
264 DecoratorSet barrier_strength_default = memory_ordering_default |
265 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
266 // Heap array accesses imply it is a heap access
267 DecoratorSet heap_array_is_in_heap = barrier_strength_default |
268 ((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY);
269 DecoratorSet conc_root_is_root = heap_array_is_in_heap |
270 ((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY);
271 DecoratorSet archive_root_is_root = conc_root_is_root |
272 ((IN_ARCHIVE_ROOT & conc_root_is_root) != 0 ? IN_ROOT : INTERNAL_EMPTY);
273 DecoratorSet value = archive_root_is_root | BT_BUILDTIME_DECORATORS;
274 return value;
275 }
276 }
277
278 #endif // SHARE_OOPS_ACCESSDECORATORS_HPP
|
175 const DecoratorSet ON_PHANTOM_OOP_REF = UCONST64(1) << 18;
176 const DecoratorSet ON_UNKNOWN_OOP_REF = UCONST64(1) << 19;
177 const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF |
178 ON_PHANTOM_OOP_REF | ON_UNKNOWN_OOP_REF;
179
180 // === Access Location ===
181 // Accesses can take place in, e.g. the heap, old or young generation and different native roots.
182 // The location is important to the GC as it may imply different actions. The following decorators are used:
183 // * IN_HEAP: The access is performed in the heap. Many barriers such as card marking will
184 // be omitted if this decorator is not set.
185 // * IN_HEAP_ARRAY: The access is performed on a heap allocated array. This is sometimes a special case
186 // for some GCs, and implies that it is an IN_HEAP.
187 // * IN_ROOT: The access is performed in an off-heap data structure pointing into the Java heap.
188 // * IN_CONCURRENT_ROOT: The access is performed in an off-heap data structure pointing into the Java heap,
189 // but is notably not scanned during safepoints. This is sometimes a special case for some GCs and
190 // implies that it is also an IN_ROOT.
191 const DecoratorSet IN_HEAP = UCONST64(1) << 20;
192 const DecoratorSet IN_HEAP_ARRAY = UCONST64(1) << 21;
193 const DecoratorSet IN_ROOT = UCONST64(1) << 22;
194 const DecoratorSet IN_CONCURRENT_ROOT = UCONST64(1) << 23;
195 const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_HEAP_ARRAY |
196 IN_ROOT | IN_CONCURRENT_ROOT;
197
198 // == Value Decorators ==
199 // * OOP_NOT_NULL: This property can make certain barriers faster such as compressing oops.
200 const DecoratorSet OOP_NOT_NULL = UCONST64(1) << 25;
201 const DecoratorSet OOP_DECORATOR_MASK = OOP_NOT_NULL;
202
203 // == Arraycopy Decorators ==
204 // * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source
205 // are not guaranteed to be subclasses of the class of the destination array. This requires
206 // a check-cast barrier during the copying operation. If this is not set, it is assumed
207 // that the array is covariant: (the source array type is-a destination array type)
208 // * ARRAYCOPY_DISJOINT: This property means that it is known that the two array ranges
209 // are disjoint.
210 // * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form.
211 // * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements.
212 // * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord.
213 const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 26;
214 const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 27;
215 const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 28;
216 const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 29;
226 // This class adds implied decorators that follow according to decorator rules.
227 // For example adding default reference strength and default memory ordering
228 // semantics.
229 template <DecoratorSet input_decorators>
230 struct DecoratorFixup: AllStatic {
231 // If no reference strength has been picked, then strong will be picked
232 static const DecoratorSet ref_strength_default = input_decorators |
233 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
234 ON_STRONG_OOP_REF : INTERNAL_EMPTY);
235 // If no memory ordering has been picked, unordered will be picked
236 static const DecoratorSet memory_ordering_default = ref_strength_default |
237 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
238 // If no barrier strength has been picked, normal will be used
239 static const DecoratorSet barrier_strength_default = memory_ordering_default |
240 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
241 // Heap array accesses imply it is a heap access
242 static const DecoratorSet heap_array_is_in_heap = barrier_strength_default |
243 ((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY);
244 static const DecoratorSet conc_root_is_root = heap_array_is_in_heap |
245 ((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY);
246 static const DecoratorSet value = conc_root_is_root | BT_BUILDTIME_DECORATORS;
247 };
248
249 // This function implements the above DecoratorFixup rules, but without meta
250 // programming for code generation that does not use templates.
251 inline DecoratorSet decorator_fixup(DecoratorSet input_decorators) {
252 // If no reference strength has been picked, then strong will be picked
253 DecoratorSet ref_strength_default = input_decorators |
254 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
255 ON_STRONG_OOP_REF : INTERNAL_EMPTY);
256 // If no memory ordering has been picked, unordered will be picked
257 DecoratorSet memory_ordering_default = ref_strength_default |
258 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
259 // If no barrier strength has been picked, normal will be used
260 DecoratorSet barrier_strength_default = memory_ordering_default |
261 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
262 // Heap array accesses imply it is a heap access
263 DecoratorSet heap_array_is_in_heap = barrier_strength_default |
264 ((IN_HEAP_ARRAY & barrier_strength_default) != 0 ? IN_HEAP : INTERNAL_EMPTY);
265 DecoratorSet conc_root_is_root = heap_array_is_in_heap |
266 ((IN_CONCURRENT_ROOT & heap_array_is_in_heap) != 0 ? IN_ROOT : INTERNAL_EMPTY);
267 DecoratorSet value = conc_root_is_root | BT_BUILDTIME_DECORATORS;
268 return value;
269 }
270 }
271
272 #endif // SHARE_OOPS_ACCESSDECORATORS_HPP
|