Search in sources :

Example 36 with Log

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

the class Target_java_lang_Runtime method verifyBeforeGC.

void verifyBeforeGC(String cause, UnsignedWord epoch) {
    final Log trace = Log.noopLog().string("[HeapImpl.verifyBeforeGC:");
    trace.string("  getVerifyHeapBeforeGC(): ").bool(getVerifyHeapBeforeGC()).string("  heapVerifier: ").object(heapVerifier);
    trace.string("  getVerifyStackBeforeGC(): ").bool(getVerifyStackBeforeGC()).string("  stackVerifier: ").object(stackVerifier);
    if (getVerifyHeapBeforeGC()) {
        assert heapVerifier != null : "No heap verifier!";
        if (!heapVerifier.verifyOperation("before collection", HeapVerifier.Occasion.BEFORE_COLLECTION)) {
            Log.log().string("[HeapImpl.verifyBeforeGC:").string("  cause: ").string(cause).string("  heap fails to verify before epoch: ").unsigned(epoch).string("]").newline();
            assert false;
        }
    }
    if (getVerifyStackBeforeGC()) {
        assert stackVerifier != null : "No stack verifier!";
        if (!stackVerifier.verifyInAllThreads(KnownIntrinsics.readCallerStackPointer(), KnownIntrinsics.readReturnAddress(), "before collection")) {
            Log.log().string("[HeapImpl.verifyBeforeGC:").string("  cause: ").string(cause).string("  stack fails to verify epoch: ").unsigned(epoch).string("]").newline();
            assert false;
        }
    }
    trace.string("]").newline();
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 37 with Log

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

the class HeapPolicy method setMaximumHeapSize.

/**
 * Set the maximum heap size, returning the previous value.
 */
public static UnsignedWord setMaximumHeapSize(UnsignedWord value) {
    final Log trace = Log.noopLog().string("[HeapPolicy.setMaximumHeapSize:");
    final UnsignedWord result = maximumHeapSize;
    maximumHeapSize = value;
    trace.string("  old: ").unsigned(result).string("  new: ").unsigned(maximumHeapSize).string(" ]").newline();
    return result;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord)

Example 38 with Log

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

the class HeapPolicy method getMinimumHeapSize.

/**
 * The minimum size of the heap as an UnsignedWord.
 */
public static UnsignedWord getMinimumHeapSize() {
    final Log trace = Log.noopLog().string("[HeapPolicy.getMinimumHeapSize:");
    if (minimumHeapSize.aboveThan(Word.zero())) {
        /* If someone has set the minimum heap size, use that value. */
        trace.string("  returns: ").unsigned(minimumHeapSize).string(" ]").newline();
        return minimumHeapSize;
    }
    final XOptions.XFlag xms = XOptions.getXms();
    UnsignedWord result;
    if (xms.getEpoch() > 0) {
        /* If `-Xms` has been parsed from the command line, use that value. */
        result = WordFactory.unsigned(xms.getValue());
    } else {
        /* A default value chosen to delay the first full collection. */
        result = getMaximumYoungGenerationSize().multiply(2);
    }
    /* But not larger than -Xmx. */
    if (result.aboveThan(getMaximumHeapSize())) {
        result = getMaximumHeapSize();
    }
    minimumHeapSize = result;
    trace.string("  -Xms.epoch: ").unsigned(xms.getEpoch()).string("  -Xms.value: ").unsigned(xms.getValue()).string("  returns: ").unsigned(result).string("]").newline();
    return result;
}
Also used : XOptions(com.oracle.svm.core.option.XOptions) Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord)

Example 39 with Log

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method verifyOnlyCleanCards.

/**
 * Verify that there are only clean cards for the given chunk.
 */
static boolean verifyOnlyCleanCards(AlignedHeader that) {
    final Log trace = Log.noopLog().string("[AlignedHeapChunk.verifyOnlyCleanCards:");
    trace.string("  that: ").hex(that);
    boolean result = true;
    /* Iterate through the cards looking for dirty cards. */
    final Pointer cardTableStart = getCardTableStart(that);
    final Pointer objectsStart = getAlignedHeapChunkStart(that);
    final Pointer objectsLimit = that.getTop();
    final UnsignedWord memorySize = objectsLimit.subtract(objectsStart);
    final UnsignedWord indexLimit = CardTable.indexLimitForMemorySize(memorySize);
    trace.string("  objectsStart: ").hex(objectsStart).string("  objectsLimit: ").hex(objectsLimit).string("  indexLimit: ").unsigned(indexLimit);
    for (UnsignedWord index = WordFactory.zero(); index.belowThan(indexLimit); index = index.add(1)) {
        if (CardTable.isDirtyEntryAtIndex(cardTableStart, index)) {
            result = false;
            final Log witness = Log.log().string("[AlignedHeapChunk.verifyOnlyCleanCards:");
            witness.string("  that: ").hex(that).string("  dirty card at index: ").unsigned(index).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 40 with Log

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method verifyHeaders.

/**
 * Verify that all the objects have headers that say they are aligned.
 */
private static boolean verifyHeaders(AlignedHeader that) {
    final Log trace = Log.noopLog().string("[AlignedHeapChunk.verifyHeaders: ").string("  that: ").hex(that);
    /* Get the Object at the offset, or null. */
    Pointer current = getAlignedHeapChunkStart(that);
    while (current.belowThan(that.getTop())) {
        trace.newline().string("  current: ").hex(current);
        final UnsignedWord header = ObjectHeader.readHeaderFromPointer(current);
        if (!ObjectHeaderImpl.getObjectHeaderImpl().isAlignedHeader(header)) {
            trace.string("  does not have an aligned header: ").hex(header).string("  returns: false").string("]").newline();
            return false;
        }
        /*
             * Step over the object. This does not deal with forwarded objects, but I have already
             * checked that the header is an aligned header.
             */
        current = LayoutEncoding.getObjectEnd(current.toObject());
    }
    trace.string("  returns: true]").newline();
    return true;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord) 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