use of org.vmmagic.pragma.UninterruptibleNoWarn in project JikesRVM by JikesRVM.
the class FinalizableProcessor method scan.
/**
* {@inheritDoc} Calls ReferenceProcessor's
* processReference method for each reference and builds a new
* list of those references still active.
* <p>
* Depending on the value of <code>nursery</code>, we will either
* scan all references, or just those created since the last scan.
* <p>
* TODO parallelise this code
*
* @param nursery Scan only the newly created references
*/
@Override
@UninterruptibleNoWarn
public void scan(TraceLocal trace, boolean nursery) {
int toIndex = nursery ? nurseryIndex : 0;
for (int fromIndex = toIndex; fromIndex < maxIndex; fromIndex++) {
ObjectReference ref = table.get(fromIndex).toObjectReference();
/* Determine liveness (and forward if necessary) */
if (trace.isLive(ref)) {
table.set(toIndex++, trace.getForwardedFinalizable(ref).toAddress());
continue;
}
/* Make ready for finalize */
ref = trace.retainForFinalize(ref);
/* Add to object table */
Offset offset = Word.fromIntZeroExtend(lastReadyIndex).lsh(LOG_BYTES_IN_ADDRESS).toOffset();
Selected.Plan.get().storeObjectReference(Magic.objectAsAddress(readyForFinalize).plus(offset), ref);
lastReadyIndex = (lastReadyIndex + 1) % readyForFinalize.length;
}
nurseryIndex = maxIndex = toIndex;
/* Possible schedule finalizers to run */
Collection.scheduleFinalizerThread();
}
Aggregations