diff truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLFunctionLiteralNode.java @ 22046:e7c2d36daf72

TruffleLanguage.parse method to convert a source to CallTarget. Basic caching to make sure the code is shared among tenants in one JVM.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 30 Jul 2015 17:36:34 +0200
parents c07e64ecb528
children 503529c65456
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLFunctionLiteralNode.java	Thu Jul 30 17:16:59 2015 +0200
+++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLFunctionLiteralNode.java	Thu Jul 30 17:36:34 2015 +0200
@@ -44,6 +44,7 @@
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.source.*;
+import com.oracle.truffle.sl.SLLanguage;
 import com.oracle.truffle.sl.nodes.*;
 import com.oracle.truffle.sl.runtime.*;
 
@@ -56,15 +57,16 @@
 @NodeInfo(shortName = "func")
 public final class SLFunctionLiteralNode extends SLExpressionNode {
 
-    private final SLFunction value;
+    private final String value;
 
-    public SLFunctionLiteralNode(SourceSection src, SLFunction value) {
+    public SLFunctionLiteralNode(SourceSection src, String value) {
         super(src);
         this.value = value;
     }
 
     @Override
     public SLFunction executeGeneric(VirtualFrame frame) {
-        return value;
+        SLLanguage language = SLLanguage.find();
+        return language.getContext().getFunctionRegistry().lookup(value);
     }
 }