Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java @ 16207:df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Wed, 25 Jun 2014 11:20:53 +0200 |
parents | 1ddee372bf62 |
children | a15b25626672 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.java; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
25 import com.oracle.graal.api.meta.*; |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
26 import com.oracle.graal.api.meta.ProfilingInfo.TriState; |
15198
2c0cfbf454b5
Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
12045
diff
changeset
|
27 import com.oracle.graal.compiler.common.type.*; |
11880
9a747d8e0d0f
broadened types in Canonicalizable interface so that it can be moved to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11579
diff
changeset
|
28 import com.oracle.graal.graph.*; |
11881
da9db8331658
moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11880
diff
changeset
|
29 import com.oracle.graal.graph.spi.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.nodes.spi.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 * The {@code InstanceOfNode} represents an instanceof test. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 */ |
15831
1ddee372bf62
Make classes extensible
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15348
diff
changeset
|
37 public class InstanceOfNode extends UnaryOpLogicNode implements Canonicalizable, Lowerable, Virtualizable { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
39 private final ResolvedJavaType type; |
9366
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
40 private JavaTypeProfile profile; |
4338 | 41 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 * Constructs a new InstanceOfNode. |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
44 * |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
45 * @param type the target type of the instanceof check |
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
46 * @param object the object being tested by the instanceof |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 */ |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
48 public InstanceOfNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) { |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
49 super(object); |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
50 this.type = type; |
5370 | 51 this.profile = profile; |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
52 assert type != null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 @Override |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11409
diff
changeset
|
56 public void lower(LoweringTool tool) { |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
57 tool.getLowerer().lower(this, tool); |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5891
diff
changeset
|
58 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5891
diff
changeset
|
59 |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5891
diff
changeset
|
60 @Override |
11880
9a747d8e0d0f
broadened types in Canonicalizable interface so that it can be moved to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11579
diff
changeset
|
61 public Node canonical(CanonicalizerTool tool) { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15831
diff
changeset
|
62 switch (evaluate(getValue())) { |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
63 case FALSE: |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
64 return LogicConstantNode.contradiction(graph()); |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
65 case TRUE: |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
66 return LogicConstantNode.tautology(graph()); |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
67 case UNKNOWN: |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15831
diff
changeset
|
68 Stamp stamp = getValue().stamp(); |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
69 if (stamp instanceof ObjectStamp) { |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
70 ObjectStamp objectStamp = (ObjectStamp) stamp; |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
71 ResolvedJavaType stampType = objectStamp.type(); |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
72 if (stampType != null && type().isAssignableFrom(stampType)) { |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
73 if (!objectStamp.nonNull()) { |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
74 // the instanceof matches if the object is non-null, so return true |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
75 // depending on the null-ness. |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15831
diff
changeset
|
76 IsNullNode isNull = graph().unique(new IsNullNode(getValue())); |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
77 return graph().unique(new LogicNegationNode(isNull)); |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
78 } |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
79 } |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
80 } |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
81 return this; |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
82 } |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
83 return this; |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
84 } |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
85 |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
86 @Override |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
87 public TriState evaluate(ValueNode forObject) { |
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
88 Stamp stamp = forObject.stamp(); |
11265 | 89 if (!(stamp instanceof ObjectStamp)) { |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
90 return TriState.UNKNOWN; |
11265 | 91 } |
92 ObjectStamp objectStamp = (ObjectStamp) stamp; | |
93 if (objectStamp.alwaysNull()) { | |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
94 return TriState.FALSE; |
10708
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
95 } |
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
96 |
11265 | 97 ResolvedJavaType stampType = objectStamp.type(); |
98 if (stampType != null) { | |
7097
6644cecbd3a7
Replace ResolvedJavaType.isAssignableTo with isAssignableFrom to be consistent with java.lang.Class
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7037
diff
changeset
|
99 boolean subType = type().isAssignableFrom(stampType); |
5338
17a84768b1cd
fix canonicalization of InstanceOfNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5320
diff
changeset
|
100 if (subType) { |
11265 | 101 if (objectStamp.nonNull()) { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5425
diff
changeset
|
102 // the instanceOf matches, so return true |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
103 return TriState.TRUE; |
5338
17a84768b1cd
fix canonicalization of InstanceOfNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5320
diff
changeset
|
104 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 } else { |
11265 | 106 if (objectStamp.isExactType()) { |
9195
78017d2c8bea
InstanceOfNode: remove duplicated code
Bernhard Urban <bernhard.urban@jku.at>
parents:
7767
diff
changeset
|
107 // since this type check failed for an exact type we know that it can never |
78017d2c8bea
InstanceOfNode: remove duplicated code
Bernhard Urban <bernhard.urban@jku.at>
parents:
7767
diff
changeset
|
108 // succeed at run time. we also don't care about null values, since they will |
78017d2c8bea
InstanceOfNode: remove duplicated code
Bernhard Urban <bernhard.urban@jku.at>
parents:
7767
diff
changeset
|
109 // also make the check fail. |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
110 return TriState.FALSE; |
5338
17a84768b1cd
fix canonicalization of InstanceOfNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5320
diff
changeset
|
111 } else { |
10708
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
112 boolean superType = stampType.isAssignableFrom(type()); |
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
113 if (!superType && !stampType.isInterface() && !type().isInterface()) { |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
114 return TriState.FALSE; |
10708
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
115 } |
9195
78017d2c8bea
InstanceOfNode: remove duplicated code
Bernhard Urban <bernhard.urban@jku.at>
parents:
7767
diff
changeset
|
116 // since the subtype comparison was only performed on a declared type we don't |
78017d2c8bea
InstanceOfNode: remove duplicated code
Bernhard Urban <bernhard.urban@jku.at>
parents:
7767
diff
changeset
|
117 // really know if it might be true at run time... |
5338
17a84768b1cd
fix canonicalization of InstanceOfNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5320
diff
changeset
|
118 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 } |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
121 return TriState.UNKNOWN; |
5370 | 122 } |
123 | |
124 /** | |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
125 * Gets the type being tested. |
5370 | 126 */ |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
127 public ResolvedJavaType type() { |
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
128 return type; |
5370 | 129 } |
130 | |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
131 public JavaTypeProfile profile() { |
5370 | 132 return profile; |
133 } | |
6548
4dc9e468c8b0
The lowering currently does not support a FixedGuard as the usage of an InstanceOfNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6302
diff
changeset
|
134 |
9366
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
135 public void setProfile(JavaTypeProfile profile) { |
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
136 this.profile = profile; |
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
137 } |
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
138 |
6548
4dc9e468c8b0
The lowering currently does not support a FixedGuard as the usage of an InstanceOfNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6302
diff
changeset
|
139 @Override |
7011
09df32b1dff9
make InstanceOfNode Virtualizable
Lukas Stadler <lukas.stadler@jku.at>
parents:
6647
diff
changeset
|
140 public void virtualize(VirtualizerTool tool) { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15831
diff
changeset
|
141 State state = tool.getObjectState(getValue()); |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7277
diff
changeset
|
142 if (state != null) { |
7767
4a6646d8eb87
separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
143 tool.replaceWithValue(LogicConstantNode.forBoolean(type().isAssignableFrom(state.getVirtualObject().type()), graph())); |
7011
09df32b1dff9
make InstanceOfNode Virtualizable
Lukas Stadler <lukas.stadler@jku.at>
parents:
6647
diff
changeset
|
144 } |
09df32b1dff9
make InstanceOfNode Virtualizable
Lukas Stadler <lukas.stadler@jku.at>
parents:
6647
diff
changeset
|
145 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 } |