Search in sources :

Example 46 with Log

use of com.oracle.svm.core.log.Log 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 47 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class GarbageCollectorManagementFactory method collectOperation.

/**
 * The body of the VMOperation to do the collection.
 */
@SuppressWarnings("try")
private OutOfMemoryError collectOperation(String cause, UnsignedWord requestingEpoch) {
    final Log trace = Log.noopLog().string("[GCImpl.collectOperation:").newline().string("  epoch: ").unsigned(getCollectionEpoch()).string("  cause: ").string(cause).string("  requestingEpoch: ").unsigned(requestingEpoch).newline();
    VMOperation.guaranteeInProgress("Collection should be a VMOperation.");
    /* if there has been a collection since the requesting epoch, then just return. */
    if (getCollectionEpoch().aboveThan(requestingEpoch)) {
        trace.string("  epoch has moved on]").newline();
        return null;
    }
    /* Stop the mutator timer. */
    mutatorTimer.close();
    /* Note that a collection is in progress, or exit if one is already in progress. */
    startCollectionOrExit();
    /* Reset things for this collection. */
    resetTimers();
    incrementCollectionEpoch();
    /* Flush chunks from thread-local lists to global lists. */
    ThreadLocalAllocation.disableThreadLocalAllocation();
    /* Report the heap before the collection. */
    printGCBefore(cause);
    /* Scrub the lists I maintain, before the collection. */
    scrubLists();
    /* Run any collection watchers before the collection. */
    visitWatchersBefore();
    /* Collect. */
    try {
        collectImpl(cause);
    } catch (Throwable t) {
        /* Exceptions during collections are fatal. */
        throw VMError.shouldNotReachHere(t);
    }
    /* Check if out of memory. */
    final OutOfMemoryError result = checkIfOutOfMemory();
    /* Run any collection watchers after the collection. */
    visitWatchersAfter();
    /* Reset for the next collection. */
    HeapPolicy.bytesAllocatedSinceLastCollection.set(WordFactory.zero());
    /* Print the heap after the collection. */
    printGCAfter(cause);
    /* Note that the collection is finished. */
    finishCollection();
    /* Start the mutator timer. */
    mutatorTimer.open();
    trace.string("]").newline();
    return result;
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 48 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class GarbageCollectorManagementFactory method promoteAllPinnedObjects.

@SuppressWarnings("try")
private void promoteAllPinnedObjects() {
    final Log trace = Log.noopLog().string("[GCImpl.promoteAllPinnedObjects:").newline();
    try (Timer ppot = promotePinnedObjectsTimer.open()) {
        promoteIndividualPinnedObjects();
        promotePinnedAllocatorObjects(completeCollection);
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 49 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class GarbageCollectorManagementFactory method promotePinnedAllocatorObjects.

private static void promotePinnedAllocatorObjects(final boolean completeCollection) {
    final Log trace = Log.noopLog().string("[GCImpl.promotePinnedAllocatorObjects:").newline();
    final HeapImpl heap = HeapImpl.getHeapImpl();
    final OldGeneration oldGeneration = heap.getOldGeneration();
    oldGeneration.promotePinnedAllocatorChunks(completeCollection);
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 50 with Log

use of com.oracle.svm.core.log.Log in project graal by oracle.

the class GarbageCollectorManagementFactory method blackenBootImageRoots.

@SuppressWarnings("try")
private void blackenBootImageRoots() {
    final Log trace = Log.noopLog().string("[blackenBootImageRoots:").newline();
    try (Timer bbirt = blackenBootImageRootsTimer.open()) {
        try (GreyToBlackObjRefVisitor.Counters gtborv = greyToBlackObjRefVisitor.openCounters()) {
            /* Walk through the native image heap roots. */
            Pointer cur = Word.objectToUntrackedPointer(NativeImageInfo.firstWritableReferenceObject);
            final Pointer last = Word.objectToUntrackedPointer(NativeImageInfo.lastWritableReferenceObject);
            while (cur.belowOrEqual(last)) {
                Object obj = cur.toObject();
                if (obj != null) {
                    greyToBlackObjectVisitor.visitObjectInline(obj);
                }
                cur = LayoutEncoding.getObjectEnd(obj);
            }
        }
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) KnownIntrinsics.readCallerStackPointer(com.oracle.svm.core.snippets.KnownIntrinsics.readCallerStackPointer) Pointer(org.graalvm.word.Pointer)

Aggregations

Log (com.oracle.svm.core.log.Log)130 Pointer (org.graalvm.word.Pointer)30 UnsignedWord (org.graalvm.word.UnsignedWord)30 IsolateThread (org.graalvm.nativeimage.IsolateThread)4 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)4 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)3 CollectionWatcher (com.oracle.svm.core.heap.CollectionWatcher)3 DiscoverableReference (com.oracle.svm.core.heap.DiscoverableReference)3 XOptions (com.oracle.svm.core.option.XOptions)3 AlwaysInline (com.oracle.svm.core.annotate.AlwaysInline)2 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)2 KnownIntrinsics.readCallerStackPointer (com.oracle.svm.core.snippets.KnownIntrinsics.readCallerStackPointer)2 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)2 RestrictHeapAccess (com.oracle.svm.core.annotate.RestrictHeapAccess)1 CodeInfoQueryResult (com.oracle.svm.core.code.CodeInfoQueryResult)1 SubstrateInstalledCode (com.oracle.svm.core.deopt.SubstrateInstalledCode)1 AlignedHeader (com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader)1 UnalignedHeader (com.oracle.svm.core.genscavenge.UnalignedHeapChunk.UnalignedHeader)1 AllocationFreeList (com.oracle.svm.core.heap.AllocationFreeList)1 NoAllocationVerifier (com.oracle.svm.core.heap.NoAllocationVerifier)1