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);
}
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);
}
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;
}
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();
}
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;
}
Aggregations