use of org.graalvm.word.UnsignedWord 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;
}
use of org.graalvm.word.UnsignedWord in project graal by oracle.
the class AlignedHeapChunkMemoryWalkerAccessFeature method getFirstObjectTableSize.
/**
* How big is the first object table?
*/
@Fold
static UnsignedWord getFirstObjectTableSize() {
/* 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);
}
use of org.graalvm.word.UnsignedWord in project graal by oracle.
the class AlignedHeapChunkMemoryWalkerAccessFeature method cleanRememberedSetOfAlignedHeapChunk.
/**
* Clean the remembered set for an AlignedHeapChunk.
*/
static void cleanRememberedSetOfAlignedHeapChunk(AlignedHeader that) {
final Log trace = Log.noopLog().string("[AlignedHeapChunk.cleanRememberedSet:");
trace.string(" that: ").hex(that);
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);
CardTable.cleanTableToIndex(cardTableStart, indexLimit);
trace.string("]").newline();
}
use of org.graalvm.word.UnsignedWord in project graal by oracle.
the class CardTable method verifyDirtyCards.
/**
* Check that that every object with a pointer to young space has a corresponding dirty card.
*/
private static boolean verifyDirtyCards(Pointer ctStart, Pointer objectsStart, Pointer objectsLimit) {
final Log trace = Log.noopLog().string("[CardTable.verifyDirtyCards:");
trace.string(" ctStart: ").hex(ctStart).string(" objectsStart: ").hex(objectsStart).string(" objectsLimit: ").hex(objectsLimit);
/* Walk the objects */
Pointer ptr = objectsStart;
while (ptr.belowThan(objectsLimit)) {
final Object obj = ptr.toObject();
final boolean containsYoung = containsReferenceToYoungSpace(obj);
if (containsYoung) {
final UnsignedWord index = memoryPointerToIndex(objectsStart, objectsLimit, ptr);
final boolean isClean = isCleanEntryAtIndex(ctStart, index);
if (isClean) {
/* { WITNESS */
final boolean witnessForDebugging = true;
final Log witness = (witnessForDebugging ? Log.log() : HeapImpl.getHeapImpl().getHeapVerifierImpl().getTraceLog());
witness.string("[CardTable.verifyDirtyCards:").string(" objectsStart: ").hex(objectsStart).string(" objectsLimit: ").hex(objectsLimit).newline();
witness.string(" obj: ").object(obj).string(" contains young: ").bool(containsYoung).string(" but index: ").unsigned(index).string(" is clean.").string(" returns false").string("]").newline();
/* Return early on failure. */
return false;
}
}
ptr = LayoutEncoding.getObjectEnd(obj);
}
trace.string("]").newline();
return true;
}
use of org.graalvm.word.UnsignedWord in project graal by oracle.
the class FirstObjectTable method initializeTableToPointerForAsserts.
/**
* Initialize all the entries to the UninitializedEntry value, since I check for that in
* asserts.
*/
private static boolean initializeTableToPointerForAsserts(Pointer table, Pointer tableLimit) {
final UnsignedWord indexLimit = FirstObjectTable.tableOffsetToIndex(tableLimit.subtract(table));
FirstObjectTable.initializeTableToIndexForAsserts(table, indexLimit);
return true;
}
Aggregations