Search in sources :

Example 1 with Info

use of com.oracle.svm.hosted.image.RelocatableBuffer.Info in project graal by oracle.

the class MethodPointerInvalidHandlerFeature method markRelocationSitesFromBuffer.

private void markRelocationSitesFromBuffer(RelocatableBuffer buffer, ProgbitsSectionImpl sectionImpl) {
    for (Map.Entry<Integer, RelocatableBuffer.Info> entry : buffer.getSortedRelocations()) {
        final int offset = entry.getKey();
        final RelocatableBuffer.Info info = entry.getValue();
        assert ConfigurationValues.getTarget().arch instanceof AArch64 || checkEmbeddedOffset(sectionImpl, offset, info);
        // Figure out what kind of relocation site it is.
        if (info.getTargetObject() instanceof CFunctionPointer) {
            // References to functions are via relocations to the symbol for the function.
            markFunctionRelocationSite(sectionImpl, offset, info);
        } else {
            // A data relocation.
            if (sectionImpl.getElement() == textSection) {
                // A wrinkle on relocations *from* the text section: they are *always* to
                // constants (in the "constant partition" of the roDataSection).
                markDataRelocationSiteFromText(buffer, sectionImpl, offset, info);
            } else {
                // Relocations from other sections go to the section containing the target.
                // Pass along the information about the target.
                final Object targetObject = info.getTargetObject();
                final ObjectInfo targetObjectInfo = heap.getObjectInfo(targetObject);
                markDataRelocationSite(sectionImpl, offset, info, targetObjectInfo);
            }
        }
    }
}
Also used : AArch64(jdk.vm.ci.aarch64.AArch64) Info(com.oracle.svm.hosted.image.RelocatableBuffer.Info) Info(com.oracle.svm.hosted.image.RelocatableBuffer.Info) ImageHeapLayoutInfo(com.oracle.svm.core.image.ImageHeapLayoutInfo) CGlobalDataInfo(com.oracle.svm.core.graal.code.CGlobalDataInfo) ObjectInfo(com.oracle.svm.hosted.image.NativeImageHeap.ObjectInfo) CFunctionPointer(org.graalvm.nativeimage.c.function.CFunctionPointer) Map(java.util.Map) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) LayoutDecisionMap(com.oracle.objectfile.LayoutDecisionMap) ObjectInfo(com.oracle.svm.hosted.image.NativeImageHeap.ObjectInfo)

Aggregations

LayoutDecisionMap (com.oracle.objectfile.LayoutDecisionMap)1 CGlobalDataInfo (com.oracle.svm.core.graal.code.CGlobalDataInfo)1 ImageHeapLayoutInfo (com.oracle.svm.core.image.ImageHeapLayoutInfo)1 ObjectInfo (com.oracle.svm.hosted.image.NativeImageHeap.ObjectInfo)1 Info (com.oracle.svm.hosted.image.RelocatableBuffer.Info)1 HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 Map (java.util.Map)1 AArch64 (jdk.vm.ci.aarch64.AArch64)1 CFunctionPointer (org.graalvm.nativeimage.c.function.CFunctionPointer)1