Search in sources :

Example 1 with LLVMArgumentBuffer

use of com.oracle.truffle.llvm.runtime.LLVMArgumentBuffer in project graal by oracle.

the class LLVMGlobalRootNode method executeWithoutFrame.

@SuppressWarnings("try")
@TruffleBoundary
private Object executeWithoutFrame() {
    LLVMStack stack = getContext().getThreadingStack().getStack();
    try {
        Object appPath = new LLVMArgumentBuffer(applicationPath);
        LLVMManagedPointer applicationPathObj = LLVMManagedPointer.create(appPath);
        Object[] realArgs = new Object[] { stack, mainFunctionType, applicationPathObj, getContext().getSymbolUncached(mainFunction) };
        Object result = startFunction.call(realArgs);
        getContext().awaitThreadTermination();
        return (int) result;
    } catch (LLVMExitException e) {
        LLVMContext context = getContext();
        // if any variant of exit or abort was called, we know that all the necessary
        // cleanup was already done
        context.setCleanupNecessary(false);
        context.awaitThreadTermination();
        return e.getExceptionExitStatus();
    } finally {
        // if not done already, we want at least call a shutdown command
        getContext().shutdownThreads();
    }
}
Also used : LLVMContext(com.oracle.truffle.llvm.runtime.LLVMContext) LLVMExitException(com.oracle.truffle.llvm.runtime.LLVMExitException) LLVMArgumentBuffer(com.oracle.truffle.llvm.runtime.LLVMArgumentBuffer) LLVMManagedPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMManagedPointer) LLVMStack(com.oracle.truffle.llvm.runtime.memory.LLVMStack) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Aggregations

TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 LLVMArgumentBuffer (com.oracle.truffle.llvm.runtime.LLVMArgumentBuffer)1 LLVMContext (com.oracle.truffle.llvm.runtime.LLVMContext)1 LLVMExitException (com.oracle.truffle.llvm.runtime.LLVMExitException)1 LLVMStack (com.oracle.truffle.llvm.runtime.memory.LLVMStack)1 LLVMManagedPointer (com.oracle.truffle.llvm.runtime.pointer.LLVMManagedPointer)1