Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallNode.java @ 15064:f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Fri, 11 Apr 2014 11:53:11 +0200 |
parents | 64dcb92ee75a |
children | 448338c9ce96 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallNode.java Fri Apr 11 11:52:19 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallNode.java Fri Apr 11 11:53:11 2014 +0200 @@ -25,17 +25,44 @@ package com.oracle.truffle.api.impl; import com.oracle.truffle.api.*; +import com.oracle.truffle.api.CompilerDirectives.*; +import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.frame.FrameInstance.*; import com.oracle.truffle.api.nodes.*; -public class DefaultCallNode extends CallNode { +public class DefaultCallNode extends CallNode implements MaterializedFrameNotify { + + @CompilationFinal private FrameAccess outsideFrameAccess = FrameAccess.NONE; public DefaultCallNode(CallTarget target) { super(target); } @Override - public Object call(Object[] arguments) { - return getCurrentCallTarget().call(arguments); + public Object call(VirtualFrame frame, Object[] arguments) { + return callProxy(this, getCurrentCallTarget(), frame, arguments); + } + + public static Object callProxy(MaterializedFrameNotify notify, CallTarget callTarget, VirtualFrame frame, Object[] arguments) { + try { + if (notify.getOutsideFrameAccess() != FrameAccess.NONE) { + CompilerDirectives.materialize(frame); + } + return callTarget.call(arguments); + } finally { + // this assertion is needed to keep the values from being cleared as non-live locals + assert notify != null & callTarget != null & frame != null; + } + } + + @Override + public FrameAccess getOutsideFrameAccess() { + return outsideFrameAccess; + } + + @Override + public void setOutsideFrameAccess(FrameAccess outsideFrameAccess) { + this.outsideFrameAccess = outsideFrameAccess; } @Override