Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IfNode.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 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.sl.nodes; | 23 package com.oracle.truffle.sl.nodes; |
24 | 24 |
25 import com.oracle.truffle.api.codegen.*; | |
25 import com.oracle.truffle.api.frame.*; | 26 import com.oracle.truffle.api.frame.*; |
26 | 27 |
27 public class IfNode extends StatementNode { | 28 @ExecuteChildren("conditionNode") |
29 public abstract class IfNode extends StatementNode { | |
28 | 30 |
29 @Child | 31 @Child |
30 private ConditionNode condition; | 32 protected ConditionNode conditionNode; |
33 | |
31 @Child | 34 @Child |
32 private StatementNode thenPart; | 35 private StatementNode thenPartNode; |
36 | |
33 @Child | 37 @Child |
34 private StatementNode elsePart; | 38 private StatementNode elsePartNode; |
35 | 39 |
36 public IfNode(ConditionNode condition, StatementNode thenPart, StatementNode elsePart) { | 40 public IfNode(ConditionNode condition, StatementNode thenPart, StatementNode elsePart) { |
37 this.condition = adoptChild(condition); | 41 this.conditionNode = adoptChild(condition); |
38 this.thenPart = adoptChild(thenPart); | 42 this.thenPartNode = adoptChild(thenPart); |
39 this.elsePart = adoptChild(elsePart); | 43 this.elsePartNode = adoptChild(elsePart); |
40 } | 44 } |
41 | 45 |
42 @Override | 46 protected IfNode(IfNode node) { |
43 public void executeVoid(VirtualFrame frame) { | 47 this(node.conditionNode, node.thenPartNode, node.elsePartNode); |
44 if (condition.executeCondition(frame)) { | 48 } |
45 thenPart.executeVoid(frame); | 49 |
46 } else if (elsePart != null) { | 50 @Specialization |
47 elsePart.executeVoid(frame); | 51 public void doVoid(VirtualFrame frame, boolean condition) { |
52 if (condition) { | |
53 thenPartNode.executeVoid(frame); | |
54 } else { | |
55 elsePartNode.executeVoid(frame); | |
48 } | 56 } |
49 } | 57 } |
58 | |
50 } | 59 } |