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