Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java @ 16958:997899955e72
Instrumentation: removed ExecutionContext parameter from probe method in Instrumentable
SL/Instrumentation: SLRootNode's now store SLContext. New method added to SLStatementNode to find the root node and get its SLContext
author | David Piorkowski <david.piorkowski@oracle.com> |
---|---|
date | Tue, 26 Aug 2014 11:00:30 -0700 |
parents | 111bf82514ca |
children | 158c9ba66e45 |
comparison
equal
deleted
inserted
replaced
16955:7ef0a2355540 | 16958:997899955e72 |
---|---|
24 | 24 |
25 import com.oracle.truffle.api.frame.*; | 25 import com.oracle.truffle.api.frame.*; |
26 import com.oracle.truffle.api.nodes.*; | 26 import com.oracle.truffle.api.nodes.*; |
27 import com.oracle.truffle.sl.builtins.*; | 27 import com.oracle.truffle.sl.builtins.*; |
28 import com.oracle.truffle.sl.nodes.controlflow.*; | 28 import com.oracle.truffle.sl.nodes.controlflow.*; |
29 import com.oracle.truffle.sl.runtime.*; | |
29 | 30 |
30 /** | 31 /** |
31 * The root of all SL execution trees. It is a Truffle requirement that the tree root extends the | 32 * The root of all SL execution trees. It is a Truffle requirement that the tree root extends the |
32 * class {@link RootNode}. This class is used for both builtin and user-defined functions. For | 33 * class {@link RootNode}. This class is used for both builtin and user-defined functions. For |
33 * builtin functions, the {@link #bodyNode} is a subclass of {@link SLBuiltinNode}. For user-defined | 34 * builtin functions, the {@link #bodyNode} is a subclass of {@link SLBuiltinNode}. For user-defined |
47 private final SLExpressionNode uninitializedBodyNode; | 48 private final SLExpressionNode uninitializedBodyNode; |
48 | 49 |
49 /** The name of the function, for printing purposes only. */ | 50 /** The name of the function, for printing purposes only. */ |
50 private final String name; | 51 private final String name; |
51 | 52 |
52 public SLRootNode(FrameDescriptor frameDescriptor, SLExpressionNode bodyNode, String name) { | 53 /** The Simple execution context for this tree **/ |
54 private final SLContext context; | |
55 | |
56 public SLRootNode(SLContext context, FrameDescriptor frameDescriptor, SLExpressionNode bodyNode, String name) { | |
53 super(null, frameDescriptor); | 57 super(null, frameDescriptor); |
54 /* Deep copy the body before any specialization occurs during execution. */ | 58 /* Deep copy the body before any specialization occurs during execution. */ |
55 this.uninitializedBodyNode = NodeUtil.cloneNode(bodyNode); | 59 this.uninitializedBodyNode = NodeUtil.cloneNode(bodyNode); |
56 this.bodyNode = bodyNode; | 60 this.bodyNode = bodyNode; |
57 this.name = name; | 61 this.name = name; |
62 this.context = context; | |
58 } | 63 } |
59 | 64 |
60 @Override | 65 @Override |
61 public Object execute(VirtualFrame frame) { | 66 public Object execute(VirtualFrame frame) { |
62 return bodyNode.executeGeneric(frame); | 67 return bodyNode.executeGeneric(frame); |
67 return true; | 72 return true; |
68 } | 73 } |
69 | 74 |
70 @Override | 75 @Override |
71 public RootNode split() { | 76 public RootNode split() { |
72 return new SLRootNode(getFrameDescriptor().shallowCopy(), NodeUtil.cloneNode(uninitializedBodyNode), name); | 77 return new SLRootNode(this.context, getFrameDescriptor().shallowCopy(), NodeUtil.cloneNode(uninitializedBodyNode), name); |
73 } | 78 } |
74 | 79 |
75 @Override | 80 @Override |
76 public String toString() { | 81 public String toString() { |
77 return "root " + name; | 82 return "root " + name; |
78 } | 83 } |
84 | |
85 public SLContext getSLContext() { | |
86 return this.context; | |
87 } | |
79 } | 88 } |