Search in sources :

Example 1 with UninterruptibleNoWarn

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();
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) UninterruptibleNoWarn(org.vmmagic.pragma.UninterruptibleNoWarn)

Aggregations

UninterruptibleNoWarn (org.vmmagic.pragma.UninterruptibleNoWarn)1 ObjectReference (org.vmmagic.unboxed.ObjectReference)1 Offset (org.vmmagic.unboxed.Offset)1