7676 */
7777public abstract class G1WriteBarrierSnippets extends WriteBarrierSnippets implements Snippets {
7878
79- public static final LocationIdentity GC_LOG_LOCATION = NamedLocationIdentity .mutable ("GC-Log" );
80- public static final LocationIdentity GC_INDEX_LOCATION = NamedLocationIdentity .mutable ("GC-Index" );
81- public static final LocationIdentity SATB_QUEUE_MARKING_LOCATION = NamedLocationIdentity .mutable ("GC-Queue-Marking" );
82- public static final LocationIdentity SATB_QUEUE_INDEX_LOCATION = NamedLocationIdentity .mutable ("GC-Queue-Index" );
83- public static final LocationIdentity SATB_QUEUE_BUFFER_LOCATION = NamedLocationIdentity .mutable ("GC-Queue-Buffer" );
84- public static final LocationIdentity CARD_QUEUE_INDEX_LOCATION = NamedLocationIdentity .mutable ("GC-Card-Queue-Index" );
79+ public static final LocationIdentity SATB_QUEUE_MARKING_ACTIVE_LOCATION = NamedLocationIdentity .mutable ("GC-SATB-Marking-Active" );
80+ public static final LocationIdentity SATB_QUEUE_BUFFER_LOCATION = NamedLocationIdentity .mutable ("GC-SATB-Queue-Buffer" );
81+ public static final LocationIdentity SATB_QUEUE_LOG_LOCATION = NamedLocationIdentity .mutable ("GC-SATB-Queue-Log" );
82+ public static final LocationIdentity SATB_QUEUE_INDEX_LOCATION = NamedLocationIdentity .mutable ("GC-SATB-Queue-Index" );
83+
8584 public static final LocationIdentity CARD_QUEUE_BUFFER_LOCATION = NamedLocationIdentity .mutable ("GC-Card-Queue-Buffer" );
85+ public static final LocationIdentity CARD_QUEUE_LOG_LOCATION = NamedLocationIdentity .mutable ("GC-Card-Queue-Log" );
86+ public static final LocationIdentity CARD_QUEUE_INDEX_LOCATION = NamedLocationIdentity .mutable ("GC-Card-Queue-Index" );
8687
87- protected static final LocationIdentity [] KILLED_PRE_WRITE_BARRIER_STUB_LOCATIONS = new LocationIdentity []{SATB_QUEUE_INDEX_LOCATION , SATB_QUEUE_BUFFER_LOCATION , GC_LOG_LOCATION ,
88- GC_INDEX_LOCATION };
89- protected static final LocationIdentity [] KILLED_POST_WRITE_BARRIER_STUB_LOCATIONS = new LocationIdentity []{CARD_QUEUE_INDEX_LOCATION , CARD_QUEUE_BUFFER_LOCATION , GC_LOG_LOCATION ,
90- GC_INDEX_LOCATION , GC_CARD_LOCATION };
88+ protected static final LocationIdentity [] KILLED_PRE_WRITE_BARRIER_STUB_LOCATIONS = new LocationIdentity []{SATB_QUEUE_INDEX_LOCATION , SATB_QUEUE_BUFFER_LOCATION , SATB_QUEUE_LOG_LOCATION };
89+ protected static final LocationIdentity [] KILLED_POST_WRITE_BARRIER_STUB_LOCATIONS = new LocationIdentity []{CARD_QUEUE_INDEX_LOCATION , CARD_QUEUE_BUFFER_LOCATION , CARD_QUEUE_LOG_LOCATION ,
90+ GC_CARD_LOCATION };
9191
9292 public static class Counters {
9393 Counters (SnippetCounter .Group .Factory factory ) {
@@ -131,7 +131,7 @@ private void satbBarrier(Address address, Object object, Object expectedObject,
131131 Word thread = getThread ();
132132 verifyOop (object );
133133 Word field = Word .fromAddress (address );
134- byte markingValue = thread .readByte (satbQueueMarkingOffset (), SATB_QUEUE_MARKING_LOCATION );
134+ byte markingValue = thread .readByte (satbQueueMarkingActiveOffset (), SATB_QUEUE_MARKING_ACTIVE_LOCATION );
135135
136136 boolean trace = isTracingActive (traceStartCycle );
137137 int gcCycle = 0 ;
@@ -167,17 +167,14 @@ private void satbBarrier(Address address, Object object, Object expectedObject,
167167 counters .g1ExecutedPreWriteBarrierCounter .inc ();
168168 // If the thread-local SATB buffer is full issue a native call which will
169169 // initialize a new one and add the entry.
170- Word indexAddress = thread .add (satbQueueIndexOffset ());
171- Word indexValue = indexAddress .readWord (0 , SATB_QUEUE_INDEX_LOCATION );
170+ Word indexValue = thread .readWord (satbQueueIndexOffset (), SATB_QUEUE_INDEX_LOCATION );
172171 if (probability (FREQUENT_PROBABILITY , indexValue .notEqual (0 ))) {
173172 Word bufferAddress = thread .readWord (satbQueueBufferOffset (), SATB_QUEUE_BUFFER_LOCATION );
174173 Word nextIndex = indexValue .subtract (wordSize ());
175- Word logAddress = bufferAddress .add (nextIndex );
176- // Log the object to be marked as well as update the SATB's buffer next
177- // index.
178- Word previousOop = Word .objectToTrackedPointer (previousObject );
179- logAddress .writeWord (0 , previousOop , GC_LOG_LOCATION );
180- indexAddress .writeWord (0 , nextIndex , GC_INDEX_LOCATION );
174+
175+ // Log the object to be marked as well as update the SATB's buffer next index.
176+ bufferAddress .writeWord (nextIndex , Word .objectToTrackedPointer (previousObject ), SATB_QUEUE_LOG_LOCATION );
177+ thread .writeWord (satbQueueIndexOffset (), nextIndex , SATB_QUEUE_INDEX_LOCATION );
181178 } else {
182179 g1PreBarrierStub (previousObject );
183180 }
@@ -245,12 +242,11 @@ public void g1PostWriteBarrier(Address address, Object object, Object value, @Co
245242 if (probability (FREQUENT_PROBABILITY , indexValue .notEqual (0 ))) {
246243 Word bufferAddress = thread .readWord (cardQueueBufferOffset (), CARD_QUEUE_BUFFER_LOCATION );
247244 Word nextIndex = indexValue .subtract (wordSize ());
248- Word logAddress = bufferAddress .add (nextIndex );
249- Word indexAddress = thread .add (cardQueueIndexOffset ());
250- // Log the object to be scanned as well as update
251- // the card queue's next index.
252- logAddress .writeWord (0 , cardAddress , GC_LOG_LOCATION );
253- indexAddress .writeWord (0 , nextIndex , GC_INDEX_LOCATION );
245+
246+ // Log the object to be scanned as well as update the card queue's next
247+ // index.
248+ bufferAddress .writeWord (nextIndex , cardAddress , CARD_QUEUE_LOG_LOCATION );
249+ thread .writeWord (cardQueueIndexOffset (), nextIndex , CARD_QUEUE_INDEX_LOCATION );
254250 } else {
255251 g1PostBarrierStub (cardAddress );
256252 }
@@ -263,7 +259,7 @@ public void g1PostWriteBarrier(Address address, Object object, Object value, @Co
263259 @ Snippet
264260 public void g1ArrayRangePreWriteBarrier (Address address , long length , @ ConstantParameter int elementStride ) {
265261 Word thread = getThread ();
266- byte markingValue = thread .readByte (satbQueueMarkingOffset (), SATB_QUEUE_MARKING_LOCATION );
262+ byte markingValue = thread .readByte (satbQueueMarkingActiveOffset (), SATB_QUEUE_MARKING_ACTIVE_LOCATION );
267263 // If the concurrent marker is not enabled or the vector length is zero, return.
268264 if (probability (FREQUENT_PROBABILITY , markingValue == (byte ) 0 || length == 0 )) {
269265 return ;
@@ -283,10 +279,9 @@ public void g1ArrayRangePreWriteBarrier(Address address, long length, @ConstantP
283279 if (probability (FREQUENT_PROBABILITY , indexValue != 0 )) {
284280 indexValue = indexValue - wordSize ();
285281 Word logAddress = bufferAddress .add (WordFactory .unsigned (indexValue ));
286- // Log the object to be marked as well as update the SATB's buffer next index.
287- Word previousOop = Word .objectToTrackedPointer (previousObject );
288- logAddress .writeWord (0 , previousOop , GC_LOG_LOCATION );
289- indexAddress .writeWord (0 , WordFactory .unsigned (indexValue ), GC_INDEX_LOCATION );
282+ // Log the object to be marked and update the SATB's buffer next index.
283+ logAddress .writeWord (0 , Word .objectToTrackedPointer (previousObject ), SATB_QUEUE_LOG_LOCATION );
284+ indexAddress .writeWord (0 , WordFactory .unsigned (indexValue ), SATB_QUEUE_INDEX_LOCATION );
290285 } else {
291286 g1PreBarrierStub (previousObject );
292287 }
@@ -324,8 +319,8 @@ public void g1ArrayRangePostWriteBarrier(Address address, long length, @Constant
324319 Word logAddress = bufferAddress .add (WordFactory .unsigned (indexValue ));
325320 // Log the object to be scanned as well as update
326321 // the card queue's next index.
327- logAddress .writeWord (0 , cur , GC_LOG_LOCATION );
328- indexAddress .writeWord (0 , WordFactory .unsigned (indexValue ), GC_INDEX_LOCATION );
322+ logAddress .writeWord (0 , cur , CARD_QUEUE_LOG_LOCATION );
323+ indexAddress .writeWord (0 , WordFactory .unsigned (indexValue ), CARD_QUEUE_INDEX_LOCATION );
329324 } else {
330325 g1PostBarrierStub (cur );
331326 }
@@ -341,7 +336,7 @@ public void g1ArrayRangePostWriteBarrier(Address address, long length, @Constant
341336
342337 protected abstract int objectArrayIndexScale ();
343338
344- protected abstract int satbQueueMarkingOffset ();
339+ protected abstract int satbQueueMarkingActiveOffset ();
345340
346341 protected abstract int satbQueueBufferOffset ();
347342
0 commit comments