Search in sources :

Example 6 with AlwaysInline

use of com.oracle.svm.core.annotate.AlwaysInline in project graal by oracle.

the class InteriorObjRefWalker method walkObjectInline.

@AlwaysInline("Performance critical version")
public static boolean walkObjectInline(final Object obj, final ObjectReferenceVisitor visitor) {
    final DynamicHub objHub = ObjectHeader.readDynamicHubFromObject(obj);
    final int layoutEncoding = objHub.getLayoutEncoding();
    final Pointer objPointer = Word.objectToUntrackedPointer(obj);
    // Visit each Object reference in the array part of the Object.
    if (LayoutEncoding.isObjectArray(layoutEncoding)) {
        int length = KnownIntrinsics.readArrayLength(obj);
        for (int index = 0; index < length; index++) {
            final UnsignedWord elementOffset = LayoutEncoding.getArrayElementOffset(layoutEncoding, index);
            final Pointer elementPointer = objPointer.add(elementOffset);
            boolean isCompressed = ReferenceAccess.singleton().haveCompressedReferences();
            final boolean visitResult = visitor.visitObjectReferenceInline(elementPointer, isCompressed);
            if (!visitResult) {
                return false;
            }
        }
    }
    // Visit Object reference in the fields of the Object.
    byte[] referenceMapEncoding = DynamicHubSupport.getReferenceMapEncoding();
    long referenceMapIndex = objHub.getReferenceMapIndex();
    return ReferenceMapDecoder.walkOffsetsFromPointer(objPointer, referenceMapEncoding, referenceMapIndex, visitor);
}
Also used : UnsignedWord(org.graalvm.word.UnsignedWord) Pointer(org.graalvm.word.Pointer) AlwaysInline(com.oracle.svm.core.annotate.AlwaysInline)

Aggregations

AlwaysInline (com.oracle.svm.core.annotate.AlwaysInline)6 Pointer (org.graalvm.word.Pointer)5 UnsignedWord (org.graalvm.word.UnsignedWord)3 Log (com.oracle.svm.core.log.Log)2 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)2 DeoptimizedFrame (com.oracle.svm.core.deopt.DeoptimizedFrame)1 ObjectHeader (com.oracle.svm.core.heap.ObjectHeader)1