Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java @ 16811:5d468add216f
added @NodeInfo annotations to all Node classes
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 13 Aug 2014 18:25:45 +0200 |
parents | 90b324f2bd66 |
children | cbd42807a31f |
rev | line source |
---|---|
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
10526
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
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; |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
13978
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
25 //JaCoCo Exclude |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
26 |
9647
2adfe940fd55
Make PiNode a guarding node so that it can be used for guarded to guarding edges
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9646
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
15198
2c0cfbf454b5
Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15052
diff
changeset
|
28 import com.oracle.graal.compiler.common.type.*; |
8651
3d03bc1de46c
PiNode: add markerinterface IterableNodeType for fast iteration
Bernhard Urban <bernhard.urban@jku.at>
parents:
8649
diff
changeset
|
29 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
|
30 import com.oracle.graal.graph.spi.*; |
9647
2adfe940fd55
Make PiNode a guarding node so that it can be used for guarded to guarding edges
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9646
diff
changeset
|
31 import com.oracle.graal.nodes.extended.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.nodes.spi.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.nodes.type.*; |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 |
6467 | 35 /** |
10526
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
36 * A node that changes the type of its input, usually narrowing it. For example, a PiNode refines |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
37 * the type of a receiver during type-guarded inlining to be the type tested by the guard. |
15001 | 38 * |
10526
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
39 * In contrast to a {@link GuardedValueNode}, a PiNode is useless as soon as the type of its input |
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
40 * is as narrow or narrower than the PiNode's type. The PiNode, and therefore also the scheduling |
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
41 * restriction enforced by the anchor, will go away. |
6467 | 42 */ |
16811
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
15830
diff
changeset
|
43 @NodeInfo |
15001 | 44 public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 |
5073
2db1ad9dd385
rename PiNode.value to PiNode.object and UnsafeCastNode.x to UnsafeCastNode.object
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
46 @Input private ValueNode object; |
15754
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
47 private final Stamp piStamp; |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 |
5073
2db1ad9dd385
rename PiNode.value to PiNode.object and UnsafeCastNode.x to UnsafeCastNode.object
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
49 public ValueNode object() { |
2db1ad9dd385
rename PiNode.value to PiNode.object and UnsafeCastNode.x to UnsafeCastNode.object
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
50 return object; |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
51 } |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
52 |
8649
39fc99302250
PiNode: use existing dependencies array for anchor
Bernhard Urban <bernhard.urban@jku.at>
parents:
7530
diff
changeset
|
53 public PiNode(ValueNode object, Stamp stamp) { |
39fc99302250
PiNode: use existing dependencies array for anchor
Bernhard Urban <bernhard.urban@jku.at>
parents:
7530
diff
changeset
|
54 super(stamp); |
15754
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
55 this.piStamp = stamp; |
8649
39fc99302250
PiNode: use existing dependencies array for anchor
Bernhard Urban <bernhard.urban@jku.at>
parents:
7530
diff
changeset
|
56 this.object = object; |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
57 } |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
58 |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
59 public PiNode(ValueNode object, Stamp stamp, ValueNode anchor) { |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
60 super(stamp, (GuardingNode) anchor); |
5073
2db1ad9dd385
rename PiNode.value to PiNode.object and UnsafeCastNode.x to UnsafeCastNode.object
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
61 this.object = object; |
15754
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
62 this.piStamp = stamp; |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
63 } |
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
64 |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
65 public PiNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { |
15260
61363577a184
Move static helpers from ObjectStamp to StampTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15198
diff
changeset
|
66 this(object, StampFactory.object(toType, exactType, nonNull || StampTool.isObjectNonNull(object.stamp()))); |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
67 } |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
68 |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
69 @Override |
14950
d5a1206e1923
NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
70 public void generate(NodeLIRBuilderTool generator) { |
14633
da2431cc1506
Rename ValueNode kind() to getKind().
Josef Eisl <josef.eisl@jku.at>
parents:
14046
diff
changeset
|
71 if (object.getKind() != Kind.Void && object.getKind() != Kind.Illegal) { |
9647
2adfe940fd55
Make PiNode a guarding node so that it can be used for guarded to guarding edges
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9646
diff
changeset
|
72 generator.setResult(this, generator.operand(object)); |
2adfe940fd55
Make PiNode a guarding node so that it can be used for guarded to guarding edges
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9646
diff
changeset
|
73 } |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
74 } |
5831
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5337
diff
changeset
|
75 |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5337
diff
changeset
|
76 @Override |
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5337
diff
changeset
|
77 public boolean inferStamp() { |
15754
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
78 if (piStamp == StampFactory.forNodeIntrinsic()) { |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
79 return false; |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
80 } |
15754
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
81 if (piStamp instanceof ObjectStamp && object.stamp() instanceof ObjectStamp) { |
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
82 return updateStamp(((ObjectStamp) object.stamp()).castTo((ObjectStamp) piStamp)); |
15449
cb2eef41371c
PiNode: merge object stamps using castTo
Andreas Woess <andreas.woess@jku.at>
parents:
15260
diff
changeset
|
83 } |
15754
45285c8eccbd
Never use the current node's stamp in ValueNode.inferStamp overrides.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15449
diff
changeset
|
84 return updateStamp(piStamp.join(object().stamp())); |
5831
ed08c40d67de
Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5337
diff
changeset
|
85 } |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6467
diff
changeset
|
86 |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6467
diff
changeset
|
87 @Override |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6467
diff
changeset
|
88 public void virtualize(VirtualizerTool tool) { |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7335
diff
changeset
|
89 State state = tool.getObjectState(object); |
15260
61363577a184
Move static helpers from ObjectStamp to StampTool.
Josef Eisl <josef.eisl@jku.at>
parents:
15198
diff
changeset
|
90 if (state != null && state.getState() == EscapeState.Virtual && StampTool.typeOrNull(this) != null && StampTool.typeOrNull(this).isAssignableFrom(state.getVirtualObject().type())) { |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7335
diff
changeset
|
91 tool.replaceWithVirtual(state.getVirtualObject()); |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6467
diff
changeset
|
92 } |
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
6467
diff
changeset
|
93 } |
10054
10fbede11db0
Canonicalize useless PiNodes away
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10040
diff
changeset
|
94 |
10fbede11db0
Canonicalize useless PiNodes away
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10040
diff
changeset
|
95 @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:
11800
diff
changeset
|
96 public Node canonical(CanonicalizerTool tool) { |
15830
90b324f2bd66
Bugfix: as long as snippets are preprocessed, PiNode must not be canonicalized
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15754
diff
changeset
|
97 if (stamp() == StampFactory.forNodeIntrinsic()) { |
90b324f2bd66
Bugfix: as long as snippets are preprocessed, PiNode must not be canonicalized
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15754
diff
changeset
|
98 /* The actual stamp has not been set yet. */ |
90b324f2bd66
Bugfix: as long as snippets are preprocessed, PiNode must not be canonicalized
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15754
diff
changeset
|
99 return this; |
90b324f2bd66
Bugfix: as long as snippets are preprocessed, PiNode must not be canonicalized
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15754
diff
changeset
|
100 } |
10526
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
101 inferStamp(); |
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
102 if (stamp().equals(object().stamp())) { |
815c675b07b0
split PiNode into PiNode and GuardedValueNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
10054
diff
changeset
|
103 return object(); |
10054
10fbede11db0
Canonicalize useless PiNodes away
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10040
diff
changeset
|
104 } |
10fbede11db0
Canonicalize useless PiNodes away
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10040
diff
changeset
|
105 return this; |
10fbede11db0
Canonicalize useless PiNodes away
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10040
diff
changeset
|
106 } |
10762
c483912aaf70
add ValueProxy interface and infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
10526
diff
changeset
|
107 |
c483912aaf70
add ValueProxy interface and infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
10526
diff
changeset
|
108 @Override |
15009
e49f62425090
introduce non-ValueNode Proxy interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
109 public ValueNode getOriginalNode() { |
10762
c483912aaf70
add ValueProxy interface and infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
10526
diff
changeset
|
110 return object; |
c483912aaf70
add ValueProxy interface and infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
10526
diff
changeset
|
111 } |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
112 |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
113 @NodeIntrinsic |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
114 public static native <T> T piCast(Object object, @ConstantNodeParameter Stamp stamp); |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
115 |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
116 @NodeIntrinsic |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
117 public static native <T> T piCast(Object object, @ConstantNodeParameter Stamp stamp, GuardingNode anchor); |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
118 |
13978
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
119 public static <T> T piCastExactNonNull(Object object, @ConstantNodeParameter Class<T> toType) { |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
120 return piCast(object, toType, true, true); |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
121 } |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
122 |
15052
5e6f29f287d6
added InstanceKlass::_graal_node_class field to accelerate Node.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
15009
diff
changeset
|
123 public static <T> T piCastExact(Object object, @ConstantNodeParameter Class<T> toType) { |
5e6f29f287d6
added InstanceKlass::_graal_node_class field to accelerate Node.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
15009
diff
changeset
|
124 return piCast(object, toType, true, false); |
5e6f29f287d6
added InstanceKlass::_graal_node_class field to accelerate Node.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
15009
diff
changeset
|
125 } |
5e6f29f287d6
added InstanceKlass::_graal_node_class field to accelerate Node.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
15009
diff
changeset
|
126 |
13978
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
127 public static <T> T piCast(Object object, @ConstantNodeParameter Class<T> toType) { |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
128 return piCast(object, toType, false, false); |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
129 } |
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
130 |
14046
8b23db5f4164
fix field access and casts in method substitutions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13978
diff
changeset
|
131 public static <T> T piCastNonNull(Object object, @ConstantNodeParameter Class<T> toType) { |
8b23db5f4164
fix field access and casts in method substitutions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13978
diff
changeset
|
132 return piCast(object, toType, false, true); |
8b23db5f4164
fix field access and casts in method substitutions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13978
diff
changeset
|
133 } |
8b23db5f4164
fix field access and casts in method substitutions
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13978
diff
changeset
|
134 |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
135 @SuppressWarnings("unused") |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
136 @NodeIntrinsic |
13978
67905c049016
Provide piCast helpers instead of using raw booleans
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13190
diff
changeset
|
137 private static <T> T piCast(Object object, @ConstantNodeParameter Class<T> toType, @ConstantNodeParameter boolean exactType, @ConstantNodeParameter boolean nonNull) { |
11752
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
138 return toType.cast(object); |
7e7edb86fb43
Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11713
diff
changeset
|
139 } |
4648
83b4cc4df77a
experimental: added PiNode and PropagateTypesPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
140 } |