Search in sources :

Example 1 with LLVMStatementRootNode

use of com.oracle.truffle.llvm.runtime.nodes.others.LLVMStatementRootNode in project graal by oracle.

the class InitializeModuleNode method createDestructor.

public static RootCallTarget createDestructor(LLVMParserResult parserResult, String moduleName, LLVMLanguage language) {
    LLVMStatementNode[] destructors = createStructor(DESTRUCTORS_VARNAME, parserResult, DESCENDING_PRIORITY);
    if (destructors.length > 0) {
        NodeFactory nodeFactory = parserResult.getRuntime().getNodeFactory();
        FrameDescriptor.Builder builder = FrameDescriptor.newBuilder();
        nodeFactory.addStackSlots(builder);
        FrameDescriptor frameDescriptor = builder.build();
        LLVMStatementRootNode root = new LLVMStatementRootNode(language, StaticInitsNodeGen.create(destructors, "fini", moduleName), frameDescriptor, nodeFactory.createStackAccess());
        return root.getCallTarget();
    } else {
        return null;
    }
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) CommonNodeFactory(com.oracle.truffle.llvm.runtime.CommonNodeFactory) NodeFactory(com.oracle.truffle.llvm.runtime.NodeFactory) LLVMStatementNode(com.oracle.truffle.llvm.runtime.nodes.api.LLVMStatementNode) LLVMStatementRootNode(com.oracle.truffle.llvm.runtime.nodes.others.LLVMStatementRootNode)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)1 CommonNodeFactory (com.oracle.truffle.llvm.runtime.CommonNodeFactory)1 NodeFactory (com.oracle.truffle.llvm.runtime.NodeFactory)1 LLVMStatementNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMStatementNode)1 LLVMStatementRootNode (com.oracle.truffle.llvm.runtime.nodes.others.LLVMStatementRootNode)1