use of com.oracle.svm.core.log.Log in project graal by oracle.
the class Target_java_lang_Runtime method verifyBeforeGC.
void verifyBeforeGC(String cause, UnsignedWord epoch) {
final Log trace = Log.noopLog().string("[HeapImpl.verifyBeforeGC:");
trace.string(" getVerifyHeapBeforeGC(): ").bool(getVerifyHeapBeforeGC()).string(" heapVerifier: ").object(heapVerifier);
trace.string(" getVerifyStackBeforeGC(): ").bool(getVerifyStackBeforeGC()).string(" stackVerifier: ").object(stackVerifier);
if (getVerifyHeapBeforeGC()) {
assert heapVerifier != null : "No heap verifier!";
if (!heapVerifier.verifyOperation("before collection", HeapVerifier.Occasion.BEFORE_COLLECTION)) {
Log.log().string("[HeapImpl.verifyBeforeGC:").string(" cause: ").string(cause).string(" heap fails to verify before epoch: ").unsigned(epoch).string("]").newline();
assert false;
}
}
if (getVerifyStackBeforeGC()) {
assert stackVerifier != null : "No stack verifier!";
if (!stackVerifier.verifyInAllThreads(KnownIntrinsics.readCallerStackPointer(), KnownIntrinsics.readReturnAddress(), "before collection")) {
Log.log().string("[HeapImpl.verifyBeforeGC:").string(" cause: ").string(cause).string(" stack fails to verify epoch: ").unsigned(epoch).string("]").newline();
assert false;
}
}
trace.string("]").newline();
}
use of com.oracle.svm.core.log.Log 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 com.oracle.svm.core.log.Log 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 com.oracle.svm.core.log.Log 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 com.oracle.svm.core.log.Log 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;
}
Aggregations