Search in sources :

Example 26 with RootCallTarget

use of com.oracle.truffle.api.RootCallTarget in project sulong by graalvm.

the class LLVMContext method dispose.

public void dispose(LLVMMemory memory) {
    printNativeCallStatistic();
    // - _exit(), _Exit(), or abort(): no cleanup necessary
    if (cleanupNecessary) {
        try {
            RootCallTarget disposeContext = globalScope.getFunctionDescriptor("@__sulong_dispose_context").getLLVMIRFunction();
            try (StackPointer stackPointer = threadingStack.getStack().newFrame()) {
                disposeContext.call(stackPointer);
            }
        } catch (ControlFlowException e) {
        // nothing needs to be done as the behavior is not defined
        }
    }
    threadingStack.freeMainStack(memory);
    globalStack.free();
}
Also used : ControlFlowException(com.oracle.truffle.api.nodes.ControlFlowException) StackPointer(com.oracle.truffle.llvm.runtime.memory.LLVMStack.StackPointer) RootCallTarget(com.oracle.truffle.api.RootCallTarget)

Aggregations

RootCallTarget (com.oracle.truffle.api.RootCallTarget)26 RootNode (com.oracle.truffle.api.nodes.RootNode)8 CallTarget (com.oracle.truffle.api.CallTarget)4 DirectCallNode (com.oracle.truffle.api.nodes.DirectCallNode)4 Source (com.oracle.truffle.api.source.Source)4 Test (org.junit.Test)4 FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)3 StackPointer (com.oracle.truffle.llvm.runtime.memory.LLVMStack.StackPointer)3 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)2 SourceSection (com.oracle.truffle.api.source.SourceSection)2 GlobalValueSymbol (com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol)2 LLVMContext (com.oracle.truffle.llvm.runtime.LLVMContext)2 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)2 OptimizedDirectCallNode (org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode)2 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 Truffle (com.oracle.truffle.api.Truffle)1 TruffleContext (com.oracle.truffle.api.TruffleContext)1 Env (com.oracle.truffle.api.TruffleLanguage.Env)1 ControlFlowException (com.oracle.truffle.api.nodes.ControlFlowException)1