annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java @ 13277:ce017d1e4234

Merge.
author Christian Humer <christian.humer@gmail.com>
date Mon, 09 Dec 2013 17:31:12 +0100
parents 56a11c0d689b
children b602356a9cfc 1cf373d2b415
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 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 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.extended;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
25 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
26 import com.oracle.graal.graph.spi.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 import com.oracle.graal.nodes.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
28 import com.oracle.graal.nodes.spi.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.nodes.type.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
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 * The ValueAnchor instruction keeps non-CFG (floating) nodes above a certain point in the graph.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 */
11915
56a11c0d689b removed the IterableNodeType marker interface from ValueAnchorNode (GRAAL-471)
Doug Simon <doug.simon@oracle.com>
parents: 11881
diff changeset
34 public final class ValueAnchorNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Virtualizable, GuardingNode {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
36 @Input private ValueNode anchored;
9644
a230bfbd9497 Use specialized node inputs for loopbegin's overflow check and for value anchor's anchored values
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
37
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
38 public ValueAnchorNode(ValueNode value) {
9644
a230bfbd9497 Use specialized node inputs for loopbegin's overflow check and for value anchor's anchored values
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
39 super(StampFactory.dependency());
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
40 this.anchored = value;
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 public void generate(LIRGeneratorTool gen) {
5079
f8fe72ce4adc fix typos and remove unused parameters
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
45 // Nothing to emit, since this node is used for structural purposes only.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
48 public ValueNode getAnchoredNode() {
10807
d3a677910eea new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 10804
diff changeset
49 return anchored;
d3a677910eea new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 10804
diff changeset
50 }
d3a677910eea new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 10804
diff changeset
51
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 @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: 11727
diff changeset
53 public Node canonical(CanonicalizerTool tool) {
11727
271ffa2d36b3 Clean up value anchors connected to fixed nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11711
diff changeset
54 if (anchored != null && !anchored.isConstant() && !(anchored instanceof FixedNode)) {
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
55 // Found entry that needs this anchor.
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
56 return this;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 }
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
58
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
59 if (usages().isNotEmpty()) {
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
60 // A not uses this anchor => anchor is necessary.
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
61 return this;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 }
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
63
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
64 // Anchor is not necessary any more => remove.
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
65 return null;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 }
6710
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
67
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
68 @Override
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
69 public void virtualize(VirtualizerTool tool) {
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
70 if (anchored != null && !(anchored instanceof AbstractBeginNode)) {
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
71 State state = tool.getObjectState(anchored);
7394
94f032472c28 changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents: 6710
diff changeset
72 if (state == null || state.getState() != EscapeState.Virtual) {
6710
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
73 return;
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
74 }
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
75 }
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
76 tool.delete();
6db6881c1270 add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents: 6329
diff changeset
77 }
11711
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
78
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
79 public void removeAnchoredNode() {
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
80 this.updateUsages(anchored, null);
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
81 this.anchored = null;
f12b418ebc74 Allow only single input for value anchors.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11710
diff changeset
82 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 }