com.oracle.truffle.api.CompilerDirectives.CompilationFinal Java Examples
The following examples show how to use
com.oracle.truffle.api.CompilerDirectives.CompilationFinal.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HashemParseInContextTest.java From mr-hashemi with Universal Permissive License v1.0 | 6 votes |
@Override protected CallTarget parse(ParsingRequest request) throws Exception { return Truffle.getRuntime().createCallTarget(new RootNode(this) { @CompilationFinal private ContextReference<Env> reference; @Override public Object execute(VirtualFrame frame) { return parseAndEval(); } @TruffleBoundary private Object parseAndEval() { if (reference == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); this.reference = lookupContextReference(EvalLang.class); } Source aPlusB = Source.newBuilder("hashemi", "a + b", "plus.hashem").build(); return reference.get().parsePublic(aPlusB, "a", "b").call(30, 12); } }); }