Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java @ 7503:31da1716950f
Updated truffle-sl for the changed operation code generation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 18 Jan 2013 13:29:14 +0100 |
parents | 213c1297a814 |
children | 5e3d1a68664e |
comparison
equal
deleted
inserted
replaced
7502:6343a09b2ec1 | 7503:31da1716950f |
---|---|
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.sl.nodes; | 23 package com.oracle.truffle.sl.nodes; |
24 | 24 |
25 import java.io.*; | 25 import java.io.*; |
26 import java.util.*; | |
27 | 26 |
28 import com.oracle.truffle.api.frame.*; | 27 import com.oracle.truffle.api.codegen.*; |
29 import com.oracle.truffle.api.nodes.*; | |
30 import com.oracle.truffle.sl.types.*; | |
31 | 28 |
32 public class PrintNode extends StatementNode { | 29 public abstract class PrintNode extends StatementNode { |
33 | 30 |
34 @Children | 31 @Child |
35 private final TypedNode[] expressions; | 32 protected TypedNode expression; |
36 | 33 |
37 private final PrintStream output; | 34 private final PrintStream output; |
38 | 35 |
39 public PrintNode(List<TypedNode> expressions, PrintStream output) { | 36 public PrintNode(TypedNode expression, PrintStream output) { |
40 this.expressions = adoptChildren(expressions.toArray(new TypedNode[expressions.size()])); | 37 this.expression = adoptChild(expression); |
41 this.output = output; | 38 this.output = output; |
42 } | 39 } |
43 | 40 |
44 @ExplodeLoop | 41 public PrintNode(PrintNode node) { |
45 @Override | 42 this(node.expression, node.output); |
46 public void executeVoid(VirtualFrame frame) { | 43 } |
47 for (TypedNode expression : expressions) { | 44 |
48 output.print(expression.executeGeneric(frame)); | 45 @Specialization |
49 } | 46 public void doInt(int value) { |
50 output.println(); | 47 output.print(value); |
48 } | |
49 | |
50 @Specialization | |
51 public void doBoolean(boolean value) { | |
52 output.print(value); | |
53 } | |
54 | |
55 @Specialization | |
56 public void doString(String value) { | |
57 output.print(value); | |
58 } | |
59 | |
60 @Generic | |
61 public void doGeneric(Object value) { | |
62 output.print(value.toString()); | |
51 } | 63 } |
52 } | 64 } |