@NodeChild(value = "arguments", type = MumblerNode[].class) public abstract class BuiltinNode extends MumblerNode { public static MumblerFunction createBuiltinFunction( NodeFactory<? extends BuiltinNode> factory, VirtualFrame outerFrame) { int argumentCount = factory.getExecutionSignature().size(); MumblerNode[] argumentNodes = new MumblerNode[argumentCount]; for (int i=0; i<argumentCount; i++) { argumentNodes[i] = new ReadArgumentNode(i); } BuiltinNode node = factory.createNode((Object) argumentNodes); return new MumblerFunction(Truffle.getRuntime().createCallTarget( new MumblerRootNode(new MumblerNode[] {node}, new FrameDescriptor()))); } }
@NodeChildren({@NodeChild(value = "firstNode", type = UnboxNode.class), @NodeChild(value = "secondNode", type = UnboxNode.class)}) abstract static class MaxMinNode extends RootNode { private final boolean max; MaxMinNode(boolean max) { this.max = max; } @Specialization public int execute(int first, int second) { return max ? Math.max(first, second) : Math.min(first, second); } @Specialization public long execute(long first, long second) { return max ? Math.max(first, second) : Math.min(first, second); } @Specialization public double execute(double first, double second) { return max ? Math.max(first, second) : Math.min(first, second); } }
/** * Created by lucas on 2014-09-14. */ @NodeChildren({@NodeChild("childNode")}) public abstract class LuaUnaryNode extends LuaExpressionNode { }
@NodeChild("literalNode") @NodeField(name = "kind", type = QuoteKind.class) public abstract class QuoteNode extends MumblerNode {
@NodeChild(value = "value", type = LuaNode.class) public abstract class LuaPrintBuiltin extends LuaNode {
@NodeChildren({@NodeChild(value = "valueNode", type = ReadArgNode.class)}) abstract static class UnboxNode extends Node { @Child private Node unbox;
@NodeChild("valueNode") @NodeField(name = "slot", type = FrameSlot.class) public abstract class LuaWriteLocalVariableNode extends LuaExpressionNode {
@NodeChild("valueNode") @NodeField(name = "slot", type = FrameSlot.class) public abstract class DefineNode extends MumblerNode {