Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java @ 17149:0a35e2789735
Truffle: remove unnecessary DefaultTruffleRuntime fields
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 17 Sep 2014 20:57:20 +0200 |
parents | a3b0ecef8a15 |
children | e3c95cbbb50c |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java Thu Sep 18 12:28:11 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java Wed Sep 17 20:57:20 2014 +0200 @@ -35,13 +35,11 @@ public class DefaultCallTarget implements RootCallTarget { private final RootNode rootNode; - private final DefaultTruffleRuntime defaultTruffleRuntime; - public DefaultCallTarget(RootNode function, DefaultTruffleRuntime defaultTruffleRuntime) { + public DefaultCallTarget(RootNode function) { this.rootNode = function; this.rootNode.adoptChildren(); this.rootNode.setCallTarget(this); - this.defaultTruffleRuntime = defaultTruffleRuntime; } @Override @@ -56,7 +54,7 @@ @Override public Object call(Object... args) { final VirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args); - FrameInstance oldCurrentFrame = defaultTruffleRuntime.setCurrentFrame(new FrameInstance() { + FrameInstance oldCurrentFrame = defaultTruffleRuntime().setCurrentFrame(new FrameInstance() { public Frame getFrame(FrameAccess access, boolean slowPath) { return frame; @@ -77,7 +75,11 @@ try { return getRootNode().execute(frame); } finally { - defaultTruffleRuntime.setCurrentFrame(oldCurrentFrame); + defaultTruffleRuntime().setCurrentFrame(oldCurrentFrame); } } + + private static DefaultTruffleRuntime defaultTruffleRuntime() { + return (DefaultTruffleRuntime) Truffle.getRuntime(); + } }