Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/SLRootNode.java @ 18162:ab62800259ff
Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 23 Oct 2014 17:20:10 +0200 |
parents | e9c119927199 |
children | c88ab4f1f04a |
comparison
equal
deleted
inserted
replaced
18161:94f16a759646 | 18162:ab62800259ff |
---|---|
39 public final class SLRootNode extends RootNode { | 39 public final class SLRootNode extends RootNode { |
40 | 40 |
41 /** The function body that is executed, and specialized during execution. */ | 41 /** The function body that is executed, and specialized during execution. */ |
42 @Child private SLExpressionNode bodyNode; | 42 @Child private SLExpressionNode bodyNode; |
43 | 43 |
44 /** | |
45 * A copy of the uninitialized body. When performing method inlining, it is beneficial to inline | |
46 * the unspecialized function body, so that it is specialized in the context of the caller. This | |
47 * makes the specializations of the inlined function more precise. | |
48 */ | |
49 private final SLExpressionNode uninitializedBodyNode; | |
50 | |
51 /** The name of the function, for printing purposes only. */ | 44 /** The name of the function, for printing purposes only. */ |
52 private final String name; | 45 private final String name; |
53 | 46 |
54 /** The Simple execution context for this tree **/ | 47 /** The Simple execution context for this tree **/ |
55 private final SLContext context; | 48 private final SLContext context; |
56 | 49 |
57 @CompilationFinal private boolean isSplittable; | 50 @CompilationFinal private boolean isCloningAllowed; |
58 | 51 |
59 public SLRootNode(SLContext context, FrameDescriptor frameDescriptor, SLExpressionNode bodyNode, String name) { | 52 public SLRootNode(SLContext context, FrameDescriptor frameDescriptor, SLExpressionNode bodyNode, String name) { |
60 super(null, frameDescriptor); | 53 super(null, frameDescriptor); |
61 /* Deep copy the body before any specialization occurs during execution. */ | |
62 this.uninitializedBodyNode = NodeUtil.cloneNode(bodyNode); | |
63 this.bodyNode = bodyNode; | 54 this.bodyNode = bodyNode; |
64 this.name = name; | 55 this.name = name; |
65 this.context = context; | 56 this.context = context; |
66 } | 57 } |
67 | 58 |
72 | 63 |
73 public String getName() { | 64 public String getName() { |
74 return name; | 65 return name; |
75 } | 66 } |
76 | 67 |
77 public void setSplittable(boolean isSplittable) { | 68 public void setCloningAllowed(boolean isCloningAllowed) { |
78 this.isSplittable = isSplittable; | 69 this.isCloningAllowed = isCloningAllowed; |
79 } | 70 } |
80 | 71 |
81 public SLExpressionNode getBodyNode() { | 72 public SLExpressionNode getBodyNode() { |
82 return bodyNode; | 73 return bodyNode; |
83 } | 74 } |
84 | 75 |
85 @Override | 76 @Override |
86 public boolean isSplittable() { | 77 public boolean isCloningAllowed() { |
87 return isSplittable; | 78 return isCloningAllowed; |
88 } | |
89 | |
90 @Override | |
91 public RootNode split() { | |
92 return new SLRootNode(this.context, getFrameDescriptor().shallowCopy(), NodeUtil.cloneNode(uninitializedBodyNode), name); | |
93 } | 79 } |
94 | 80 |
95 @Override | 81 @Override |
96 public String toString() { | 82 public String toString() { |
97 return "root " + name; | 83 return "root " + name; |