167 // * ON_WEAK_OOP_REF: The memory access is performed on a weakly reachable reference.
168 // * ON_PHANTOM_OOP_REF: The memory access is performed on a phantomly reachable reference.
169 // This is the same ring of strength as jweak and weak oops in the VM.
170 // * ON_UNKNOWN_OOP_REF: The memory access is performed on a reference of unknown strength.
171 // This could for example come from the unsafe API.
172 // * Default (no explicit reference strength specified): ON_STRONG_OOP_REF
173 const DecoratorSet ON_STRONG_OOP_REF = UCONST64(1) << 16;
174 const DecoratorSet ON_WEAK_OOP_REF = UCONST64(1) << 17;
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;
225 namespace AccessInternal {
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
|
167 // * ON_WEAK_OOP_REF: The memory access is performed on a weakly reachable reference.
168 // * ON_PHANTOM_OOP_REF: The memory access is performed on a phantomly reachable reference.
169 // This is the same ring of strength as jweak and weak oops in the VM.
170 // * ON_UNKNOWN_OOP_REF: The memory access is performed on a reference of unknown strength.
171 // This could for example come from the unsafe API.
172 // * Default (no explicit reference strength specified): ON_STRONG_OOP_REF
173 const DecoratorSet ON_STRONG_OOP_REF = UCONST64(1) << 16;
174 const DecoratorSet ON_WEAK_OOP_REF = UCONST64(1) << 17;
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_NATIVE: 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_NATIVE.
191 const DecoratorSet IN_HEAP = UCONST64(1) << 20;
192 const DecoratorSet IN_HEAP_ARRAY = UCONST64(1) << 21;
193 const DecoratorSet IN_NATIVE = 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_NATIVE | 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;
225 namespace AccessInternal {
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_NATIVE : 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_NATIVE : INTERNAL_EMPTY);
267 DecoratorSet value = conc_root_is_root | BT_BUILDTIME_DECORATORS;
268 return value;
269 }
270 }
271
272 #endif // SHARE_OOPS_ACCESSDECORATORS_HPP
|