annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java @ 17450:45b45f902bed

removed Node generation (GRAAL-857)
author Doug Simon <doug.simon@oracle.com>
date Wed, 15 Oct 2014 15:35:33 +0200
parents 845e881ce054
children 498a56d8bb9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
1 /*
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15946
diff changeset
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
4 *
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
8 *
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
13 * accompanied this code).
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
14 *
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
18 *
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
21 * questions.
4a609a685fa4 changes to Node structures:
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.extended;
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
24
9298
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9203
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: 15132
diff changeset
26 import com.oracle.graal.compiler.common.type.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 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
28 import com.oracle.graal.graph.spi.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16811
diff changeset
29 import com.oracle.graal.nodeinfo.*;
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.spi.*;
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
32
5465
215981c9fd77 added javadoc
Doug Simon <doug.simon@oracle.com>
parents: 5443
diff changeset
33 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
34 * A floating read of a value from memory specified in terms of an object base and an object
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
35 * relative location. This node does not null check the object.
5465
215981c9fd77 added javadoc
Doug Simon <doug.simon@oracle.com>
parents: 5443
diff changeset
36 */
16811
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16438
diff changeset
37 @NodeInfo
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16438
diff changeset
38 public class FloatingReadNode extends FloatingAccessNode implements IterableNodeType, LIRLowerable, Canonicalizable {
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
39
16897
f90dcdbbb75e switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents: 16895
diff changeset
40 @OptionalInput(InputType.Memory) MemoryNode lastLocationAccess;
5387
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
41
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
42 public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) {
17450
45b45f902bed removed Node generation (GRAAL-857)
Doug Simon <doug.simon@oracle.com>
parents: 17306
diff changeset
43 return new FloatingReadNode(object, location, lastLocationAccess, stamp);
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
44 }
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
45
17306
845e881ce054 constructors in a Node class must be protected
Doug Simon <doug.simon@oracle.com>
parents: 16920
diff changeset
46 protected FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) {
15946
b2c18c498f13 Remove isCompressible flags from memory access nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 15301
diff changeset
47 this(object, location, lastLocationAccess, stamp, null, BarrierType.NONE);
5387
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
48 }
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
49
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
50 public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) {
17450
45b45f902bed removed Node generation (GRAAL-857)
Doug Simon <doug.simon@oracle.com>
parents: 17306
diff changeset
51 return new FloatingReadNode(object, location, lastLocationAccess, stamp, guard);
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
52 }
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
53
17306
845e881ce054 constructors in a Node class must be protected
Doug Simon <doug.simon@oracle.com>
parents: 16920
diff changeset
54 protected FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) {
15946
b2c18c498f13 Remove isCompressible flags from memory access nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 15301
diff changeset
55 this(object, location, lastLocationAccess, stamp, guard, BarrierType.NONE);
11370
ece2cee9f85f FloatingReadNode: don't use lastLocationAccess as anchor. use guard instead.
Bernhard Urban <bernhard.urban@jku.at>
parents: 10831
diff changeset
56 }
ece2cee9f85f FloatingReadNode: don't use lastLocationAccess as anchor. use guard instead.
Bernhard Urban <bernhard.urban@jku.at>
parents: 10831
diff changeset
57
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
58 public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
17450
45b45f902bed removed Node generation (GRAAL-857)
Doug Simon <doug.simon@oracle.com>
parents: 17306
diff changeset
59 return new FloatingReadNode(object, location, lastLocationAccess, stamp, guard, barrierType);
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
60 }
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
61
17306
845e881ce054 constructors in a Node class must be protected
Doug Simon <doug.simon@oracle.com>
parents: 16920
diff changeset
62 protected FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) {
15946
b2c18c498f13 Remove isCompressible flags from memory access nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 15301
diff changeset
63 super(object, location, stamp, guard, barrierType);
5387
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
64 this.lastLocationAccess = lastLocationAccess;
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
65 }
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
66
13153
ae0001b445c0 Common base interface for nodes in the memory graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 12722
diff changeset
67 public MemoryNode getLastLocationAccess() {
5387
b6aaf6de4053 use dependencies collection instead of explicit guard fields
Lukas Stadler <lukas.stadler@jku.at>
parents: 5080
diff changeset
68 return lastLocationAccess;
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
69 }
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
70
13153
ae0001b445c0 Common base interface for nodes in the memory graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 12722
diff changeset
71 public void setLastLocationAccess(MemoryNode newlla) {
ae0001b445c0 Common base interface for nodes in the memory graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 12722
diff changeset
72 updateUsages(ValueNodeUtil.asNode(lastLocationAccess), ValueNodeUtil.asNode(newlla));
11748
db8cf3957e5b FloatingReadNode: setter for lastLocationAccess
Bernhard Urban <bernhard.urban@jku.at>
parents: 11631
diff changeset
73 lastLocationAccess = newlla;
db8cf3957e5b FloatingReadNode: setter for lastLocationAccess
Bernhard Urban <bernhard.urban@jku.at>
parents: 11631
diff changeset
74 }
db8cf3957e5b FloatingReadNode: setter for lastLocationAccess
Bernhard Urban <bernhard.urban@jku.at>
parents: 11631
diff changeset
75
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
76 @Override
14950
d5a1206e1923 NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
77 public void generate(NodeLIRBuilderTool gen) {
15130
ec22234bde0d Pass more restricted interfaces to ArithmeticLIRLowerable and LocationNode in LIR generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 14950
diff changeset
78 Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15946
diff changeset
79 LIRKind readKind = gen.getLIRGeneratorTool().getLIRKind(stamp());
15301
468b2428c403 Change DeoptimizingNode and Access to LIRFrameState in *LIRGenerator*.
Josef Eisl <josef.eisl@jku.at>
parents: 15198
diff changeset
80 gen.setResult(this, gen.getLIRGeneratorTool().emitLoad(readKind, address, null));
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
81 }
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
82
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 5836
diff changeset
83 @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: 11748
diff changeset
84 public Node canonical(CanonicalizerTool tool) {
14714
b602356a9cfc additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 13290
diff changeset
85 if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
86 return FloatingReadNode.create(((PiNode) object()).getOriginalNode(), location(), getLastLocationAccess(), stamp(), getGuard(), getBarrierType());
14714
b602356a9cfc additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 13290
diff changeset
87 }
15946
b2c18c498f13 Remove isCompressible flags from memory access nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 15301
diff changeset
88 return ReadNode.canonicalizeRead(this, location(), object(), tool);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 5836
diff changeset
89 }
8403
a007cbe2be30 Add asFixedNode to FloatingAccessNode so that GuardLoweringPhase supports any type of FloatingAccessNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8396
diff changeset
90
a007cbe2be30 Add asFixedNode to FloatingAccessNode so that GuardLoweringPhase supports any type of FloatingAccessNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8396
diff changeset
91 @Override
13290
492c9907b9bf Move Access.setNullCheck to FixedAccessNode.setNullCheck. FloatingAccessNode.asFixedNode retruns a FixedAccessNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13153
diff changeset
92 public FixedAccessNode asFixedNode() {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
93 return graph().add(ReadNode.create(object(), accessLocation(), stamp(), getGuard(), getBarrierType()));
8403
a007cbe2be30 Add asFixedNode to FloatingAccessNode so that GuardLoweringPhase supports any type of FloatingAccessNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8396
diff changeset
94 }
11861
fb218ac55362 FloatingReadNode: add verify(), make sure that lastLocationAccess is always a MemoryCheckpoint
Bernhard Urban <bernhard.urban@jku.at>
parents: 11748
diff changeset
95
fb218ac55362 FloatingReadNode: add verify(), make sure that lastLocationAccess is always a MemoryCheckpoint
Bernhard Urban <bernhard.urban@jku.at>
parents: 11748
diff changeset
96 @Override
fb218ac55362 FloatingReadNode: add verify(), make sure that lastLocationAccess is always a MemoryCheckpoint
Bernhard Urban <bernhard.urban@jku.at>
parents: 11748
diff changeset
97 public boolean verify() {
13153
ae0001b445c0 Common base interface for nodes in the memory graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 12722
diff changeset
98 MemoryNode lla = getLastLocationAccess();
16438
36ae19c8fb4e clean up MemoryNode interface (remove asMemory... methods)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
99 assert lla == null || lla instanceof MemoryCheckpoint || lla instanceof MemoryProxy || lla instanceof MemoryPhiNode : "lastLocationAccess of " + this +
36ae19c8fb4e clean up MemoryNode interface (remove asMemory... methods)
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16332
diff changeset
100 " should be a MemoryCheckpoint, but is " + lla;
11861
fb218ac55362 FloatingReadNode: add verify(), make sure that lastLocationAccess is always a MemoryCheckpoint
Bernhard Urban <bernhard.urban@jku.at>
parents: 11748
diff changeset
101 return super.verify();
fb218ac55362 FloatingReadNode: add verify(), make sure that lastLocationAccess is always a MemoryCheckpoint
Bernhard Urban <bernhard.urban@jku.at>
parents: 11748
diff changeset
102 }
4309
4a609a685fa4 changes to Node structures:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
103 }