Search in sources :

Example 6 with PointerBase

use of org.graalvm.word.PointerBase in project graal by oracle.

the class Deoptimizer method logDeoptSourceFrameOperation.

private static void logDeoptSourceFrameOperation(Pointer sp, DeoptimizedFrame deoptimizedFrame) {
    StringBuilderLog log = new StringBuilderLog();
    PointerBase deoptimizedFrameAddress = deoptimizedFrame.getPin().addressOfObject();
    log.string("deoptSourceFrameOperation: DeoptimizedFrame at ").hex(deoptimizedFrameAddress).string(": ");
    printDeoptimizedFrame(log, sp, deoptimizedFrame, null);
    recentDeoptimizationEvents.append(log.getResult());
}
Also used : StringBuilderLog(com.oracle.svm.core.log.StringBuilderLog) PointerBase(org.graalvm.word.PointerBase)

Example 7 with PointerBase

use of org.graalvm.word.PointerBase in project graal by oracle.

the class NativeClosure method prepareClosure.

static Target_com_oracle_truffle_nfi_impl_ClosureNativePointer prepareClosure(Target_com_oracle_truffle_nfi_impl_NFIContext ctx, Target_com_oracle_truffle_nfi_impl_LibFFISignature signature, CallTarget callTarget, ffi_closure_callback callback) {
    NativeClosure closure = new NativeClosure(callTarget, signature);
    NativeClosureHandle handle = ImageSingletons.lookup(TruffleNFISupport.class).createClosureHandle(closure);
    WordPointer codePtr = StackValue.get(SizeOf.get(WordPointer.class));
    ClosureData data = ffi_closure_alloc(SizeOf.unsigned(ClosureData.class), codePtr);
    data.setNativeClosureHandle(handle);
    data.setIsolate(CEntryPointContext.getCurrentIsolate());
    PointerBase code = codePtr.read();
    LibFFI.ffi_prep_closure_loc(data.ffiClosure(), WordFactory.pointer(signature.cif), callback, data, code);
    return ctx.createClosureNativePointer(data.rawValue(), code.rawValue(), callTarget, signature);
}
Also used : NativeClosureHandle(com.oracle.svm.truffle.nfi.LibFFI.NativeClosureHandle) WordPointer(org.graalvm.nativeimage.c.type.WordPointer) PointerBase(org.graalvm.word.PointerBase) ClosureData(com.oracle.svm.truffle.nfi.LibFFI.ClosureData)

Example 8 with PointerBase

use of org.graalvm.word.PointerBase in project graal by oracle.

the class Target_com_oracle_truffle_nfi_impl_NFIContext method loadLibrary.

@Substitute
@TruffleBoundary
static long loadLibrary(@SuppressWarnings("unused") long nativeContext, String name, int flags) {
    PointerBase ret = PosixUtils.dlopen(name, flags);
    if (ret.equal(WordFactory.zero())) {
        CompilerDirectives.transferToInterpreter();
        String error = PosixUtils.dlerror();
        throw new UnsatisfiedLinkError(error);
    }
    return ret.rawValue();
}
Also used : PointerBase(org.graalvm.word.PointerBase) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary) Substitute(com.oracle.svm.core.annotate.Substitute)

Aggregations

PointerBase (org.graalvm.word.PointerBase)8 Substitute (com.oracle.svm.core.annotate.Substitute)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)2 ConvertUnknownValueNode (com.oracle.graal.pointsto.nodes.ConvertUnknownValueNode)1 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)1 StackValueNode (com.oracle.svm.core.graal.stackvalue.StackValueNode)1 StringBuilderLog (com.oracle.svm.core.log.StringBuilderLog)1 ClosureData (com.oracle.svm.truffle.nfi.LibFFI.ClosureData)1 NativeClosureHandle (com.oracle.svm.truffle.nfi.LibFFI.NativeClosureHandle)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)1 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)1 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)1 Registration (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration)1 Word (org.graalvm.compiler.word.Word)1 WordPointer (org.graalvm.nativeimage.c.type.WordPointer)1 UnsignedWord (org.graalvm.word.UnsignedWord)1