use of com.oracle.truffle.llvm.runtime.global.LLVMGlobalContainer in project graal by oracle.
the class InitializeSymbolsNode method allocGlobals.
private void allocGlobals(LLVMContext context, LLVMPointer roBase, LLVMPointer rwBase) {
for (int i = 0; i < globals.length; i++) {
LLVMSymbol allocGlobal = globals[i];
LLVMGlobal descriptor = fileScope.getGlobalVariable(allocGlobal.getName());
if (descriptor == null) {
exception.enter();
throw new LLVMLinkerException(this, "Global variable %s not found", allocGlobal.getName());
}
if (!context.checkSymbol(allocGlobal)) {
// because of our symbol overriding support, it can happen that the global was
// already bound before to a different target location
LLVMPointer ref;
if (globalOffsets[i] == -1) {
ref = LLVMManagedPointer.create(new LLVMGlobalContainer());
} else {
LLVMPointer base = globalIsReadOnly[i] ? roBase : rwBase;
ref = base.increment(globalOffsets[i]);
}
context.initializeSymbol(globals[i], ref);
List<LLVMSymbol> list = new ArrayList<>(1);
list.add(descriptor);
context.registerSymbolReverseMap(list, ref);
}
}
}
Aggregations