Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
22045:ffbc7f472438 | 22046:e7c2d36daf72 |
---|---|
42 | 42 |
43 import com.oracle.truffle.api.*; | 43 import com.oracle.truffle.api.*; |
44 import com.oracle.truffle.api.frame.*; | 44 import com.oracle.truffle.api.frame.*; |
45 import com.oracle.truffle.api.nodes.*; | 45 import com.oracle.truffle.api.nodes.*; |
46 import com.oracle.truffle.api.source.*; | 46 import com.oracle.truffle.api.source.*; |
47 import com.oracle.truffle.sl.SLLanguage; | |
47 import com.oracle.truffle.sl.nodes.*; | 48 import com.oracle.truffle.sl.nodes.*; |
48 import com.oracle.truffle.sl.runtime.*; | 49 import com.oracle.truffle.sl.runtime.*; |
49 | 50 |
50 /** | 51 /** |
51 * Constant literal for a {@link SLFunction function} value, created when a function name occurs as | 52 * Constant literal for a {@link SLFunction function} value, created when a function name occurs as |
54 * never changes. This is guaranteed by the {@link SLFunctionRegistry}. | 55 * never changes. This is guaranteed by the {@link SLFunctionRegistry}. |
55 */ | 56 */ |
56 @NodeInfo(shortName = "func") | 57 @NodeInfo(shortName = "func") |
57 public final class SLFunctionLiteralNode extends SLExpressionNode { | 58 public final class SLFunctionLiteralNode extends SLExpressionNode { |
58 | 59 |
59 private final SLFunction value; | 60 private final String value; |
60 | 61 |
61 public SLFunctionLiteralNode(SourceSection src, SLFunction value) { | 62 public SLFunctionLiteralNode(SourceSection src, String value) { |
62 super(src); | 63 super(src); |
63 this.value = value; | 64 this.value = value; |
64 } | 65 } |
65 | 66 |
66 @Override | 67 @Override |
67 public SLFunction executeGeneric(VirtualFrame frame) { | 68 public SLFunction executeGeneric(VirtualFrame frame) { |
68 return value; | 69 SLLanguage language = SLLanguage.find(); |
70 return language.getContext().getFunctionRegistry().lookup(value); | |
69 } | 71 } |
70 } | 72 } |