Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java @ 2600:f1bc67c2d453
new node layout: TypeCheck, RegisterFinalizer, Invoke, NewArray, NullCheck
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 16:32:20 +0200 |
parents | 16b9a8b5ad39 |
children | 91d3952f7eb7 |
comparison
equal
deleted
inserted
replaced
2596:1c36b17f7ee0 | 2600:f1bc67c2d453 |
---|---|
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.sun.c1x.ir; | 23 package com.sun.c1x.ir; |
24 | 24 |
25 import com.oracle.graal.graph.*; | |
25 import com.sun.c1x.debug.*; | 26 import com.sun.c1x.debug.*; |
26 import com.sun.c1x.util.*; | 27 import com.sun.c1x.util.*; |
27 import com.sun.c1x.value.*; | 28 import com.sun.c1x.value.*; |
28 import com.sun.cri.bytecode.*; | 29 import com.sun.cri.bytecode.*; |
29 import com.sun.cri.ci.*; | 30 import com.sun.cri.ci.*; |
30 import com.sun.cri.ri.*; | 31 import com.sun.cri.ri.*; |
31 | 32 |
32 /** | 33 /** |
33 * The {@code CheckCast} instruction represents a {@link Bytecodes#CHECKCAST}. | 34 * The {@code CheckCast} instruction represents a {@link Bytecodes#CHECKCAST}. |
34 * | |
35 * @author Ben L. Titzer | |
36 */ | 35 */ |
37 public final class CheckCast extends TypeCheck { | 36 public final class CheckCast extends TypeCheck { |
37 | |
38 private static final int INPUT_COUNT = 0; | |
39 private static final int SUCCESSOR_COUNT = 0; | |
38 | 40 |
39 /** | 41 /** |
40 * Creates a new CheckCast instruction. | 42 * Creates a new CheckCast instruction. |
41 * @param targetClass the class being cast to | 43 * @param targetClass the class being cast to |
42 * @param object the instruction producing the object | 44 * @param object the instruction producing the object |
43 * @param stateBefore the state before the cast | 45 * @param stateBefore the state before the cast |
46 * @param graph | |
44 */ | 47 */ |
45 public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore) { | 48 public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore, Graph graph) { |
46 super(targetClass, targetClassInstruction, object, CiKind.Object, stateBefore); | 49 super(targetClass, targetClassInstruction, object, CiKind.Object, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
47 initFlag(Flag.NonNull, object.isNonNull()); | 50 initFlag(Flag.NonNull, object.isNonNull()); |
48 } | 51 } |
49 | 52 |
50 /** | 53 /** |
51 * Gets the declared type of the result of this instruction. | 54 * Gets the declared type of the result of this instruction. |
70 v.visitCheckCast(this); | 73 v.visitCheckCast(this); |
71 } | 74 } |
72 | 75 |
73 @Override | 76 @Override |
74 public int valueNumber() { | 77 public int valueNumber() { |
75 return targetClass.isResolved() ? Util.hash1(Bytecodes.CHECKCAST, object) : 0; | 78 return targetClass.isResolved() ? Util.hash1(Bytecodes.CHECKCAST, object()) : 0; |
76 } | 79 } |
77 | 80 |
78 @Override | 81 @Override |
79 public boolean valueEqual(Instruction i) { | 82 public boolean valueEqual(Instruction i) { |
80 if (i instanceof CheckCast) { | 83 if (i instanceof CheckCast) { |
81 CheckCast o = (CheckCast) i; | 84 CheckCast o = (CheckCast) i; |
82 return targetClass == o.targetClass && object == o.object; | 85 return targetClass == o.targetClass && object() == o.object(); |
83 } | 86 } |
84 return false; | 87 return false; |
85 } | 88 } |
86 | 89 |
87 @Override | 90 @Override |