Mercurial > hg > truffle
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java @ 16421:c158f653275e
don't forget to record assumptions
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Mon, 07 Jul 2014 20:26:31 -0700 |
parents | e4ac25d4e13d |
children | 5d468add216f |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16211
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
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.*; |
15198
2c0cfbf454b5
Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
12045
diff
changeset
|
26 import com.oracle.graal.compiler.common.type.*; |
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
|
27 import com.oracle.graal.graph.spi.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
28 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.nodes.spi.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 * The {@code InstanceOfNode} represents an instanceof test. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 */ |
16211
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
35 public class InstanceOfNode extends UnaryOpLogicNode implements Lowerable, Virtualizable { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
37 private final ResolvedJavaType type; |
9366
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
38 private JavaTypeProfile profile; |
4338 | 39 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 * Constructs a new InstanceOfNode. |
15348
1c347436d596
added UnaryOpLogicNode base class, renamed BinaryLogicNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15261
diff
changeset
|
42 * |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
43 * @param type the target type of the instanceof check |
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
44 * @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
|
45 */ |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
46 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
|
47 super(object); |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
48 this.type = type; |
5370 | 49 this.profile = profile; |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
50 assert type != null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 @Override |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11409
diff
changeset
|
54 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
|
55 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
|
56 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
5891
diff
changeset
|
57 |
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 @Override |
16211
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
59 public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) { |
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
60 Stamp stamp = forValue.stamp(); |
11265 | 61 if (!(stamp instanceof ObjectStamp)) { |
16211
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
62 return this; |
11265 | 63 } |
64 ObjectStamp objectStamp = (ObjectStamp) stamp; | |
65 if (objectStamp.alwaysNull()) { | |
16211
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
66 return LogicConstantNode.contradiction(); |
10708
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
67 } |
41e9c8845826
Improve instanceof canonicalization
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10693
diff
changeset
|
68 |
11265 | 69 ResolvedJavaType stampType = objectStamp.type(); |
70 if (stampType != null) { | |
16420
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
71 ValueNode result = checkInstanceOf(forValue, stampType, objectStamp.nonNull(), objectStamp.isExactType()); |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
72 if (result != null) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
73 return result; |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
74 } |
16421
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
75 if (tool.assumptions() != null && tool.assumptions().useOptimisticAssumptions()) { |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
76 ResolvedJavaType exact = stampType.findUniqueConcreteSubtype(); |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
77 if (exact != null) { |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
78 result = checkInstanceOf(forValue, exact, objectStamp.nonNull(), true); |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
79 if (result != null) { |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
80 tool.assumptions().recordConcreteSubtype(stampType, exact); |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
81 return result; |
c158f653275e
don't forget to record assumptions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16420
diff
changeset
|
82 } |
5338
17a84768b1cd
fix canonicalization of InstanceOfNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
5320
diff
changeset
|
83 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 } |
16420
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
86 return this; |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
87 } |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
88 |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
89 private ValueNode checkInstanceOf(ValueNode forValue, ResolvedJavaType inputType, boolean nonNull, boolean exactType) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
90 boolean subType = type().isAssignableFrom(inputType); |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
91 if (subType) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
92 if (nonNull) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
93 // the instanceOf matches, so return true |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
94 return LogicConstantNode.tautology(); |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
95 } |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
96 } else { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
97 if (exactType) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
98 // since this type check failed for an exact type we know that it can never |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
99 // succeed at run time. we also don't care about null values, since they will |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
100 // also make the check fail. |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
101 return LogicConstantNode.contradiction(); |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
102 } else { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
103 boolean superType = inputType.isAssignableFrom(type()); |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
104 if (!superType && !inputType.isInterface() && !type().isInterface()) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
105 return LogicConstantNode.contradiction(); |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
106 } |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
107 // since the subtype comparison was only performed on a declared type we don't |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
108 // really know if it might be true at run time... |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
109 } |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
110 } |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
111 if (type().isAssignableFrom(inputType)) { |
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
112 if (!nonNull) { |
16211
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
113 // the instanceof matches if the object is non-null, so return true |
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
114 // depending on the null-ness. |
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
115 return new LogicNegationNode(new IsNullNode(forValue)); |
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
116 } |
a15b25626672
implement Canonicalizable.Unary in the UnaryOpLogicNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16207
diff
changeset
|
117 } |
16420
e4ac25d4e13d
use findUniqueConcreteSubtype in InstanceOfNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
16211
diff
changeset
|
118 return null; |
5370 | 119 } |
120 | |
121 /** | |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
122 * Gets the type being tested. |
5370 | 123 */ |
6647
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
124 public ResolvedJavaType type() { |
0b8410de1365
removed targetClassInstruction from InstanceOfNode
Doug Simon <doug.simon@oracle.com>
parents:
6548
diff
changeset
|
125 return type; |
5370 | 126 } |
127 | |
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
|
128 public JavaTypeProfile profile() { |
5370 | 129 return profile; |
130 } | |
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
|
131 |
9366
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
132 public void setProfile(JavaTypeProfile profile) { |
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
133 this.profile = profile; |
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
134 } |
f1170c277b7b
Implement instanceof after instanceof swapping.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9360
diff
changeset
|
135 |
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
|
136 @Override |
7011
09df32b1dff9
make InstanceOfNode Virtualizable
Lukas Stadler <lukas.stadler@jku.at>
parents:
6647
diff
changeset
|
137 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
|
138 State state = tool.getObjectState(getValue()); |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7277
diff
changeset
|
139 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
|
140 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
|
141 } |
09df32b1dff9
make InstanceOfNode Virtualizable
Lukas Stadler <lukas.stadler@jku.at>
parents:
6647
diff
changeset
|
142 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 } |