当前位置: 首页>>代码示例>>Java>>正文


Java Truffle.getRuntime方法代码示例

本文整理汇总了Java中com.oracle.truffle.api.Truffle.getRuntime方法的典型用法代码示例。如果您正苦于以下问题:Java Truffle.getRuntime方法的具体用法?Java Truffle.getRuntime怎么用?Java Truffle.getRuntime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.oracle.truffle.api.Truffle的用法示例。


在下文中一共展示了Truffle.getRuntime方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TruffleCompiler

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
public TruffleCompiler(Plugins plugins, Suites suites, LIRSuites lirSuites, Backend backend, SnippetReflectionProvider snippetReflection) {
    GraalTruffleRuntime graalTruffleRuntime = ((GraalTruffleRuntime) Truffle.getRuntime());
    this.compilationNotify = graalTruffleRuntime.getCompilationNotify();
    this.backend = backend;
    this.snippetReflection = snippetReflection;
    this.providers = backend.getProviders();
    this.suites = suites;
    this.lirSuites = lirSuites;

    ResolvedJavaType[] skippedExceptionTypes = getSkippedExceptionTypes(providers.getMetaAccess());

    boolean needSourcePositions = graalTruffleRuntime.enableInfopoints() || TruffleCompilerOptions.getValue(TruffleEnableInfopoints) ||
                    TruffleCompilerOptions.getValue(TruffleInstrumentBranches) || TruffleCompilerOptions.getValue(TruffleInstrumentBoundaries);
    GraphBuilderConfiguration baseConfig = GraphBuilderConfiguration.getDefault(new Plugins(plugins)).withNodeSourcePosition(needSourcePositions);
    this.config = baseConfig.withSkippedExceptionTypes(skippedExceptionTypes).withOmitAssertions(TruffleCompilerOptions.getValue(TruffleExcludeAssertions)).withBytecodeExceptionMode(
                    BytecodeExceptionMode.ExplicitOnly);

    this.partialEvaluator = createPartialEvaluator();

    if (Debug.isEnabled()) {
        DebugEnvironment.ensureInitialized(TruffleCompilerOptions.getOptions(), graalTruffleRuntime.getRequiredGraalCapability(SnippetReflectionProvider.class));
    }

    graalTruffleRuntime.reinstallStubs();
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:26,代码来源:TruffleCompiler.java

示例2: main

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    CharStream in = new ANTLRInputStream(new FileInputStream(args[0]));
    TuberBasicLexer lexer = new TuberBasicLexer(in);
    TokenStream tokens = new CommonTokenStream(lexer);
    TuberBasicParser parser = new TuberBasicParser(tokens);
    ParserRuleContext tree = parser.statements();

    Visitor visitor = new Visitor();
    TuberNode ast = visitor.visit(tree);

    TruffleRuntime runtime = Truffle.getRuntime();
    TuberRootNode rootNode = new TuberRootNode(ast);
    CallTarget target = runtime.createCallTarget(rootNode);
    Object result = target.call();
    System.out.println(result);
}
 
开发者ID:fehrenbach,项目名称:tuber-basic,代码行数:17,代码来源:Main.java

示例3: interpret

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
public void interpret(Path path) throws IOException {
  byte[] data = Files.readAllBytes(path);
  
  TruffleRuntime runtime = Truffle.getRuntime();
  System.out.println("using " + runtime.getName());
  
  Parser parser = new Parser(data);
  while(!parser.end()) {
    List list = parser.parseList();
    
    FrameDescriptor frameDescriptor = new FrameDescriptor();
    Node node = createAST(list, frameDescriptor);
    EvalNode evalNode = new EvalNode(node);
    CallTarget callTarget = runtime.createCallTarget(evalNode, frameDescriptor);
    callTarget.call();
  }
}
 
开发者ID:forax,项目名称:ninal,代码行数:18,代码来源:Interpreter.java

示例4: testGetTVMCI

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
@Test
public void testGetTVMCI() {
    TruffleRuntime runtime = Truffle.getRuntime();
    TVMCI tvmci = runtime.getCapability(TVMCI.class);
    assertNotNull("Truffle Virtual Machine Compiler Interface not found", tvmci);
    assertEquals("GraalTVMCI", tvmci.getClass().getSimpleName());

    abstract class TVMCISubclass extends TVMCI {
    }
    TVMCISubclass subclass = runtime.getCapability(TVMCISubclass.class);
    assertNull("Expected null return value for TVMCI subclass", subclass);
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:13,代码来源:TruffleRuntimeTest.java

示例5: testGetLayoutFactory

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
@Test
public void testGetLayoutFactory() {
    TruffleRuntime runtime = Truffle.getRuntime();
    LayoutFactory layoutFactory = runtime.getCapability(LayoutFactory.class);
    assertNotNull("LayoutFactory not found", layoutFactory);

    boolean java8OrEarlier = System.getProperty("java.specification.version").compareTo("1.9") < 0;
    ClassLoader layoutFactoryCL = layoutFactory.getClass().getClassLoader();
    if (java8OrEarlier) {
        // Bootstrap class loader or JVMCI class loader
        assertTrue(layoutFactoryCL == null || layoutFactoryCL == runtime.getClass().getClassLoader());
    } else {
        // Rely on modules to only load trusted service providers
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:16,代码来源:TruffleRuntimeTest.java

示例6: waitForOptimization

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
@Specialization
public SLFunction waitForOptimization(SLFunction function, long timeout) {
    OptimizedCallTarget target = (OptimizedCallTarget) function.getCallTarget();
    GraalTruffleRuntime runtime = ((GraalTruffleRuntime) Truffle.getRuntime());

    for (OptimizedCallTarget effectiveCallTarget : findDuplicateCallTargets(target)) {
        try {
            runtime.waitForCompilation(effectiveCallTarget, timeout);
        } catch (ExecutionException | TimeoutException e) {
            throw new RuntimeException(e);
        }
    }
    return function;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:15,代码来源:SLWaitForOptimizationBuiltin.java

示例7: PartialEvaluationTest

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
public PartialEvaluationTest() {
    beforeInitialization();
    GraalTruffleRuntime runtime = (GraalTruffleRuntime) Truffle.getRuntime();
    this.truffleCompiler = DefaultTruffleCompiler.create(runtime);

    DebugEnvironment.ensureInitialized(getInitialOptions(), runtime.getRequiredGraalCapability(SnippetReflectionProvider.class));
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:8,代码来源:PartialEvaluationTest.java

示例8: createNativeFunctionInterface

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
private static NativeFunctionInterface createNativeFunctionInterface() {
    HotSpotTruffleRuntime runtime = (HotSpotTruffleRuntime) Truffle.getRuntime();
    return runtime.createNativeFunctionInterface();
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:5,代码来源:HotSpotNativeFunctionInterfaceAccessProvider.java

示例9: testRuntimeIsGraalRuntime

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
@Test
public void testRuntimeIsGraalRuntime() {
    TruffleRuntime runtime = Truffle.getRuntime();
    assertTrue(runtime.getClass() != DefaultTruffleRuntime.class);
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:6,代码来源:TruffleRuntimeTest.java

示例10: SLGraalRuntimeBuiltin

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
protected SLGraalRuntimeBuiltin() {
    if (!(Truffle.getRuntime() instanceof GraalTruffleRuntime)) {
        throw new AssertionError("Graal runtime builtins can only be used inside of a Graal runtime.");
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:6,代码来源:SLGraalRuntimeBuiltin.java

示例11: runtime

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
private static GraalTruffleRuntime runtime() {
    return (GraalTruffleRuntime) Truffle.getRuntime();
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:4,代码来源:OptimizedCallTarget.java

示例12: getRuntime

import com.oracle.truffle.api.Truffle; //导入方法依赖的package包/类
/**
 * Utility method that casts the singleton {@link TruffleRuntime}.
 */
public static GraalTruffleRuntime getRuntime() {
    return (GraalTruffleRuntime) Truffle.getRuntime();
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:7,代码来源:GraalTruffleRuntime.java


注:本文中的com.oracle.truffle.api.Truffle.getRuntime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。