Search in sources :

Example 56 with Log

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

the class GarbageCollectorManagementFactory method promoteIndividualPinnedObjects.

private static void promoteIndividualPinnedObjects() {
    final Log trace = Log.noopLog().string("[GCImpl.promoteIndividualPinnedObjects:").newline();
    /* Capture the PinnedObject list and start a new one. */
    final PinnedObjectImpl oldList = PinnedObjectImpl.claimPinnedObjectList();
    /* Walk the list, dealing with the open PinnedObjects. */
    PinnedObjectImpl rest = oldList;
    while (rest != null) {
        final PinnedObjectImpl first = rest;
        final PinnedObjectImpl next = first.getNext();
        if (first.isOpen()) {
            /* Promote the chunk with the object, and put this PinnedObject on the new list. */
            promotePinnedObject(first);
            /* Pushing onto the new list reverses the order of the list. */
            PinnedObjectImpl.pushPinnedObject(first);
        }
        rest = next;
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 57 with Log

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

the class HeapVerifierImpl method noReferencesToForwardedObjectsVerifier.

/* Look for objects with forwarded headers. */
private boolean noReferencesToForwardedObjectsVerifier(Object obj) {
    final Log trace = getTraceLog();
    trace.string("[HeapVerifierImpl.noReferencesToForwardedObjectsVerifier:");
    trace.string("  obj: ").object(obj);
    final UnsignedWord header = ObjectHeaderImpl.readHeaderFromObjectCarefully(obj);
    trace.string("  header: ").hex(header);
    final Pointer objPointer = Word.objectToUntrackedPointer(obj);
    trace.string("  objPointer: ").hex(objPointer);
    boolean result = InteriorObjRefWalker.walkObject(obj, noReferencesToForwardedObjectsVisitor);
    if (!result) {
        try (Log witness = getWitnessLog()) {
            witness.string("[HeapVerifierImpl.noReferencesToForwardedObjectsVerifier:").string("  cause: ").string(getCause()).string("  obj: ").object(obj).string("]").newline();
        }
    }
    trace.string("]").newline();
    return result;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord) Pointer(org.graalvm.word.Pointer)

Example 58 with Log

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

the class HeapVerifierImpl method noReferencesOutsideHeap.

/**
 * For debugging: look for objects with interior references to outside the heap.
 *
 * That includes: references that are to zapped objects, and references that aren't to the heap.
 */
private boolean noReferencesOutsideHeap(Object obj) {
    final Log trace = getTraceLog();
    trace.string("[HeapVerifierImpl.noReferencesToZappedObjectsVerifier:");
    trace.string("  obj: ").object(obj).string("  obj.getClass: ").string(obj.getClass().getName());
    final ObjectHeaderImpl ohi = ObjectHeaderImpl.getObjectHeaderImpl();
    final UnsignedWord header = ObjectHeaderImpl.readHeaderFromObjectCarefully(obj);
    trace.string("  header: ").hex(header).string("  objectHeader: ").string(ohi.toStringFromObject(obj));
    final Pointer objPointer = Word.objectToUntrackedPointer(obj);
    trace.string("  objPointer: ").hex(objPointer);
    boolean result = InteriorObjRefWalker.walkObject(obj, noReferencesOutsideHeapVisitor);
    if (!result) {
        try (Log witness = getWitnessLog()) {
            witness.string("[HeapVerifierImpl.noReferencesOutsideHeap:").string("  cause: ").string(getCause());
            witness.string("  obj: ").string(obj.getClass().getName()).string("@").hex(objPointer);
            witness.string("  header: ").hex(header).string("  objectHeader: ").string(ohi.toStringFromObject(obj)).string("]").newline();
        }
    }
    trace.string("  returns: ").bool(result).string("]").newline();
    return result;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord) Pointer(org.graalvm.word.Pointer)

Example 59 with Log

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

the class OldGeneration method distributePinnedChunks.

private void distributePinnedChunks(boolean completeCollection) {
    final Log trace = Log.noopLog().string("[OldGeneration.distributePinnedChunks:").string("  completeCollection: ").bool(completeCollection);
    final Space unpinnedSpace = (completeCollection ? getFromSpace() : getToSpace());
    trace.string("  unpinnedSpace: ").string(unpinnedSpace.getName());
    distributePinnedAlignedChunks(getPinnedToSpace(), unpinnedSpace);
    distributePinnedUnalignedChunks(getPinnedToSpace(), unpinnedSpace);
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 60 with Log

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

the class OldGeneration method promoteUnalignedObjectChunk.

private Object promoteUnalignedObjectChunk(Object original) {
    final Log trace = Log.noopLog().string("[OldGeneration.promoteUnalignedObjectChunk:").string("  original: ").object(original);
    assert ObjectHeaderImpl.getObjectHeaderImpl().isUnalignedObject(original);
    final UnalignedHeapChunk.UnalignedHeader uChunk = UnalignedHeapChunk.getEnclosingUnalignedHeapChunk(original);
    final Space originalSpace = uChunk.getSpace();
    trace.string("  originalSpace: ").string(originalSpace.getName());
    if (shouldPromoteFrom(originalSpace)) {
        trace.string("  promoting");
        /*
             * Since the object does not move when an UnalignedChunk is promoted, there is no need
             * to return a possible copy.
             */
        if (HeapOptions.TraceObjectPromotion.getValue()) {
            final Log promotionTrace = Log.log().string("[OldGeneration.promoteUnalignedObjectChunk:").string("  original: ").object(original);
            final UnsignedWord size = LayoutEncoding.getSizeFromObject(original);
            promotionTrace.string("  size: ").unsigned(size).string("]").newline();
        }
        getToSpace().promoteUnalignedHeapChunk(uChunk);
    } else {
        trace.string("  not promoting");
    }
    trace.string("  returns: ").object(original);
    if (trace.isEnabled()) {
        final UnalignedHeapChunk.UnalignedHeader resultChunk = UnalignedHeapChunk.getEnclosingUnalignedHeapChunk(original);
        final Space resultSpace = resultChunk.getSpace();
        trace.string("  resultSpace: ").string(resultSpace.getName());
    }
    trace.string("]").newline();
    return original;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord)

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