191 // * IN_NATIVE: The access is performed in an off-heap data structure.
192 const DecoratorSet IN_HEAP = UCONST64(1) << 18;
193 const DecoratorSet IN_NATIVE = UCONST64(1) << 19;
194 const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE;
195
196 // == Boolean Flag Decorators ==
197 // * IS_ARRAY: The access is performed on a heap allocated array. This is sometimes a special case
198 // for some GCs.
199 // * IS_DEST_UNINITIALIZED: This property can be important to e.g. SATB barriers by
200 // marking that the previous value is uninitialized nonsense rather than a real value.
201 // * IS_NOT_NULL: This property can make certain barriers faster such as compressing oops.
202 const DecoratorSet IS_ARRAY = UCONST64(1) << 20;
203 const DecoratorSet IS_DEST_UNINITIALIZED = UCONST64(1) << 21;
204 const DecoratorSet IS_NOT_NULL = UCONST64(1) << 22;
205
206 // == Arraycopy Decorators ==
207 // * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source
208 // are not guaranteed to be subclasses of the class of the destination array. This requires
209 // a check-cast barrier during the copying operation. If this is not set, it is assumed
210 // that the array is covariant: (the source array type is-a destination array type)
211 // * ARRAYCOPY_DISJOINT: This property means that it is known that the two array ranges
212 // are disjoint.
213 // * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form.
214 // * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements.
215 // * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord.
216 const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 23;
217 const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 24;
218 const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 25;
219 const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 26;
220 const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 27;
221 const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT |
222 ARRAYCOPY_DISJOINT | ARRAYCOPY_ARRAYOF |
223 ARRAYCOPY_ATOMIC | ARRAYCOPY_ALIGNED;
224
225 // == Resolve barrier decorators ==
226 // * ACCESS_READ: Indicate that the resolved object is accessed read-only. This allows the GC
227 // backend to use weaker and more efficient barriers.
228 // * ACCESS_WRITE: Indicate that the resolved object is used for write access.
229 const DecoratorSet ACCESS_READ = UCONST64(1) << 28;
230 const DecoratorSet ACCESS_WRITE = UCONST64(1) << 29;
231
232 // Keep track of the last decorator.
233 const DecoratorSet DECORATOR_LAST = UCONST64(1) << 29;
234
235 namespace AccessInternal {
236 // This class adds implied decorators that follow according to decorator rules.
237 // For example adding default reference strength and default memory ordering
238 // semantics.
239 template <DecoratorSet input_decorators>
240 struct DecoratorFixup: AllStatic {
241 // If no reference strength has been picked, then strong will be picked
242 static const DecoratorSet ref_strength_default = input_decorators |
243 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
244 ON_STRONG_OOP_REF : DECORATORS_NONE);
245 // If no memory ordering has been picked, unordered will be picked
246 static const DecoratorSet memory_ordering_default = ref_strength_default |
247 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : DECORATORS_NONE);
248 // If no barrier strength has been picked, normal will be used
249 static const DecoratorSet barrier_strength_default = memory_ordering_default |
250 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : DECORATORS_NONE);
251 static const DecoratorSet value = barrier_strength_default;
252 };
253
|
191 // * IN_NATIVE: The access is performed in an off-heap data structure.
192 const DecoratorSet IN_HEAP = UCONST64(1) << 18;
193 const DecoratorSet IN_NATIVE = UCONST64(1) << 19;
194 const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE;
195
196 // == Boolean Flag Decorators ==
197 // * IS_ARRAY: The access is performed on a heap allocated array. This is sometimes a special case
198 // for some GCs.
199 // * IS_DEST_UNINITIALIZED: This property can be important to e.g. SATB barriers by
200 // marking that the previous value is uninitialized nonsense rather than a real value.
201 // * IS_NOT_NULL: This property can make certain barriers faster such as compressing oops.
202 const DecoratorSet IS_ARRAY = UCONST64(1) << 20;
203 const DecoratorSet IS_DEST_UNINITIALIZED = UCONST64(1) << 21;
204 const DecoratorSet IS_NOT_NULL = UCONST64(1) << 22;
205
206 // == Arraycopy Decorators ==
207 // * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source
208 // are not guaranteed to be subclasses of the class of the destination array. This requires
209 // a check-cast barrier during the copying operation. If this is not set, it is assumed
210 // that the array is covariant: (the source array type is-a destination array type)
211 // * ARRAYCOPY_NOTNULL: This property means that the source array may contain null elements
212 // but the destination does not allow null elements (i.e. throw NPE)
213 // * ARRAYCOPY_DISJOINT: This property means that it is known that the two array ranges
214 // are disjoint.
215 // * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form.
216 // * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements.
217 // * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord.
218 const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 23;
219 const DecoratorSet ARRAYCOPY_NOTNULL = UCONST64(1) << 24;
220 const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 25;
221 const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 26;
222 const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 27;
223 const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 28;
224 const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_CHECKCAST | ARRAYCOPY_NOTNULL |
225 ARRAYCOPY_DISJOINT | ARRAYCOPY_ARRAYOF |
226 ARRAYCOPY_ATOMIC | ARRAYCOPY_ALIGNED;
227
228 // == Resolve barrier decorators ==
229 // * ACCESS_READ: Indicate that the resolved object is accessed read-only. This allows the GC
230 // backend to use weaker and more efficient barriers.
231 // * ACCESS_WRITE: Indicate that the resolved object is used for write access.
232 const DecoratorSet ACCESS_READ = UCONST64(1) << 29;
233 const DecoratorSet ACCESS_WRITE = UCONST64(1) << 30;
234
235 // Keep track of the last decorator.
236 const DecoratorSet DECORATOR_LAST = UCONST64(1) << 30;
237
238 namespace AccessInternal {
239 // This class adds implied decorators that follow according to decorator rules.
240 // For example adding default reference strength and default memory ordering
241 // semantics.
242 template <DecoratorSet input_decorators>
243 struct DecoratorFixup: AllStatic {
244 // If no reference strength has been picked, then strong will be picked
245 static const DecoratorSet ref_strength_default = input_decorators |
246 (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
247 ON_STRONG_OOP_REF : DECORATORS_NONE);
248 // If no memory ordering has been picked, unordered will be picked
249 static const DecoratorSet memory_ordering_default = ref_strength_default |
250 ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : DECORATORS_NONE);
251 // If no barrier strength has been picked, normal will be used
252 static const DecoratorSet barrier_strength_default = memory_ordering_default |
253 ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : DECORATORS_NONE);
254 static const DecoratorSet value = barrier_strength_default;
255 };
256
|