Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java @ 6303:7acbc95b4b2b
enabled InstanceOfSnippets for general lowering of InstanceOfNodes
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 31 Aug 2012 22:20:13 +0200 |
parents | 5d7d9a6953bd |
children | ed73a5639244 |
comparison
equal
deleted
inserted
replaced
6302:5d7d9a6953bd | 6303:7acbc95b4b2b |
---|---|
32 import com.oracle.graal.compiler.*; | 32 import com.oracle.graal.compiler.*; |
33 import com.oracle.graal.graph.*; | 33 import com.oracle.graal.graph.*; |
34 import com.oracle.graal.hotspot.*; | 34 import com.oracle.graal.hotspot.*; |
35 import com.oracle.graal.hotspot.meta.*; | 35 import com.oracle.graal.hotspot.meta.*; |
36 import com.oracle.graal.nodes.*; | 36 import com.oracle.graal.nodes.*; |
37 import com.oracle.graal.nodes.calc.*; | |
37 import com.oracle.graal.nodes.extended.*; | 38 import com.oracle.graal.nodes.extended.*; |
38 import com.oracle.graal.nodes.java.*; | 39 import com.oracle.graal.nodes.java.*; |
39 import com.oracle.graal.nodes.spi.*; | 40 import com.oracle.graal.nodes.spi.*; |
40 import com.oracle.graal.nodes.util.*; | 41 import com.oracle.graal.nodes.util.*; |
41 import com.oracle.graal.snippets.*; | 42 import com.oracle.graal.snippets.*; |
57 * Fast subtype checking in the HotSpot JVM</a> by Cliff Click and John Rose. | 58 * Fast subtype checking in the HotSpot JVM</a> by Cliff Click and John Rose. |
58 */ | 59 */ |
59 public class InstanceOfSnippets implements SnippetsInterface { | 60 public class InstanceOfSnippets implements SnippetsInterface { |
60 | 61 |
61 /** | 62 /** |
62 * A test against a final type with the result being {@linkplain MaterializeNode materialized}. | 63 * A test against a final type with the result being {@linkplain ConditionalNode materialized}. |
63 */ | 64 */ |
64 @Snippet | 65 @Snippet |
65 public static Object materializeExact( | 66 public static Object materializeExact( |
66 @Parameter("object") Object object, | 67 @Parameter("object") Object object, |
67 @Parameter("exactHub") Object exactHub, | 68 @Parameter("exactHub") Object exactHub, |
103 exactHit.inc(); | 104 exactHit.inc(); |
104 jump(IfNode.TRUE_EDGE); | 105 jump(IfNode.TRUE_EDGE); |
105 } | 106 } |
106 | 107 |
107 /** | 108 /** |
108 * A test against a primary type with the result being {@linkplain MaterializeNode materialized}. | 109 * A test against a primary type with the result being {@linkplain ConditionalNode materialized}. |
109 */ | 110 */ |
110 @Snippet | 111 @Snippet |
111 public static Object materializePrimary( | 112 public static Object materializePrimary( |
112 @Parameter("hub") Object hub, | 113 @Parameter("hub") Object hub, |
113 @Parameter("object") Object object, | 114 @Parameter("object") Object object, |
152 jump(IfNode.TRUE_EDGE); | 153 jump(IfNode.TRUE_EDGE); |
153 return; | 154 return; |
154 } | 155 } |
155 | 156 |
156 /** | 157 /** |
157 * A test against a restricted secondary type type with the result being {@linkplain MaterializeNode materialized}. | 158 * A test against a restricted secondary type type with the result being {@linkplain ConditionalNode materialized}. |
158 */ | 159 */ |
159 @Snippet | 160 @Snippet |
160 public static Object materializeSecondary( | 161 public static Object materializeSecondary( |
161 @Parameter("hub") Object hub, | 162 @Parameter("hub") Object hub, |
162 @Parameter("object") Object object, | 163 @Parameter("object") Object object, |
216 jump(IfNode.TRUE_EDGE); | 217 jump(IfNode.TRUE_EDGE); |
217 return; | 218 return; |
218 } | 219 } |
219 | 220 |
220 /** | 221 /** |
221 * A test against an unknown (at compile time) type with the result being {@linkplain MaterializeNode materialized}. | 222 * A test against an unknown (at compile time) type with the result being {@linkplain ConditionalNode materialized}. |
222 */ | 223 */ |
223 @Snippet | 224 @Snippet |
224 public static Object materializeUnknown( | 225 public static Object materializeUnknown( |
225 @Parameter("hub") Object hub, | 226 @Parameter("hub") Object hub, |
226 @Parameter("object") Object object, | 227 @Parameter("object") Object object, |
433 | 434 |
434 SnippetTemplate template = cache.get(key); | 435 SnippetTemplate template = cache.get(key); |
435 template.instantiate(runtime, duplicate, ifNode, arguments); | 436 template.instantiate(runtime, duplicate, ifNode, arguments); |
436 assert ifNode.isDeleted(); | 437 assert ifNode.isDeleted(); |
437 | 438 |
438 } else if (usage instanceof MaterializeNode) { | 439 } else if (usage instanceof ConditionalNode) { |
439 | 440 |
440 MaterializeNode materialize = (MaterializeNode) usage; | 441 ConditionalNode materialize = (ConditionalNode) usage; |
441 materialize.replaceAtUsages(duplicate); | 442 materialize.replaceAtUsages(duplicate); |
442 ValueNode falseValue = materialize.falseValue(); | 443 ValueNode falseValue = materialize.falseValue(); |
443 ValueNode trueValue = materialize.trueValue(); | 444 ValueNode trueValue = materialize.trueValue(); |
444 | 445 |
445 // The materialize node is no longer connected to anyone -> kill it | 446 // The materialize node is no longer connected to anyone -> kill it |