|
30 | 30 | import java.util.function.Function; |
31 | 31 | import java.util.function.Supplier; |
32 | 32 |
|
| 33 | +import com.oracle.svm.core.c.CGlobalData; |
| 34 | +import com.oracle.svm.core.c.CGlobalDataFactory; |
| 35 | +import com.oracle.svm.core.config.ConfigurationValues; |
| 36 | +import com.oracle.svm.core.heap.Heap; |
| 37 | +import com.oracle.svm.hosted.c.CGlobalDataFeature; |
33 | 38 | import com.oracle.svm.util.ReflectionUtil; |
| 39 | +import jdk.graal.compiler.core.common.CompressEncoding; |
34 | 40 | import jdk.graal.compiler.debug.DebugContext; |
35 | 41 | import jdk.graal.compiler.printer.GraalDebugHandlersFactory; |
36 | 42 | import com.oracle.svm.core.graal.meta.RuntimeConfiguration; |
|
53 | 59 | import com.oracle.svm.hosted.ProgressReporter; |
54 | 60 | import com.oracle.svm.hosted.image.sources.SourceManager; |
55 | 61 | import com.oracle.svm.hosted.util.DiagnosticUtils; |
| 62 | +import org.graalvm.word.PointerBase; |
| 63 | +import org.graalvm.word.WordFactory; |
56 | 64 |
|
57 | 65 | @AutomaticallyRegisteredFeature |
58 | 66 | @SuppressWarnings("unused") |
@@ -106,6 +114,16 @@ public void beforeAnalysis(BeforeAnalysisAccess access) { |
106 | 114 | * Ensure ClassLoader.nameAndId is available at runtime for type lookup from gdb |
107 | 115 | */ |
108 | 116 | access.registerAsAccessed(ReflectionUtil.lookupField(ClassLoader.class, "nameAndId")); |
| 117 | + |
| 118 | + CompressEncoding compressEncoding = ImageSingletons.lookup(CompressEncoding.class); |
| 119 | + CGlobalData<PointerBase> compressedShift = CGlobalDataFactory.createWord(WordFactory.signed(compressEncoding.getShift()), "__svm_compressed_shift"); |
| 120 | + CGlobalData<PointerBase> useHeapBase = CGlobalDataFactory.createWord(WordFactory.unsigned(compressEncoding.hasBase() ? 1 : 0), "__svm_use_heap_base"); |
| 121 | + CGlobalData<PointerBase> oopTagsMask = CGlobalDataFactory.createWord(WordFactory.unsigned(Heap.getHeap().getObjectHeader().getReservedBitsMask()), "__svm_oop_tags_mask"); |
| 122 | + CGlobalData<PointerBase> objectAlignment = CGlobalDataFactory.createWord(WordFactory.unsigned(ConfigurationValues.getObjectLayout().getAlignment()), "__svm_object_alignment"); |
| 123 | + CGlobalDataFeature.singleton().registerWithGlobalHiddenSymbol(compressedShift); |
| 124 | + CGlobalDataFeature.singleton().registerWithGlobalHiddenSymbol(useHeapBase); |
| 125 | + CGlobalDataFeature.singleton().registerWithGlobalHiddenSymbol(oopTagsMask); |
| 126 | + CGlobalDataFeature.singleton().registerWithGlobalHiddenSymbol(objectAlignment); |
109 | 127 | } |
110 | 128 |
|
111 | 129 | @Override |
|
0 commit comments