comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IntegerLiteralNode.java @ 12390:5151a7588384

SL: fixed literals generate unnecessary code.
author Christian Humer <christian.humer@gmail.com>
date Wed, 02 Oct 2013 15:57:17 +0200
parents 79041ab43660
children
comparison
equal deleted inserted replaced
12389:9d1a5d61cc11 12390:5151a7588384
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.dsl.*; 25 import com.oracle.truffle.api.frame.*;
26 import com.oracle.truffle.api.nodes.*;
26 27
27 public abstract class IntegerLiteralNode extends TypedNode { 28 public final class IntegerLiteralNode extends TypedNode {
28 29
29 private final int value; 30 private final int value;
30 31
31 public IntegerLiteralNode(int value) { 32 public IntegerLiteralNode(int value) {
32 this.value = value; 33 this.value = value;
33 } 34 }
34 35
35 @Specialization 36 @Override
36 protected int doInteger() { 37 public int executeInteger(VirtualFrame frame) throws UnexpectedResultException {
37 return this.value; 38 return value;
39 }
40
41 @Override
42 public Object executeGeneric(VirtualFrame frame) {
43 return value;
38 } 44 }
39 } 45 }