Mercurial > hg > truffle
changeset 9213:c3ec5230967a
Added default execute methods for Truffle-SL.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 08 Apr 2013 18:15:53 +0200 |
parents | 216dce75d5ac |
children | 9f3bade42fd2 |
files | graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionNode.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/TypedNode.java |
diffstat | 2 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionNode.java Mon Apr 08 17:02:55 2013 +0200 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionNode.java Mon Apr 08 18:15:53 2013 +0200 @@ -28,4 +28,9 @@ public abstract boolean executeCondition(VirtualFrame frame); + @Override + public void executeVoid(VirtualFrame frame) { + executeCondition(frame); + } + }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/TypedNode.java Mon Apr 08 17:02:55 2013 +0200 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/TypedNode.java Mon Apr 08 18:15:53 2013 +0200 @@ -26,6 +26,7 @@ import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; +import com.oracle.truffle.sl.*; public abstract class TypedNode extends ConditionNode { @@ -38,15 +39,28 @@ } } - public abstract boolean executeBoolean(VirtualFrame frame) throws UnexpectedResultException; + public abstract Object executeGeneric(VirtualFrame frame); - public abstract int executeInteger(VirtualFrame frame) throws UnexpectedResultException; + public boolean executeBoolean(VirtualFrame frame) throws UnexpectedResultException { + return SLTypesGen.SLTYPES.expectBoolean(executeGeneric(frame)); + } + + public int executeInteger(VirtualFrame frame) throws UnexpectedResultException { + return SLTypesGen.SLTYPES.expectInteger(executeGeneric(frame)); + } - public abstract BigInteger executeBigInteger(VirtualFrame frame) throws UnexpectedResultException; + public BigInteger executeBigInteger(VirtualFrame frame) throws UnexpectedResultException { + return SLTypesGen.SLTYPES.expectBigInteger(executeGeneric(frame)); + } - public abstract String executeString(VirtualFrame frame) throws UnexpectedResultException; + public String executeString(VirtualFrame frame) throws UnexpectedResultException { + return SLTypesGen.SLTYPES.expectString(executeGeneric(frame)); + } - public abstract Object executeGeneric(VirtualFrame frame); + @Override + public void executeVoid(VirtualFrame frame) { + executeGeneric(frame); + } public boolean isString(Object a, Object b) { return a instanceof String || b instanceof String;