Search in sources :

Example 91 with Log

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

the class GarbageCollectorManagementFactory method scanGreyObjects.

@SuppressWarnings("try")
private void scanGreyObjects() {
    final Log trace = Log.noopLog().string("[GCImpl.scanGreyObjects").newline();
    final HeapImpl heap = HeapImpl.getHeapImpl();
    final OldGeneration oldGen = heap.getOldGeneration();
    try (Timer sgot = scanGreyObjectsTimer.open()) {
        oldGen.scanGreyObjects();
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 92 with Log

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

the class GarbageCollectorManagementFactory method cheneyScanFromDirtyRoots.

@SuppressWarnings("try")
private void cheneyScanFromDirtyRoots() {
    final Log trace = Log.noopLog().string("[GCImpl.cheneyScanFromDirtyRoots:").newline();
    final HeapImpl heap = HeapImpl.getHeapImpl();
    final OldGeneration oldGen = heap.getOldGeneration();
    /*
         * Move all the chunks in fromSpace to toSpace. That does not make those chunks grey, so I
         * have to use the dirty cards marks to blacken them, but that's what card marks are for.
         */
    try (Timer csfdrt = cheneyScanFromDirtyRootsTimer.open()) {
        oldGen.emptyFromSpaceIntoToSpace();
        /* Prepare to use the GreyToBlack visitors. */
        final boolean objectVisitorPrologue = greyToBlackObjectVisitor.prologue();
        assert objectVisitorPrologue : "greyToBlackObjectVisitor prologue fails";
        final boolean objRefVisitorPrologue = greyToBlackObjRefVisitor.prologue();
        assert objRefVisitorPrologue : "greyToBlackObjRefVisitor prologue fails";
        /* Take a snapshot of the heap so that I can visit all the promoted Objects. */
        /*
             * Debugging tip: I could move the taking of the snapshot and the scanning of grey
             * Objects into each of the blackening methods, or even put them around individual
             * Object reference visits.
             */
        prepareForPromotion();
        /*
             * Make sure all chunks with pinned Objects are in pinned toSpace, and any released
             * objects are in toSpace (because this is an incremental collection). I do this before
             * blackening any roots to make sure the Objects in pinned chunks are moved as chunks,
             * not promoted by roots as individual objects. This makes the objects in those chunks
             * grey.
             */
        promoteAllPinnedObjects();
        /*
             * Blacken Objects that are dirty roots. There are dirty cards in ToSpace and
             * PinnedToSpace. Do this early so I don't have to walk the cards of individually
             * promoted objects, which will be visited by the grey object scanner.
             */
        blackenDirtyCardRoots();
        /*
             * Stack references are grey at the beginning of a collection, so I need to blacken
             * them.
             */
        blackenStackRoots();
        /* Custom memory regions which contain object references. */
        walkRegisteredObjectReferences();
        /*
             * Native image Objects are grey at the beginning of a collection, so I need to blacken
             * them.
             */
        blackenBootImageRoots();
        /* Visit all the Objects promoted since the snapshot, transitively. */
        scanGreyObjects();
        /* Reset the GreyToBlackVisitors. */
        final boolean objRefVisitorEpilogue = greyToBlackObjRefVisitor.epilogue();
        assert objRefVisitorEpilogue : "greyToBlackObjRefVisitor epilogue fails";
        final boolean objectVisitorEpilogue = greyToBlackObjectVisitor.epilogue();
        assert objectVisitorEpilogue : "greyToBlackObjectVisitor epilogue fails";
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 93 with Log

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

the class GarbageCollectorManagementFactory method cheneyScanFromRoots.

@SuppressWarnings("try")
private void cheneyScanFromRoots() {
    final Log trace = Log.noopLog().string("[GCImpl.cheneyScanFromRoots:").newline();
    try (Timer csfrt = cheneyScanFromRootsTimer.open()) {
        /* Prepare to use the GreyToBlack visitors. */
        final boolean objectVisitorPrologue = greyToBlackObjectVisitor.prologue();
        assert objectVisitorPrologue : "greyToBlackObjectVisitor prologue fails";
        final boolean objRefVisitorPrologue = greyToBlackObjRefVisitor.prologue();
        assert objRefVisitorPrologue : "greyToBlackObjRefVisitor prologue fails";
        /* Take a snapshot of the heap so that I can visit all the promoted Objects. */
        /*
             * Debugging tip: I could move the taking of the snapshot and the scanning of grey
             * Objects into each of the blackening methods, or even put them around individual
             * Object reference visits.
             */
        prepareForPromotion();
        /*
             * Make sure all chunks with pinned objects are in toSpace, and any formerly pinned
             * objects are in fromSpace.
             */
        promoteAllPinnedObjects();
        /*
             * Stack references are grey at the beginning of a collection, so I need to blacken
             * them.
             */
        blackenStackRoots();
        /* Custom memory regions which contain object references. */
        walkRegisteredObjectReferences();
        /*
             * Native image Objects are grey at the beginning of a collection, so I need to blacken
             * them.
             */
        blackenBootImageRoots();
        /* Visit all the Objects promoted since the snapshot. */
        scanGreyObjects();
        /* Reset the GreyToBlackVisitors. */
        final boolean objRefVisitorEpilogue = greyToBlackObjRefVisitor.epilogue();
        assert objRefVisitorEpilogue : "greyToBlackObjRefVisitor epilogue fails";
        final boolean objectVisitorEpilogue = greyToBlackObjectVisitor.epilogue();
        assert objectVisitorEpilogue : "greyToBlackObjectVisitor epilogue fails";
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 94 with Log

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

the class GarbageCollectorManagementFactory method blackenDirtyCardRoots.

@SuppressWarnings("try")
private void blackenDirtyCardRoots() {
    final Log trace = Log.noopLog().string("[GCImpl.blackenDirtyCardRoots:").newline();
    try (Timer bdcrt = blackenDirtyCardRootsTimer.open()) {
        /*
             * Walk To-Space looking for dirty cards, and within those for old-to-young pointers.
             * Promote any referenced young objects.
             */
        final HeapImpl heap = HeapImpl.getHeapImpl();
        final OldGeneration oldGen = heap.getOldGeneration();
        oldGen.walkDirtyObjects(greyToBlackObjectVisitor, true);
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 95 with Log

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

the class GarbageCollectorManagementFactory method blackenStackRoots.

@SuppressWarnings("try")
private void blackenStackRoots() {
    final Log trace = Log.noopLog().string("[GCImpl.blackenStackRoots:").newline();
    try (Timer bsr = blackenStackRootsTimer.open()) {
        Pointer sp = readCallerStackPointer();
        trace.string("[blackenStackRoots:").string("  sp: ").hex(sp);
        CodePointer ip = readReturnAddress();
        trace.string("  ip: ").hex(ip).newline();
        JavaStackWalker.walkCurrentThread(sp, ip, frameWalker);
        if (SubstrateOptions.MultiThreaded.getValue()) {
            /*
                 * Scan the stacks of all the threads. Other threads will be blocked at a safepoint
                 * (or in native code) so they will each have a JavaFrameAnchor in their VMThread.
                 */
            for (IsolateThread vmThread = VMThreads.firstThread(); VMThreads.isNonNullThread(vmThread); vmThread = VMThreads.nextThread(vmThread)) {
                if (vmThread == CEntryPointContext.getCurrentIsolateThread()) {
                    /*
                         * The current thread is already scanned by code above, so we do not have to
                         * do anything for it here. It might have a JavaFrameAnchor from earlier
                         * Java-to-C transitions, but certainly not at the top of the stack since it
                         * is running this code, so just this scan would be incomplete.
                         */
                    continue;
                }
                JavaStackWalker.walkThread(vmThread, frameWalker);
                trace.newline();
            }
        }
        trace.string("]").newline();
    }
    trace.string("]").newline();
}
Also used : IsolateThread(org.graalvm.nativeimage.IsolateThread) 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) CodePointer(org.graalvm.nativeimage.c.function.CodePointer)

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