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