annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java @ 19396:7e2c87dae93e

Create static final NodeClass field named TYPE in Node subclasses.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 16 Feb 2015 15:43:03 +0100
parents 3fc907b46313
children 61d3cb8e1280
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
19396
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18950
diff changeset
2 * Copyright (c) 2011, 2015, 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.virtual;
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: 5443
diff changeset
25 import com.oracle.graal.api.meta.*;
15261
882f4cb7cfcf Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 14950
diff changeset
26 import com.oracle.graal.compiler.common.type.*;
11496
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
27 import com.oracle.graal.graph.*;
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: 16822
diff changeset
28 import com.oracle.graal.nodeinfo.*;
7021
cc72b8b5edca let VirtualObjectNodes react to materialization
Lukas Stadler <lukas.stadler@jku.at>
parents: 6657
diff changeset
29 import com.oracle.graal.nodes.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.nodes.spi.*;
6394
466e6ceebfed iterative partial escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 6286
diff changeset
31
16822
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 15261
diff changeset
32 @NodeInfo
11631
1aed684853f6 refactored IterableNodeType into a top level type to avoid problems it was causing for javac and JDT (CR-1408)
Doug Simon <doug.simon@oracle.com>
parents: 11496
diff changeset
33 public abstract class VirtualObjectNode extends ValueNode implements LIRLowerable, IterableNodeType {
11496
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
34
19396
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18950
diff changeset
35 public static final NodeClass TYPE = NodeClass.get(VirtualObjectNode.class);
17276
ffb974bef674 moved Node valueNumber and valueEquals logic (optionally) to generated nodes
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
36 protected boolean hasIdentity;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
19396
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18950
diff changeset
38 protected VirtualObjectNode(NodeClass c, ResolvedJavaType type, boolean hasIdentity) {
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18950
diff changeset
39 super(c, StampFactory.exactNonNull(type));
11496
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
40 this.hasIdentity = hasIdentity;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
43 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
44 * The type of object described by this {@link VirtualObjectNode}. In case of arrays, this is
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
45 * the array type (and not the component type).
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
46 */
6399
6ad5bf2efb5e cleanups, merge EscapeRecord and VirtualObjectNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 6394
diff changeset
47 public abstract ResolvedJavaType type();
6ad5bf2efb5e cleanups, merge EscapeRecord and VirtualObjectNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 6394
diff changeset
48
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
49 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
50 * The number of entries this virtual object has. Either the number of fields or the number of
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
51 * array elements.
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
52 */
6399
6ad5bf2efb5e cleanups, merge EscapeRecord and VirtualObjectNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 6394
diff changeset
53 public abstract int entryCount();
6ad5bf2efb5e cleanups, merge EscapeRecord and VirtualObjectNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 6394
diff changeset
54
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
55 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
56 * Returns the name of the entry at the given index. Only used for debugging purposes.
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
57 */
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
58 public abstract String entryName(int i);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
59
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
60 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
61 * If the given index denotes an entry in this virtual object, the index of this entry is
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
62 * returned. If no such entry can be found, this method returns -1.
18950
3fc907b46313 [SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17276
diff changeset
63 *
3fc907b46313 [SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17276
diff changeset
64 * @param constantOffset offset, where the value is placed.
3fc907b46313 [SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17276
diff changeset
65 * @param expectedEntryKind Specifies which type is expected at this offset (Is important when
3fc907b46313 [SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17276
diff changeset
66 * doing implicit casts, especially on big endian systems.
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
67 */
18950
3fc907b46313 [SPARC] Fix Partial Escape Analysis for SPARC in Truffle
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17276
diff changeset
68 public abstract int entryIndexForOffset(long constantOffset, Kind expectedEntryKind);
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
69
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
70 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
71 * Returns the {@link Kind} of the entry at the given index.
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
72 */
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
73 public abstract Kind entryKind(int index);
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
74
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
75 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
76 * Returns an exact duplicate of this virtual object node, which has not been added to the graph
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
77 * yet.
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
78 */
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
79 public abstract VirtualObjectNode duplicate();
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
80
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
81 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
82 * Specifies whether this virtual object has an object identity. If not, then the result of a
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
83 * comparison of two virtual objects is determined by comparing their contents.
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
84 */
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
85 public boolean hasIdentity() {
11496
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
86 return hasIdentity;
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
87 }
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
88
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
89 public void setIdentity(boolean identity) {
b36028c30a81 Allow escape analysis to ignore object identity correctness for types marked via the CompilerDirectives.ValueType annotation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9510
diff changeset
90 this.hasIdentity = identity;
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
91 }
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
92
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
93 /**
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
94 * Returns a node that can be used to materialize this virtual object. If this returns an
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
95 * {@link AllocatedObjectNode} then this node will be attached to a {@link CommitAllocationNode}
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
96 * , otherwise the node will just be added to the graph.
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
97 */
13554
83fd2094ff66 rework of monitorenter/exit (use MonitorIdNode)
Lukas Stadler <lukas.stadler@jku.at>
parents: 12617
diff changeset
98 public abstract ValueNode getMaterializedRepresentation(FixedNode fixed, ValueNode[] entries, LockState locks);
9501
bef43373de39 coalesce allocations during escape analysis
Lukas Stadler <lukas.stadler@jku.at>
parents: 8924
diff changeset
99
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 @Override
14950
d5a1206e1923 NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
101 public void generate(NodeLIRBuilderTool gen) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 // nothing to do...
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 }