Search in sources :

Example 81 with UnsignedWord

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method getCardTableLimitOffset.

/**
 * What is the offset of the limit of the card table?
 */
@Fold
static UnsignedWord getCardTableLimitOffset() {
    final UnsignedWord tableStart = getCardTableStartOffset();
    final UnsignedWord tableSize = getCardTableSize();
    final UnsignedWord tableLimit = tableStart.add(tableSize);
    final UnsignedWord alignment = WordFactory.unsigned(ConfigurationValues.getObjectLayout().getAlignment());
    return UnsignedUtils.roundUp(tableLimit, alignment);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Fold(org.graalvm.compiler.api.replacements.Fold)

Example 82 with UnsignedWord

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method getCardTableStartOffset.

/**
 * What is the offset of the start of the card table?
 */
@Fold
static UnsignedWord getCardTableStartOffset() {
    /* The card remembered set table starts right after the header fields. */
    final UnsignedWord headerSize = getHeaderSize();
    final UnsignedWord alignment = WordFactory.unsigned(ConfigurationValues.getObjectLayout().getAlignment());
    return UnsignedUtils.roundUp(headerSize, alignment);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Fold(org.graalvm.compiler.api.replacements.Fold)

Example 83 with UnsignedWord

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method getObjectsStartOffset.

/**
 * Where do the objects start?
 */
@Fold
static UnsignedWord getObjectsStartOffset() {
    final UnsignedWord fotLimit = getFirstObjectTableLimitOffset();
    final UnsignedWord alignment = WordFactory.unsigned(ConfigurationValues.getObjectLayout().getAlignment());
    final UnsignedWord result = UnsignedUtils.roundUp(fotLimit, alignment);
    return result;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Fold(org.graalvm.compiler.api.replacements.Fold)

Example 84 with UnsignedWord

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method allocateMemory.

/**
 * Allocate memory within this AlignedHeapChunk. No initialization of the memory happens here.
 */
static Pointer allocateMemory(AlignedHeader that, UnsignedWord size) {
    Pointer result = WordFactory.nullPointer();
    final UnsignedWord available = availableObjectMemory(that);
    /* Is memory available for the requested size? */
    if (size.belowOrEqual(available)) {
        /* Returned memory is at the start, */
        result = that.getTop();
        final Pointer newTop = result.add(size);
        setTopCarefully(that, newTop);
    }
    return result;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Pointer(org.graalvm.word.Pointer)

Example 85 with UnsignedWord

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

the class AlignedHeapChunkMemoryWalkerAccessFeature method getCardTableSize.

/**
 * How big is the card table?
 */
@Fold
static UnsignedWord getCardTableSize() {
    /* How much space is there in the chunk? */
    final UnsignedWord headerSize = getHeaderSize();
    final UnsignedWord available = HeapPolicy.getAlignedHeapChunkSize().subtract(headerSize);
    /* How big should the table be? */
    final UnsignedWord requiredSize = CardTable.tableSizeForMemorySize(available);
    final UnsignedWord alignment = WordFactory.unsigned(ConfigurationValues.getObjectLayout().getAlignment());
    return UnsignedUtils.roundUp(requiredSize, 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