Search in sources :

Example 61 with Log

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

the class OldGeneration method distributePinnedAlignedChunks.

private void distributePinnedAlignedChunks(Space pinnedSpace, Space unpinnedSpace) {
    final Log trace = Log.noopLog().string("[OldGeneration.distributePinnedAlignedChunks:");
    AlignedHeapChunk.AlignedHeader aChunk = getPinnedFromSpace().getFirstAlignedHeapChunk();
    while (aChunk.isNonNull()) {
        trace.newline();
        /* Set up for the next iteration. */
        final AlignedHeapChunk.AlignedHeader next = aChunk.getNext();
        /* Move the chunk to pinned toSpace or the unpinned space. */
        getPinnedFromSpace().extractAlignedHeapChunk(aChunk);
        if (aChunk.getPinned()) {
            /* Clean up for the next collection. */
            aChunk.setPinned(false);
            trace.string("  to pinned space");
            pinnedSpace.appendAlignedHeapChunk(aChunk);
        } else {
            trace.string("  to unpinned space");
            unpinnedSpace.appendAlignedHeapChunk(aChunk);
        }
        /* Advance to the next chunk. */
        aChunk = next;
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 62 with Log

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

the class OldGeneration method promoteAlignedObject.

private Object promoteAlignedObject(Object original) {
    final Log trace = Log.noopLog().string("[OldGeneration.promoteAlignedObject:").string("  original: ").object(original);
    assert ObjectHeaderImpl.getObjectHeaderImpl().isAlignedObject(original);
    final AlignedHeapChunk.AlignedHeader originalChunk = AlignedHeapChunk.getEnclosingAlignedHeapChunk(original);
    final Space originalSpace = originalChunk.getSpace();
    trace.string("  originalSpace: ").string(originalSpace.getName());
    Object result = original;
    if (shouldPromoteFrom(originalSpace)) {
        trace.string("  promoting");
        if (HeapOptions.TraceObjectPromotion.getValue()) {
            final Log promotionTrace = Log.log().string("[OldGeneration.promoteAlignedObject:").string("  original: ").object(original);
            final UnsignedWord size = LayoutEncoding.getSizeFromObject(original);
            promotionTrace.string("  size: ").unsigned(size).string("]").newline();
        }
        result = getToSpace().promoteAlignedObject(original);
    } else {
        trace.string("  not promoting");
    }
    trace.string("  returns: ").object(result);
    if (trace.isEnabled()) {
        final AlignedHeapChunk.AlignedHeader resultChunk = AlignedHeapChunk.getEnclosingAlignedHeapChunk(result);
        final Space resultSpace = resultChunk.getSpace();
        trace.string("  resultSpace: ").string(resultSpace.getName());
    }
    trace.string("]").newline();
    return result;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord)

Example 63 with Log

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

the class PinnedObjectImpl method claimPinnedObjectList.

/**
 * Claim the entire list. Only called once during each collection, but it uses getAndSet(null)
 * anyway so I do not have to worry about it.
 */
public static PinnedObjectImpl claimPinnedObjectList() {
    final Log trace = Log.noopLog().string("[PinnedObject.claimPinnedObjectList:").newline();
    final HeapImpl heap = HeapImpl.getHeapImpl();
    final AtomicReference<PinnedObjectImpl> pinHead = heap.getPinHead();
    final PinnedObjectImpl result = pinHead.getAndSet(null);
    trace.string("  returns: ").object(result);
    return result;
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 64 with Log

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

the class Space method promoteUnalignedHeapChunk.

/**
 * Promote an UnalignedHeapChunk by moving it to this Space, if necessary.
 */
boolean promoteUnalignedHeapChunk(UnalignedHeapChunk.UnalignedHeader uChunk) {
    final Log trace = Log.noopLog().string("[SpaceImpl.promoteCardRememberedSetUnalignedObjectChunk:");
    trace.string("  uChunk: ").hex(uChunk);
    final Space originalSpace = uChunk.getSpace();
    final boolean promote = (this != originalSpace);
    if (promote) {
        originalSpace.extractUnalignedHeapChunk(uChunk);
        appendUnalignedHeapChunk(uChunk);
        /*
             * If the original chunk is from the young space, then it doesn't have a remembered set,
             * so build one.
             */
        if (HeapImpl.getHeapImpl().isYoungGeneration(originalSpace)) {
            trace.string("  setting up remembered set");
            UnalignedHeapChunk.setUpRememberedSetOfUnalignedHeapChunk(uChunk);
        }
    }
    trace.string("  returns: ").bool(promote).string("]").newline();
    return promote;
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 65 with Log

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

the class Space method appendAlignedHeapChunk.

/*
     * HeapChunk list manipulation methods.
     *
     * There are two sets of methods, for aligned and unaligned heap chunk arguments.
     */
/**
 * Append the argument AlignedHeapChunk to the doubly-linked list of AlignedHeapChunks.
 */
void appendAlignedHeapChunk(AlignedHeapChunk.AlignedHeader aChunk) {
    /*
         * This method is used from {@link PosixJavaThreads#detachThread(VMThread)}, so it can not
         * guarantee that it is inside a VMOperation, only that there is some mutual exclusion.
         */
    if (SubstrateOptions.MultiThreaded.getValue()) {
        VMThreads.THREAD_MUTEX.guaranteeIsLocked("Trying to append an aligned heap chunk but no mutual exclusion.");
    }
    final Log trace = Log.noopLog().string("[SpaceImpl.appendAlignedHeapChunk:").newline();
    if (trace.isEnabled()) {
        trace.string("  before space: ").string(getName()).string("  first: ").hex(getFirstAlignedHeapChunk()).string("  last: ").hex(getLastAlignedHeapChunk()).newline();
        trace.string("  before chunk: ").hex(aChunk).string("  .space: ").object(aChunk.getSpace());
        trace.string("  .previous: ").hex(aChunk.getPrevious()).string("  .next: ").hex(aChunk.getNext()).newline();
    }
    appendAlignedHeapChunkUninterruptibly(aChunk);
    getAccounting().noteAlignedHeapChunk(AlignedHeapChunk.committedObjectMemoryOfAlignedHeapChunk(aChunk));
    if (trace.isEnabled()) {
        trace.string("  after  space: ").string(getName()).string("  first: ").hex(getFirstAlignedHeapChunk()).string("  last: ").hex(getLastAlignedHeapChunk()).newline();
        trace.string("  after  chunk: ").hex(aChunk).hex(aChunk).string("  space: ").string(aChunk.getSpace().getName());
        trace.string("  .previous: ").hex(aChunk.getPrevious()).string("  .next: ").hex(aChunk.getNext()).newline();
        trace.string("]").newline();
    }
}
Also used : Log(com.oracle.svm.core.log.Log)

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