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