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