Search in sources :

Example 1 with DiscoverableReference

use of com.oracle.svm.core.heap.DiscoverableReference in project graal by oracle.

the class DiscoverableReferenceProcessing method clearDiscoveredReferences.

/**
 * Clear the discovered DiscoverableReference list.
 */
static void clearDiscoveredReferences() {
    final Log trace = Log.noopLog().string("[DiscoverableReference.clearDiscoveredList:").newline();
    /*
         * It's not enough to just set the discovered list to null. I also have to clean all the
         * entries from the discovered references from last time.
         */
    for (DiscoverableReference current = popDiscoveredReference(); current != null; current = popDiscoveredReference()) {
        trace.string("  current: ").object(current).string("  referent: ").hex(current.getReferentPointer()).newline();
        current.clean();
    }
    setDiscoveredList(null);
    trace.string("]");
}
Also used : Log(com.oracle.svm.core.log.Log) DiscoverableReference(com.oracle.svm.core.heap.DiscoverableReference)

Example 2 with DiscoverableReference

use of com.oracle.svm.core.heap.DiscoverableReference in project graal by oracle.

the class DiscoverableReferenceProcessing method popDiscoveredReference.

/**
 * Pop the first element off the discovered references list.
 */
private static DiscoverableReference popDiscoveredReference() {
    final DiscoverableReference result = getDiscoveredList();
    if (result != null) {
        setDiscoveredList(result.getNextDiscoverableReference());
        result.clean();
    }
    return result;
}
Also used : DiscoverableReference(com.oracle.svm.core.heap.DiscoverableReference)

Example 3 with DiscoverableReference

use of com.oracle.svm.core.heap.DiscoverableReference in project graal by oracle.

the class DiscoverableReferenceProcessing method processDiscoveredReferences.

/**
 * Scrub the list of entries whose referent is in the old space.
 */
static void processDiscoveredReferences() {
    final Log trace = Log.noopLog().string("[DiscoverableReference.processDiscoveredReferences: ").string("  discoveredList: ").object(getDiscoveredList()).newline();
    /* Start a new list. */
    DiscoverableReference newList = null;
    for (DiscoverableReference current = popDiscoveredReference(); current != null; current = popDiscoveredReference()) {
        trace.string("  [current: ").object(current).string("  referent before: ").hex(current.getReferentPointer()).string("]").newline();
        /*
             * The referent *has not* been processed as a grey reference, so I have to be careful
             * about looking through the referent field.
             */
        if (!processReferent(current)) {
            /* The referent isn't live: put it on the new list. */
            trace.string("  unpromoted current: ").object(current).newline();
            newList = current.prependToDiscoveredReference(newList);
        } else {
            /* Referent did get promoted: don't add it to the new list. */
            trace.string("  promoted current: ").object(current).newline();
        }
    }
    setDiscoveredList(newList);
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log) DiscoverableReference(com.oracle.svm.core.heap.DiscoverableReference)

Example 4 with DiscoverableReference

use of com.oracle.svm.core.heap.DiscoverableReference in project graal by oracle.

the class DiscoverableReferenceProcessing method discoverDiscoverableReference.

/*
     * Public methods for collectors.
     */
public static void discoverDiscoverableReference(Object object) {
    final Log trace = Log.noopLog();
    /* TODO: What's the cost of this type test, since o will be a concrete subtype? */
    Object obj = KnownIntrinsics.convertUnknownValue(object, Object.class);
    if (obj instanceof DiscoverableReference) {
        /* Add this DiscoverableReference to the discovered list. */
        final DiscoverableReference dr = (DiscoverableReference) obj;
        trace.string("[DiscoverableReference.discoverDiscoverableReference:");
        trace.string("  dr: ").object(dr).string("  referent: ").hex(DiscoverableReference.TestingBackDoor.getReferentPointer(dr)).string("]").newline();
        addToDiscoveredReferences(dr);
    }
}
Also used : Log(com.oracle.svm.core.log.Log) DiscoverableReference(com.oracle.svm.core.heap.DiscoverableReference)

Example 5 with DiscoverableReference

use of com.oracle.svm.core.heap.DiscoverableReference in project graal by oracle.

the class HeapVerifierImpl method verifyDiscoverableReference.

private static boolean verifyDiscoverableReference(Object object) {
    boolean result = true;
    Object obj = KnownIntrinsics.convertUnknownValue(object, Object.class);
    if (obj instanceof DiscoverableReference) {
        final DiscoverableReference dr = (DiscoverableReference) obj;
        result = DiscoverableReferenceProcessing.verify(dr);
    }
    return result;
}
Also used : DiscoverableReference(com.oracle.svm.core.heap.DiscoverableReference)

Aggregations

DiscoverableReference (com.oracle.svm.core.heap.DiscoverableReference)5 Log (com.oracle.svm.core.log.Log)3