use of com.oracle.truffle.llvm.runtime.pointer.LLVMNativePointer in project graal by oracle.
the class GraalVMResolveFunction method doNativePointerResolve.
@Specialization(guards = "pointsToLong(pointer)")
protected Object doNativePointerResolve(LLVMPointer pointer) {
LLVMManagedPointer object = LLVMManagedPointer.cast(pointer);
Object pointerValue = object.getObject();
LLVMNativePointer nativePointer = LLVMNativePointer.create((long) pointerValue);
return LLVMManagedPointer.create(getContext().getFunctionDescriptor(nativePointer));
}
use of com.oracle.truffle.llvm.runtime.pointer.LLVMNativePointer in project graal by oracle.
the class LLVMGlobalContainer method toNative.
@TruffleBoundary
@ExportMessage
public void toNative(@Cached LLVMToNativeNode toNative) {
if (address == 0) {
LLVMMemory memory = LLVMLanguage.get(null).getLLVMMemory();
LLVMNativePointer pointer = memory.allocateMemory(toNative, 8);
address = pointer.asNative();
long value;
Object global = getFallback();
if (global instanceof Number) {
value = ((Number) global).longValue();
} else {
value = toNative.executeWithTarget(global).asNative();
}
memory.putI64(toNative, pointer, value);
}
}
Aggregations