153 // in the pipeline and hardwire to raw accesses without going trough the GC access barriers. |
153 // in the pipeline and hardwire to raw accesses without going trough the GC access barriers. |
154 // - Accesses on oop* translate to raw memory accesses without runtime checks |
154 // - Accesses on oop* translate to raw memory accesses without runtime checks |
155 // - Accesses on narrowOop* translate to encoded/decoded memory accesses without runtime checks |
155 // - Accesses on narrowOop* translate to encoded/decoded memory accesses without runtime checks |
156 // - Accesses on HeapWord* translate to a runtime check choosing one of the above |
156 // - Accesses on HeapWord* translate to a runtime check choosing one of the above |
157 // - Accesses on other types translate to raw memory accesses without runtime checks |
157 // - Accesses on other types translate to raw memory accesses without runtime checks |
|
158 // * AS_DEST_NOT_INITIALIZED: This property can be important to e.g. SATB barriers by |
|
159 // marking that the previous value is uninitialized nonsense rather than a real value. |
158 // * AS_NO_KEEPALIVE: The barrier is used only on oop references and will not keep any involved objects |
160 // * AS_NO_KEEPALIVE: The barrier is used only on oop references and will not keep any involved objects |
159 // alive, regardless of the type of reference being accessed. It will however perform the memory access |
161 // alive, regardless of the type of reference being accessed. It will however perform the memory access |
160 // in a consistent way w.r.t. e.g. concurrent compaction, so that the right field is being accessed, |
162 // in a consistent way w.r.t. e.g. concurrent compaction, so that the right field is being accessed, |
161 // or maintain, e.g. intergenerational or interregional pointers if applicable. This should be used with |
163 // or maintain, e.g. intergenerational or interregional pointers if applicable. This should be used with |
162 // extreme caution in isolated scopes. |
164 // extreme caution in isolated scopes. |
163 // * AS_NORMAL: The accesses will be resolved to an accessor on the BarrierSet class, giving the |
165 // * AS_NORMAL: The accesses will be resolved to an accessor on the BarrierSet class, giving the |
164 // responsibility of performing the access and what barriers to be performed to the GC. This is the default. |
166 // responsibility of performing the access and what barriers to be performed to the GC. This is the default. |
165 // Note that primitive accesses will only be resolved on the barrier set if the appropriate build-time |
167 // Note that primitive accesses will only be resolved on the barrier set if the appropriate build-time |
166 // decorator for enabling primitive barriers is enabled for the build. |
168 // decorator for enabling primitive barriers is enabled for the build. |
167 const DecoratorSet AS_RAW = UCONST64(1) << 11; |
169 const DecoratorSet AS_RAW = UCONST64(1) << 11; |
168 const DecoratorSet AS_NO_KEEPALIVE = UCONST64(1) << 12; |
170 const DecoratorSet AS_DEST_NOT_INITIALIZED = UCONST64(1) << 12; |
169 const DecoratorSet AS_NORMAL = UCONST64(1) << 13; |
171 const DecoratorSet AS_NO_KEEPALIVE = UCONST64(1) << 13; |
170 const DecoratorSet AS_DECORATOR_MASK = AS_RAW | AS_NO_KEEPALIVE | AS_NORMAL; |
172 const DecoratorSet AS_NORMAL = UCONST64(1) << 14; |
|
173 const DecoratorSet AS_DECORATOR_MASK = AS_RAW | AS_DEST_NOT_INITIALIZED | |
|
174 AS_NO_KEEPALIVE | AS_NORMAL; |
171 |
175 |
172 // === Reference Strength Decorators === |
176 // === Reference Strength Decorators === |
173 // These decorators only apply to accesses on oop-like types (oop/narrowOop). |
177 // These decorators only apply to accesses on oop-like types (oop/narrowOop). |
174 // * ON_STRONG_OOP_REF: Memory access is performed on a strongly reachable reference. |
178 // * ON_STRONG_OOP_REF: Memory access is performed on a strongly reachable reference. |
175 // * ON_WEAK_OOP_REF: The memory access is performed on a weakly reachable reference. |
179 // * ON_WEAK_OOP_REF: The memory access is performed on a weakly reachable reference. |
176 // * ON_PHANTOM_OOP_REF: The memory access is performed on a phantomly reachable reference. |
180 // * ON_PHANTOM_OOP_REF: The memory access is performed on a phantomly reachable reference. |
177 // This is the same ring of strength as jweak and weak oops in the VM. |
181 // This is the same ring of strength as jweak and weak oops in the VM. |
178 // * ON_UNKNOWN_OOP_REF: The memory access is performed on a reference of unknown strength. |
182 // * ON_UNKNOWN_OOP_REF: The memory access is performed on a reference of unknown strength. |
179 // This could for example come from the unsafe API. |
183 // This could for example come from the unsafe API. |
180 // * Default (no explicit reference strength specified): ON_STRONG_OOP_REF |
184 // * Default (no explicit reference strength specified): ON_STRONG_OOP_REF |
181 const DecoratorSet ON_STRONG_OOP_REF = UCONST64(1) << 14; |
185 const DecoratorSet ON_STRONG_OOP_REF = UCONST64(1) << 15; |
182 const DecoratorSet ON_WEAK_OOP_REF = UCONST64(1) << 15; |
186 const DecoratorSet ON_WEAK_OOP_REF = UCONST64(1) << 16; |
183 const DecoratorSet ON_PHANTOM_OOP_REF = UCONST64(1) << 16; |
187 const DecoratorSet ON_PHANTOM_OOP_REF = UCONST64(1) << 17; |
184 const DecoratorSet ON_UNKNOWN_OOP_REF = UCONST64(1) << 17; |
188 const DecoratorSet ON_UNKNOWN_OOP_REF = UCONST64(1) << 18; |
185 const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF | |
189 const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF | |
186 ON_PHANTOM_OOP_REF | ON_UNKNOWN_OOP_REF; |
190 ON_PHANTOM_OOP_REF | ON_UNKNOWN_OOP_REF; |
187 |
191 |
188 // === Access Location === |
192 // === Access Location === |
189 // Accesses can take place in, e.g. the heap, old or young generation and different native roots. |
193 // Accesses can take place in, e.g. the heap, old or young generation and different native roots. |
194 // for some GCs, and implies that it is an IN_HEAP. |
198 // for some GCs, and implies that it is an IN_HEAP. |
195 // * IN_ROOT: The access is performed in an off-heap data structure pointing into the Java heap. |
199 // * IN_ROOT: The access is performed in an off-heap data structure pointing into the Java heap. |
196 // * IN_CONCURRENT_ROOT: The access is performed in an off-heap data structure pointing into the Java heap, |
200 // * IN_CONCURRENT_ROOT: The access is performed in an off-heap data structure pointing into the Java heap, |
197 // but is notably not scanned during safepoints. This is sometimes a special case for some GCs and |
201 // but is notably not scanned during safepoints. This is sometimes a special case for some GCs and |
198 // implies that it is also an IN_ROOT. |
202 // implies that it is also an IN_ROOT. |
199 const DecoratorSet IN_HEAP = UCONST64(1) << 18; |
203 const DecoratorSet IN_HEAP = UCONST64(1) << 19; |
200 const DecoratorSet IN_HEAP_ARRAY = UCONST64(1) << 19; |
204 const DecoratorSet IN_HEAP_ARRAY = UCONST64(1) << 20; |
201 const DecoratorSet IN_ROOT = UCONST64(1) << 20; |
205 const DecoratorSet IN_ROOT = UCONST64(1) << 21; |
202 const DecoratorSet IN_CONCURRENT_ROOT = UCONST64(1) << 21; |
206 const DecoratorSet IN_CONCURRENT_ROOT = UCONST64(1) << 22; |
203 const DecoratorSet IN_ARCHIVE_ROOT = UCONST64(1) << 22; |
207 const DecoratorSet IN_ARCHIVE_ROOT = UCONST64(1) << 23; |
204 const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_HEAP_ARRAY | |
208 const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_HEAP_ARRAY | |
205 IN_ROOT | IN_CONCURRENT_ROOT | |
209 IN_ROOT | IN_CONCURRENT_ROOT | |
206 IN_ARCHIVE_ROOT; |
210 IN_ARCHIVE_ROOT; |
207 |
211 |
208 // == Value Decorators == |
212 // == Value Decorators == |
209 // * OOP_NOT_NULL: This property can make certain barriers faster such as compressing oops. |
213 // * OOP_NOT_NULL: This property can make certain barriers faster such as compressing oops. |
210 const DecoratorSet OOP_NOT_NULL = UCONST64(1) << 23; |
214 const DecoratorSet OOP_NOT_NULL = UCONST64(1) << 24; |
211 const DecoratorSet OOP_DECORATOR_MASK = OOP_NOT_NULL; |
215 const DecoratorSet OOP_DECORATOR_MASK = OOP_NOT_NULL; |
212 |
216 |
213 // == Arraycopy Decorators == |
217 // == Arraycopy Decorators == |
214 // * ARRAYCOPY_DEST_NOT_INITIALIZED: This property can be important to e.g. SATB barriers by |
|
215 // marking that the previous value uninitialized nonsense rather than a real value. |
|
216 // * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source |
218 // * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source |
217 // are not guaranteed to be subclasses of the class of the destination array. This requires |
219 // are not guaranteed to be subclasses of the class of the destination array. This requires |
218 // a check-cast barrier during the copying operation. If this is not set, it is assumed |
220 // a check-cast barrier during the copying operation. If this is not set, it is assumed |
219 // that the array is covariant: (the source array type is-a destination array type) |
221 // that the array is covariant: (the source array type is-a destination array type) |
220 // * ARRAYCOPY_DISJOINT: This property means that it is known that the two array ranges |
222 // * ARRAYCOPY_DISJOINT: This property means that it is known that the two array ranges |
221 // are disjoint. |
223 // are disjoint. |
222 // * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form. |
224 // * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form. |
223 // * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements. |
225 // * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements. |
224 // * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord. |
226 // * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord. |
225 const DecoratorSet ARRAYCOPY_DEST_NOT_INITIALIZED = UCONST64(1) << 24; |
|
226 const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 25; |
227 const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 25; |
227 const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 26; |
228 const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 26; |
228 const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 27; |
229 const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 27; |
229 const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 28; |
230 const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 28; |
230 const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 29; |
231 const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 29; |
231 const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_DEST_NOT_INITIALIZED | |
232 const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT | |
232 ARRAYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT | |
|
233 ARRAYCOPY_DISJOINT | ARRAYCOPY_ARRAYOF | |
233 ARRAYCOPY_DISJOINT | ARRAYCOPY_ARRAYOF | |
234 ARRAYCOPY_ATOMIC | ARRAYCOPY_ALIGNED; |
234 ARRAYCOPY_ATOMIC | ARRAYCOPY_ALIGNED; |
235 |
235 |
236 // The HasDecorator trait can help at compile-time determining whether a decorator set |
236 // The HasDecorator trait can help at compile-time determining whether a decorator set |
237 // has an intersection with a certain other decorator set |
237 // has an intersection with a certain other decorator set |