Search in sources :

Example 46 with UnsignedWord

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

the class FirstObjectTable method getTableSizeForMemorySize.

/**
 * Given the size of a memory block, how big is the table to cover it?
 */
private static UnsignedWord getTableSizeForMemorySize(UnsignedWord memorySize) {
    final UnsignedWord roundedMemory = UnsignedUtils.roundUp(memorySize, WordFactory.unsigned(MEMORY_BYTES_PER_ENTRY));
    final UnsignedWord index = FirstObjectTable.memoryOffsetToIndex(roundedMemory);
    return index.multiply(ENTRY_BYTES);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 47 with UnsignedWord

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

the class FirstObjectTable method memoryOffsetAndLengthCrossesCard.

/**
 * Does this offset and length cross a card?
 */
private static boolean memoryOffsetAndLengthCrossesCard(UnsignedWord offset, UnsignedWord length) {
    final UnsignedWord startCard = memoryOffsetToIndex(offset);
    final UnsignedWord endCard = memoryOffsetToIndex(offset.add(length).subtract(1));
    return startCard.belowThan(endCard);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 48 with UnsignedWord

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

the class GarbageCollectorManagementFactory method checkIfOutOfMemory.

private OutOfMemoryError checkIfOutOfMemory() {
    OutOfMemoryError result = null;
    final UnsignedWord allowed = HeapPolicy.getMaximumHeapSize();
    /* Only the old generation has objects in it because the young generation is empty. */
    final UnsignedWord inUse = getAccounting().getOldGenerationAfterChunkBytes();
    if (allowed.belowThan(inUse)) {
        result = oldGenerationSizeExceeded;
    }
    return result;
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord)

Example 49 with UnsignedWord

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

the class GarbageCollectorManagementFactory method printGCSummary.

@Override
public void printGCSummary() {
    final Log log = Log.log();
    final String prefix = "PrintGCSummary: ";
    /* Print GC configuration. */
    log.string(prefix).string("YoungGenerationSize: ").unsigned(HeapPolicy.getMaximumYoungGenerationSize()).newline();
    log.string(prefix).string("MinimumHeapSize: ").unsigned(HeapPolicy.getMinimumHeapSize()).newline();
    log.string(prefix).string("MaximumHeapSize: ").unsigned(HeapPolicy.getMaximumHeapSize()).newline();
    log.string(prefix).string("AlignedChunkSize: ").unsigned(HeapPolicy.getAlignedHeapChunkSize()).newline();
    /* Add in any young and pinned objects allocated since the last collection. */
    VMOperation.enqueueBlockingSafepoint("PrintGCSummaryShutdownHook", ThreadLocalAllocation::disableThreadLocalAllocation);
    final HeapImpl heap = HeapImpl.getHeapImpl();
    final Space youngSpace = heap.getYoungGeneration().getSpace();
    final UnsignedWord youngChunkBytes = youngSpace.getChunkBytes();
    final UnsignedWord youngObjectBytes = youngSpace.getObjectBytes();
    final Space pinnedSpace = heap.getOldGeneration().getPinnedFromSpace();
    final UnsignedWord pinnedChunkBytes = pinnedSpace.getChunkBytes().subtract(accounting.getPinnedChunkBytesAfter());
    final UnsignedWord pinnedObjectBytes = pinnedSpace.getObjectBytes().subtract(accounting.getPinnedObjectBytesAfter());
    /* Compute updated values. */
    final UnsignedWord allocatedNormalChunkBytes = accounting.getNormalChunkBytes().add(youngChunkBytes);
    final UnsignedWord allocatedNormalObjectBytes = accounting.getNormalObjectBytes().add(youngObjectBytes);
    final UnsignedWord allocatedPinnedChunkBytes = accounting.getPinnedChunkBytes().add(pinnedChunkBytes);
    final UnsignedWord allocatedPinnedObjectBytes = accounting.getPinnedObjectBytes().add(pinnedObjectBytes);
    final UnsignedWord allocatedTotalChunkBytes = allocatedNormalChunkBytes.add(allocatedPinnedChunkBytes);
    final UnsignedWord allocatedTotalObjectBytes = allocatedNormalObjectBytes.add(allocatedPinnedObjectBytes);
    /* Print the total bytes allocated and collected by chunks. */
    log.string(prefix).string("CollectedTotalChunkBytes: ").signed(accounting.getCollectedTotalChunkBytes()).newline();
    log.string(prefix).string("CollectedTotalObjectBytes: ").signed(accounting.getCollectedTotalObjectBytes()).newline();
    log.string(prefix).string("AllocatedNormalChunkBytes: ").signed(allocatedNormalChunkBytes).newline();
    log.string(prefix).string("AllocatedNormalObjectBytes: ").signed(allocatedNormalObjectBytes).newline();
    log.string(prefix).string("AllocatedPinnedChunkBytes: ").signed(allocatedPinnedChunkBytes).newline();
    log.string(prefix).string("AllocatedPinnedObjectBytes: ").signed(allocatedPinnedObjectBytes).newline();
    log.string(prefix).string("AllocatedTotalChunkBytes: ").signed(allocatedTotalChunkBytes).newline();
    log.string(prefix).string("AllocatedTotalObjectBytes: ").signed(allocatedTotalObjectBytes).newline();
    /* Print the collection counts and times. */
    final long incrementalNanos = accounting.getIncrementalCollectionTotalNanos();
    log.string(prefix).string("IncrementalGCCount: ").signed(accounting.getIncrementalCollectionCount()).newline();
    log.string(prefix).string("IncrementalGCNanos: ").signed(incrementalNanos).newline();
    final long completeNanos = accounting.getCompleteCollectionTotalNanos();
    log.string(prefix).string("CompleteGCCount: ").signed(accounting.getCompleteCollectionCount()).newline();
    log.string(prefix).string("CompleteGCNanos: ").signed(completeNanos).newline();
    /* Compute a GC load percent. */
    final long gcNanos = incrementalNanos + completeNanos;
    final long mutatorNanos = mutatorTimer.getCollectedNanos();
    final long totalNanos = gcNanos + mutatorNanos;
    final long roundedGCLoad = (0 < totalNanos ? TimeUtils.roundedDivide(100 * gcNanos, totalNanos) : 0);
    log.string(prefix).string("GCNanos: ").signed(gcNanos).newline();
    log.string(prefix).string("TotalNanos: ").signed(totalNanos).newline();
    log.string(prefix).string("GCLoadPercent: ").signed(roundedGCLoad).newline();
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord)

Example 50 with UnsignedWord

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

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