Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java @ 15167:258e3e0b5e2e
Change RootCallTarget from an abstract class into an interface.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Apr 2014 18:51:54 +0200 |
parents | 2ed720ce9273 |
children | a3b0ecef8a15 |
comparison
equal
deleted
inserted
replaced
15166:7bc92bdfd322 | 15167:258e3e0b5e2e |
---|---|
30 | 30 |
31 /** | 31 /** |
32 * This is an implementation-specific class. Do not use or instantiate it. Instead, use | 32 * This is an implementation-specific class. Do not use or instantiate it. Instead, use |
33 * {@link TruffleRuntime#createCallTarget(RootNode)} to create a {@link RootCallTarget}. | 33 * {@link TruffleRuntime#createCallTarget(RootNode)} to create a {@link RootCallTarget}. |
34 */ | 34 */ |
35 public class DefaultCallTarget extends RootCallTarget { | 35 public class DefaultCallTarget implements RootCallTarget { |
36 | 36 |
37 protected DefaultCallTarget(RootNode function) { | 37 private final RootNode rootNode; |
38 super(function); | 38 |
39 public DefaultCallTarget(RootNode function) { | |
40 this.rootNode = function; | |
41 this.rootNode.adoptChildren(); | |
42 this.rootNode.setCallTarget(this); | |
43 } | |
44 | |
45 @Override | |
46 public String toString() { | |
47 return rootNode.toString(); | |
48 } | |
49 | |
50 public final RootNode getRootNode() { | |
51 return rootNode; | |
39 } | 52 } |
40 | 53 |
41 @Override | 54 @Override |
42 public Object call(Object... args) { | 55 public Object call(Object... args) { |
43 VirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); | 56 VirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); |
44 return callProxy(frame); | 57 return getRootNode().execute(frame); |
45 } | 58 } |
46 } | 59 } |