use of com.oracle.svm.core.log.Log in project graal by oracle.
the class GreyToBlackObjectVisitor method visitObjectInline.
@Override
@AlwaysInline("GC performance")
public boolean visitObjectInline(final Object o) {
final Log trace = Log.noopLog();
// TODO: Why would this be passed a null Object?
if (o == null) {
return true;
}
trace.string("[GreyToBlackObjectVisitor:").string(" o: ").object(o);
DiscoverableReferenceProcessing.discoverDiscoverableReference(o);
InteriorObjRefWalker.walkObjectInline(o, objRefVisitor);
trace.string("]").newline();
return true;
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class HeapChunk method walkObjectsFrom.
/**
* Apply an ObjectVisitor to all the Objects in the given HeapChunk.
*/
public static boolean walkObjectsFrom(Header<?> that, Pointer offset, ObjectVisitor visitor) {
final Log trace = Log.noopLog().string("[HeapChunk.visitObjectsFrom:");
trace.string(" that: ").hex(that).string(" offset: ").hex(offset).string(" getTop(): ").hex(that.getTop());
/* Get the Object at the offset, or null. */
Object obj = (offset.belowThan(that.getTop()) ? offset.toObject() : null);
while (obj != null) {
trace.newline().string(" o: ").object(obj).newline();
if (!visitor.visitObjectInline(obj)) {
trace.string(" visitObject fails").string(" returns false").string("]").newline();
return false;
}
/* Step by Object. */
obj = getNextObject(that, obj);
}
trace.string(" returns true").string("]").newline();
return true;
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class HeapChunk method getNextObject.
/**
* Given an Object, return the next Object in this HeapChunk, or null.
*/
private static Object getNextObject(Header<?> that, Object obj) {
final Log trace = Log.noopLog().string("[HeapChunk.getNextObject:").newline();
final Pointer objEnd = LayoutEncoding.getObjectEnd(obj);
trace.string(" o: ").object(obj).string(" objEnd: ").hex(objEnd).string(" top: ").hex(that.getTop()).newline();
/* Check if top is below the proposed next object. */
if (that.getTop().belowOrEqual(objEnd)) {
trace.string(" returns null").string("]").newline();
return null;
}
final Object result = objEnd.toObject();
/* TODO: How do I assert that result is an Object? */
trace.string(" returns ").object(result).string("]").newline();
return result;
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class HeapChunk method verifyHeapChunk.
/*
* Verification.
*/
/**
* Verify a chunk.
*/
static boolean verifyHeapChunk(Header<?> that, Pointer start) {
/* Verify all the objects in this chunk. */
final Log trace = HeapImpl.getHeapImpl().getHeapVerifierImpl().getTraceLog().string("[HeapChunk.verify:");
trace.string(" that: ").hex(that).string(" start: ").hex(start).string(" top: ").hex(that.getTop()).string(" end: ").hex(that.getEnd());
Pointer p = start;
while (p.belowThan(that.getTop())) {
if (!HeapImpl.getHeapImpl().getHeapVerifierImpl().verifyObjectAt(p)) {
final Log witness = HeapImpl.getHeapImpl().getHeapVerifierImpl().getWitnessLog().string("[HeapChunk.verify:");
witness.string(" that: ").hex(that).string(" start: ").hex(start).string(" top: ").hex(that.getTop()).string(" end: ").hex(that.getEnd());
witness.string(" space: ").string(that.getSpace().getName());
witness.string(" object at p: ").hex(p).string(" fails to verify").string("]").newline();
trace.string(" returns false]").newline();
return false;
}
/* Step carefully over the object. */
final UnsignedWord header = ObjectHeaderImpl.readHeaderFromPointerCarefully(p);
final Object o;
if (ObjectHeaderImpl.getObjectHeaderImpl().isForwardedHeaderCarefully(header)) {
/* Use the forwarded object to get the size. */
o = ObjectHeaderImpl.getObjectHeaderImpl().getForwardedObject(header);
} else {
/* Use the object to get the size. */
o = p.toObject();
}
p = p.add(LayoutEncoding.getSizeFromObject(o));
}
trace.string(" returns true]").newline();
return true;
}
use of com.oracle.svm.core.log.Log in project graal by oracle.
the class HeapChunkProvider method keepAlignedChunk.
/**
* Should I keep another aligned chunk on the free list?
*/
private boolean keepAlignedChunk() {
final Log trace = Log.noopLog().string("[HeapChunkProvider.keepAlignedChunk:");
final UnsignedWord minimumHeapSize = HeapPolicy.getMinimumHeapSize();
final UnsignedWord heapChunkBytes = HeapImpl.getHeapImpl().getUsedChunkBytes();
final UnsignedWord unusedChunkBytes = bytesInUnusedAlignedChunks.get();
final UnsignedWord bytesInUse = heapChunkBytes.add(unusedChunkBytes);
/* If I am under the minimum heap size, then I can keep this chunk. */
final boolean result = bytesInUse.belowThan(minimumHeapSize);
trace.string(" minimumHeapSize: ").unsigned(minimumHeapSize).string(" heapChunkBytes: ").unsigned(heapChunkBytes).string(" unusedBytes: ").unsigned(unusedChunkBytes).string(" bytesInUse: ").unsigned(bytesInUse).string(" returns: ").bool(result).string(" ]").newline();
return result;
}
Aggregations