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