Search in sources :

Example 31 with Log

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;
}
Also used : Log(com.oracle.svm.core.log.Log) AlwaysInline(com.oracle.svm.core.annotate.AlwaysInline)

Example 32 with Log

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;
}
Also used : Log(com.oracle.svm.core.log.Log)

Example 33 with Log

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;
}
Also used : Log(com.oracle.svm.core.log.Log) Pointer(org.graalvm.word.Pointer)

Example 34 with Log

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;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord) Pointer(org.graalvm.word.Pointer)

Example 35 with Log

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;
}
Also used : Log(com.oracle.svm.core.log.Log) UnsignedWord(org.graalvm.word.UnsignedWord)

Aggregations

Log (com.oracle.svm.core.log.Log)130 Pointer (org.graalvm.word.Pointer)30 UnsignedWord (org.graalvm.word.UnsignedWord)30 IsolateThread (org.graalvm.nativeimage.IsolateThread)4 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)4 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)3 CollectionWatcher (com.oracle.svm.core.heap.CollectionWatcher)3 DiscoverableReference (com.oracle.svm.core.heap.DiscoverableReference)3 XOptions (com.oracle.svm.core.option.XOptions)3 AlwaysInline (com.oracle.svm.core.annotate.AlwaysInline)2 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)2 KnownIntrinsics.readCallerStackPointer (com.oracle.svm.core.snippets.KnownIntrinsics.readCallerStackPointer)2 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)2 RestrictHeapAccess (com.oracle.svm.core.annotate.RestrictHeapAccess)1 CodeInfoQueryResult (com.oracle.svm.core.code.CodeInfoQueryResult)1 SubstrateInstalledCode (com.oracle.svm.core.deopt.SubstrateInstalledCode)1 AlignedHeader (com.oracle.svm.core.genscavenge.AlignedHeapChunk.AlignedHeader)1 UnalignedHeader (com.oracle.svm.core.genscavenge.UnalignedHeapChunk.UnalignedHeader)1 AllocationFreeList (com.oracle.svm.core.heap.AllocationFreeList)1 NoAllocationVerifier (com.oracle.svm.core.heap.NoAllocationVerifier)1