Search in sources :

Example 36 with UnsignedWord

use of org.graalvm.word.UnsignedWord 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 37 with UnsignedWord

use of org.graalvm.word.UnsignedWord 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 38 with UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class AlignedHeapChunkMemoryWalkerAccessFeature method dirtyCardForObjectOfAlignedHeapChunk.

/**
 * Dirty the card corresponding to the given Object.
 *
 * This has to be fast, because it is used by the post-write barrier.
 */
public static void dirtyCardForObjectOfAlignedHeapChunk(Object obj) {
    final AlignedHeader chunk = getEnclosingAlignedHeapChunk(obj);
    final Pointer cardTableStart = getCardTableStart(chunk);
    final UnsignedWord index = getObjectIndex(chunk, obj);
    CardTable.dirtyEntryAtIndex(cardTableStart, index);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Pointer(org.graalvm.word.Pointer)

Example 39 with UnsignedWord

use of org.graalvm.word.UnsignedWord 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 UnsignedWord

use of org.graalvm.word.UnsignedWord in project graal by oracle.

the class AlignedHeapChunkMemoryWalkerAccessFeature method getFirstObjectTableStartOffset.

/**
 * Where does the first object table start?
 */
@Fold
static UnsignedWord getFirstObjectTableStartOffset() {
    /* The first object table starts at the end of the card remembered set table. */
    final UnsignedWord cardTableLimit = getCardTableLimitOffset();
    final UnsignedWord alignment = WordFactory.unsigned(ConfigurationValues.getObjectLayout().getAlignment());
    return UnsignedUtils.roundUp(cardTableLimit, alignment);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Fold(org.graalvm.compiler.api.replacements.Fold)

Aggregations

UnsignedWord (org.graalvm.word.UnsignedWord)137 Pointer (org.graalvm.word.Pointer)43 Log (com.oracle.svm.core.log.Log)30 DynamicHub (com.oracle.svm.core.hub.DynamicHub)11 Fold (org.graalvm.compiler.api.replacements.Fold)11 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)9 Snippet (org.graalvm.compiler.api.replacements.Snippet)9 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)6 AlignedHeader (com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader)4 WordBase (org.graalvm.word.WordBase)4 AlwaysInline (com.oracle.svm.core.annotate.AlwaysInline)3 ValueInfo (com.oracle.svm.core.code.FrameInfoQueryResult.ValueInfo)3 UnalignedHeader (com.oracle.svm.core.genscavenge.UnalignedHeapChunk.UnalignedHeader)3 XOptions (com.oracle.svm.core.option.XOptions)3 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)3 ObjectLayout (com.oracle.svm.core.config.ObjectLayout)2 DeoptEntryInfopoint (com.oracle.svm.core.deopt.DeoptEntryInfopoint)2 SubstrateForeignCallTarget (com.oracle.svm.core.snippets.SubstrateForeignCallTarget)2 Infopoint (jdk.vm.ci.code.site.Infopoint)2 JavaKind (jdk.vm.ci.meta.JavaKind)2