Mercurial > hg > truffle
annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java @ 18941:c943ba97b2a7
Remove class ScheduledNode from the node class hierarchy.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 24 Jan 2015 00:45:12 +0100 |
parents | f57d86eb036f |
children | 1eeef8016b86 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
2 * Copyright (c) 2011, 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 */ |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
23 package com.oracle.graal.phases.common; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15008
diff
changeset
|
25 import static com.oracle.graal.compiler.common.GraalOptions.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9646
diff
changeset
|
26 |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
27 import java.util.*; |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
28 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
29 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
30 import com.oracle.graal.api.meta.*; |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15259
diff
changeset
|
31 import com.oracle.graal.compiler.common.type.*; |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
32 import com.oracle.graal.graph.Graph.Mark; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
33 import com.oracle.graal.graph.*; |
6285
471b9eb7419d
made LoweringPhase use a schedule so that floating and fixed nodes are lowered iteratively together
Doug Simon <doug.simon@oracle.com>
parents:
5720
diff
changeset
|
34 import com.oracle.graal.graph.iterators.*; |
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:
16838
diff
changeset
|
35 import com.oracle.graal.nodeinfo.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.nodes.*; |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
37 import com.oracle.graal.nodes.calc.*; |
6529
2e96dc4eb8e2
renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents:
6526
diff
changeset
|
38 import com.oracle.graal.nodes.cfg.*; |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9376
diff
changeset
|
39 import com.oracle.graal.nodes.extended.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.nodes.spi.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6522
diff
changeset
|
41 import com.oracle.graal.phases.*; |
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6522
diff
changeset
|
42 import com.oracle.graal.phases.schedule.*; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
43 import com.oracle.graal.phases.tiers.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
5247
62bbfd78c703
removed mechanism for lowering ExceptionObjectNode via substitution; only LIR lowering by the runtime is now supported
Doug Simon <doug.simon@oracle.com>
parents:
5242
diff
changeset
|
45 /** |
62bbfd78c703
removed mechanism for lowering ExceptionObjectNode via substitution; only LIR lowering by the runtime is now supported
Doug Simon <doug.simon@oracle.com>
parents:
5242
diff
changeset
|
46 * Processes all {@link Lowerable} nodes to do their lowering. |
62bbfd78c703
removed mechanism for lowering ExceptionObjectNode via substitution; only LIR lowering by the runtime is now supported
Doug Simon <doug.simon@oracle.com>
parents:
5242
diff
changeset
|
47 */ |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
48 public class LoweringPhase extends BasePhase<PhaseContext> { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 |
16838
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
50 @NodeInfo |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
51 static class DummyGuardHandle extends ValueNode implements GuardedNode { |
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
|
52 @Input(InputType.Guard) GuardingNode guard; |
16838
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
53 |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
54 public DummyGuardHandle(GuardingNode guard) { |
16838
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
55 super(StampFactory.forVoid()); |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
56 this.guard = guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
57 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
58 |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
59 public GuardingNode getGuard() { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
60 return guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
61 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
62 |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
63 public void setGuard(GuardingNode guard) { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
64 updateUsagesInterface(this.guard, guard); |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
65 this.guard = guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
66 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
67 |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
68 @Override |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
69 public ValueNode asNode() { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
70 return this; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
71 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
72 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
73 |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
74 final class LoweringToolImpl implements LoweringTool { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
75 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
76 private final PhaseContext context; |
7535
f057113c7a87
provide TargetDescription in LoweringTool
Lukas Stadler <lukas.stadler@jku.at>
parents:
7307
diff
changeset
|
77 private final NodeBitMap activeGuards; |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
78 private AnchoringNode guardAnchor; |
7535
f057113c7a87
provide TargetDescription in LoweringTool
Lukas Stadler <lukas.stadler@jku.at>
parents:
7307
diff
changeset
|
79 private FixedWithNextNode lastFixedNode; |
f057113c7a87
provide TargetDescription in LoweringTool
Lukas Stadler <lukas.stadler@jku.at>
parents:
7307
diff
changeset
|
80 private ControlFlowGraph cfg; |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
81 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
82 public LoweringToolImpl(PhaseContext context, AnchoringNode guardAnchor, NodeBitMap activeGuards, FixedWithNextNode lastFixedNode, ControlFlowGraph cfg) { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
83 this.context = context; |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
84 this.guardAnchor = guardAnchor; |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
85 this.activeGuards = activeGuards; |
11500
d2f31e6ddc35
LoweringTool: pass initial lastFixedNode to constructor
Bernhard Urban <bernhard.urban@jku.at>
parents:
11462
diff
changeset
|
86 this.lastFixedNode = lastFixedNode; |
6653
2d5407ae1ac4
intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
87 this.cfg = cfg; |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
88 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
89 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
90 @Override |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
91 public LoweringStage getLoweringStage() { |
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
92 return loweringStage; |
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
93 } |
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
94 |
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
95 @Override |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
96 public ConstantReflectionProvider getConstantReflection() { |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
97 return context.getConstantReflection(); |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
98 } |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
99 |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
100 @Override |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11804
diff
changeset
|
101 public MetaAccessProvider getMetaAccess() { |
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11804
diff
changeset
|
102 return context.getMetaAccess(); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
103 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
104 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
105 @Override |
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
|
106 public LoweringProvider getLowerer() { |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
107 return context.getLowerer(); |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
108 } |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
109 |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
110 @Override |
8638
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
111 public Replacements getReplacements() { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
112 return context.getReplacements(); |
8638
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
113 } |
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
114 |
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
115 @Override |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
116 public AnchoringNode getCurrentGuardAnchor() { |
12703
b6f66fb9f106
SnippetTemplate instantiation should replace snippet's start node with a valid anchor point not the caller's start node
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12702
diff
changeset
|
117 return guardAnchor; |
b6f66fb9f106
SnippetTemplate instantiation should replace snippet's start node with a valid anchor point not the caller's start node
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12702
diff
changeset
|
118 } |
b6f66fb9f106
SnippetTemplate instantiation should replace snippet's start node with a valid anchor point not the caller's start node
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12702
diff
changeset
|
119 |
b6f66fb9f106
SnippetTemplate instantiation should replace snippet's start node with a valid anchor point not the caller's start node
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12702
diff
changeset
|
120 @Override |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
121 public GuardingNode createGuard(FixedNode before, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action) { |
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
122 return createGuard(before, condition, deoptReason, action, false); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
123 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
124 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
125 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
126 public Assumptions assumptions() { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
127 return context.getAssumptions(); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
128 } |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
129 |
18479
16e61bb57e90
Introduce StampProvider to support different stamps for metadata on different VMs.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
130 public StampProvider getStampProvider() { |
16e61bb57e90
Introduce StampProvider to support different stamps for metadata on different VMs.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
131 return context.getStampProvider(); |
16e61bb57e90
Introduce StampProvider to support different stamps for metadata on different VMs.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
132 } |
16e61bb57e90
Introduce StampProvider to support different stamps for metadata on different VMs.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
133 |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
134 @Override |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
135 public GuardingNode createGuard(FixedNode before, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9646
diff
changeset
|
136 if (OptEliminateGuards.getValue()) { |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
137 for (Node usage : condition.usages()) { |
18398
728637aa02e6
Rename GuardNode.negated to GuardNode.isNegated
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18187
diff
changeset
|
138 if (!activeGuards.isNew(usage) && activeGuards.isMarked(usage) && ((GuardNode) usage).isNegated() == negated) { |
8273
53683dc2815e
Fix and enable deopt to guard conversion.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8178
diff
changeset
|
139 return (GuardNode) usage; |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
140 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
141 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
142 } |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
143 StructuredGraph graph = before.graph(); |
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
144 if (condition.graph().getGuardsStage().ordinal() >= StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
145 FixedGuardNode fixedGuard = graph.add(new FixedGuardNode(condition, deoptReason, action, negated)); |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
146 graph.addBeforeFixed(before, fixedGuard); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
147 DummyGuardHandle handle = graph.add(new DummyGuardHandle(fixedGuard)); |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
148 fixedGuard.lower(this); |
17137
ac687cfbed21
Delete temporary node
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16919
diff
changeset
|
149 GuardingNode result = handle.getGuard(); |
ac687cfbed21
Delete temporary node
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16919
diff
changeset
|
150 handle.safeDelete(); |
ac687cfbed21
Delete temporary node
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16919
diff
changeset
|
151 return result; |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
152 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
153 GuardNode newGuard = graph.unique(new GuardNode(condition, guardAnchor, deoptReason, action, negated, JavaConstant.NULL_POINTER)); |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
154 if (OptEliminateGuards.getValue()) { |
15955
3f48e9a1016c
NodeBitMap refactoring
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15407
diff
changeset
|
155 activeGuards.markAndGrow(newGuard); |
13283
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
156 } |
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13246
diff
changeset
|
157 return newGuard; |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
158 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
159 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
160 |
6653
2d5407ae1ac4
intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
161 @Override |
2d5407ae1ac4
intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
162 public Block getBlockFor(Node node) { |
2d5407ae1ac4
intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
163 return cfg.blockFor(node); |
2d5407ae1ac4
intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
164 } |
2d5407ae1ac4
intermediate materialization is now removed during lowering of an InstanceOfNode that has a single usage which is an IfNode in the same block
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
165 |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
166 public FixedWithNextNode lastFixedNode() { |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
167 return lastFixedNode; |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
168 } |
8178
67ee3325c285
added support for node lowering to set the fixed node for the next node to be lowered
Doug Simon <doug.simon@oracle.com>
parents:
7827
diff
changeset
|
169 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
170 private void setLastFixedNode(FixedWithNextNode n) { |
11461
2da44804f720
LoweringPhase: move detection of first lastFixedNode out of the loop, add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11449
diff
changeset
|
171 assert n.isAlive() : n; |
8178
67ee3325c285
added support for node lowering to set the fixed node for the next node to be lowered
Doug Simon <doug.simon@oracle.com>
parents:
7827
diff
changeset
|
172 lastFixedNode = n; |
67ee3325c285
added support for node lowering to set the fixed node for the next node to be lowered
Doug Simon <doug.simon@oracle.com>
parents:
7827
diff
changeset
|
173 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
174 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
175 |
11566
aa9ce8d56771
New methods for incremental canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents:
11500
diff
changeset
|
176 private final CanonicalizerPhase canonicalizer; |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
177 private final LoweringTool.LoweringStage loweringStage; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
179 public LoweringPhase(CanonicalizerPhase canonicalizer, LoweringTool.LoweringStage loweringStage) { |
11566
aa9ce8d56771
New methods for incremental canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents:
11500
diff
changeset
|
180 this.canonicalizer = canonicalizer; |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13324
diff
changeset
|
181 this.loweringStage = loweringStage; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
183 |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
184 /** |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
185 * Checks that second lowering of a given graph did not introduce any new nodes. |
15001 | 186 * |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
187 * @param graph a graph that was just {@linkplain #lower lowered} |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
188 * @throws AssertionError if the check fails |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
189 */ |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
190 private boolean checkPostLowering(StructuredGraph graph, PhaseContext context) { |
12686
ca8ab182026f
abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
191 Mark expectedMark = graph.getMark(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
192 lower(graph, context, 1); |
12686
ca8ab182026f
abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
193 Mark mark = graph.getMark(); |
13126
c07055d2c66e
Fix assertion error message
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12703
diff
changeset
|
194 assert mark.equals(expectedMark) : graph + ": a second round in the current lowering phase introduced these new nodes: " + graph.getNewNodes(expectedMark).snapshot(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
195 return true; |
6285
471b9eb7419d
made LoweringPhase use a schedule so that floating and fixed nodes are lowered iteratively together
Doug Simon <doug.simon@oracle.com>
parents:
5720
diff
changeset
|
196 } |
471b9eb7419d
made LoweringPhase use a schedule so that floating and fixed nodes are lowered iteratively together
Doug Simon <doug.simon@oracle.com>
parents:
5720
diff
changeset
|
197 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 @Override |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
199 protected void run(final StructuredGraph graph, PhaseContext context) { |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
200 lower(graph, context, 0); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
201 assert checkPostLowering(graph, context); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
202 } |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
203 |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
204 private void lower(StructuredGraph graph, PhaseContext context, int i) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
205 IncrementalCanonicalizerPhase<PhaseContext> incrementalCanonicalizer = new IncrementalCanonicalizerPhase<>(canonicalizer); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
206 incrementalCanonicalizer.appendPhase(new Round(i, context)); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
207 incrementalCanonicalizer.apply(graph, context); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
208 assert graph.verify(); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
209 } |
6285
471b9eb7419d
made LoweringPhase use a schedule so that floating and fixed nodes are lowered iteratively together
Doug Simon <doug.simon@oracle.com>
parents:
5720
diff
changeset
|
210 |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
211 /** |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
212 * Checks that lowering of a given node did not introduce any new {@link Lowerable} nodes that |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
213 * could be lowered in the current {@link LoweringPhase}. Such nodes must be recursively lowered |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
214 * as part of lowering {@code node}. |
15001 | 215 * |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
216 * @param node a node that was just lowered |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
217 * @param preLoweringMark the graph mark before {@code node} was lowered |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
218 * @param unscheduledUsages set of {@code node}'s usages that were unscheduled before it was |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
219 * lowered |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
220 * @throws AssertionError if the check fails |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
221 */ |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
222 private static boolean checkPostNodeLowering(Node node, LoweringToolImpl loweringTool, Mark preLoweringMark, Collection<Node> unscheduledUsages) { |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
223 StructuredGraph graph = (StructuredGraph) node.graph(); |
12686
ca8ab182026f
abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
224 Mark postLoweringMark = graph.getMark(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
225 NodeIterable<Node> newNodesAfterLowering = graph.getNewNodes(preLoweringMark); |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
226 if (node instanceof FloatingNode) { |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
227 if (!unscheduledUsages.isEmpty()) { |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
228 for (Node n : newNodesAfterLowering) { |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
229 assert !(n instanceof FixedNode) : node.graph() + ": cannot lower floatable node " + node + " as it introduces fixed node(s) but has the following unscheduled usages: " + |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
230 unscheduledUsages; |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
231 } |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
232 } |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
233 } |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
234 for (Node n : newNodesAfterLowering) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
235 if (n instanceof Lowerable) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
236 ((Lowerable) n).lower(loweringTool); |
12686
ca8ab182026f
abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
237 Mark mark = graph.getMark(); |
ca8ab182026f
abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
238 assert postLoweringMark.equals(mark) : graph + ": lowering of " + node + " produced lowerable " + n + " that should have been recursively lowered as it introduces these new nodes: " + |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
239 graph.getNewNodes(postLoweringMark).snapshot(); |
5397
a3d6ea4241e5
made lowering repeat processing of fixed nodes until no new fixed nodes are added before lowering floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
5379
diff
changeset
|
240 } |
a3d6ea4241e5
made lowering repeat processing of fixed nodes until no new fixed nodes are added before lowering floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
5379
diff
changeset
|
241 } |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
242 return true; |
5397
a3d6ea4241e5
made lowering repeat processing of fixed nodes until no new fixed nodes are added before lowering floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
5379
diff
changeset
|
243 } |
a3d6ea4241e5
made lowering repeat processing of fixed nodes until no new fixed nodes are added before lowering floating nodes
Doug Simon <doug.simon@oracle.com>
parents:
5379
diff
changeset
|
244 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
245 private final class Round extends Phase { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
247 private final PhaseContext context; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
248 private final SchedulePhase schedule; |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
249 private final int iteration; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
250 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
251 private Round(int iteration, PhaseContext context) { |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
252 this.iteration = iteration; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
253 this.context = context; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
254 this.schedule = new SchedulePhase(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
257 @Override |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
258 protected CharSequence createName() { |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
259 return "LoweringIteration" + iteration; |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
260 } |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
261 |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
262 @Override |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
263 public void run(StructuredGraph graph) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
264 schedule.apply(graph, false); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
265 processBlock(schedule.getCFG().getStartBlock(), graph.createNodeBitMap(), null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
268 private void processBlock(Block block, NodeBitMap activeGuards, AnchoringNode parentAnchor) { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
269 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
270 AnchoringNode anchor = parentAnchor; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
271 if (anchor == null) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
272 anchor = block.getBeginNode(); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
273 } |
12702
44c0e08c4150
Lowering should handle the case where the current guard anchor gets lowered and does not exist anymore
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12686
diff
changeset
|
274 anchor = process(block, activeGuards, anchor); |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
275 |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
276 // Process always reached block first. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
277 Block alwaysReachedBlock = block.getPostdominator(); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
278 if (alwaysReachedBlock != null && alwaysReachedBlock.getDominator() == block) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
279 processBlock(alwaysReachedBlock, activeGuards, anchor); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
280 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
281 |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
282 // Now go for the other dominators. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
283 for (Block dominated : block.getDominated()) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
284 if (dominated != alwaysReachedBlock) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
285 assert dominated.getDominator() == block; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
286 processBlock(dominated, activeGuards, null); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
287 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
288 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
289 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9646
diff
changeset
|
290 if (parentAnchor == null && OptEliminateGuards.getValue()) { |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9376
diff
changeset
|
291 for (GuardNode guard : anchor.asNode().usages().filter(GuardNode.class)) { |
15955
3f48e9a1016c
NodeBitMap refactoring
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15407
diff
changeset
|
292 if (activeGuards.isMarkedAndGrow(guard)) { |
11732
03c781923573
made snippet and substitution graphs lower themselves before being inlined
Doug Simon <doug.simon@oracle.com>
parents:
11705
diff
changeset
|
293 activeGuards.clear(guard); |
03c781923573
made snippet and substitution graphs lower themselves before being inlined
Doug Simon <doug.simon@oracle.com>
parents:
11705
diff
changeset
|
294 } |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
295 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
299 private AnchoringNode process(final Block b, final NodeBitMap activeGuards, final AnchoringNode startAnchor) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 |
12702
44c0e08c4150
Lowering should handle the case where the current guard anchor gets lowered and does not exist anymore
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12686
diff
changeset
|
301 final LoweringToolImpl loweringTool = new LoweringToolImpl(context, startAnchor, activeGuards, b.getBeginNode(), schedule.getCFG()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
303 // Lower the instructions of this block. |
18941
c943ba97b2a7
Remove class ScheduledNode from the node class hierarchy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
304 List<ValueNode> nodes = schedule.nodesFor(b); |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
305 for (Node node : nodes) { |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
306 |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
307 if (node.isDeleted()) { |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
308 // This case can happen when previous lowerings deleted nodes. |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
309 continue; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
310 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
312 // Cache the next node to be able to reconstruct the previous of the next node |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
313 // after lowering. |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
314 FixedNode nextNode = null; |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
315 if (node instanceof FixedWithNextNode) { |
11461
2da44804f720
LoweringPhase: move detection of first lastFixedNode out of the loop, add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11449
diff
changeset
|
316 nextNode = ((FixedWithNextNode) node).next(); |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
317 } else { |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
318 nextNode = loweringTool.lastFixedNode().next(); |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
319 } |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
320 |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
321 if (node instanceof Lowerable) { |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
322 Collection<Node> unscheduledUsages = null; |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
323 assert (unscheduledUsages = getUnscheduledUsages(node)) != null; |
12686
ca8ab182026f
abstracted a graph mark as a Mark object (hiding the node index)
Doug Simon <doug.simon@oracle.com>
parents:
12655
diff
changeset
|
324 Mark preLoweringMark = node.graph().getMark(); |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11500
diff
changeset
|
325 ((Lowerable) node).lower(loweringTool); |
13324
e1365fd16104
Make LoweringPhase more robust to disapearing anchors
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13283
diff
changeset
|
326 if (loweringTool.guardAnchor.asNode().isDeleted()) { |
14548
e1a2302a42bc
Improve cleanup during snippet lowering where the snippet never returns normally (unwind, deopt...)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
327 // TODO nextNode could be deleted but this is not currently supported |
e1a2302a42bc
Improve cleanup during snippet lowering where the snippet never returns normally (unwind, deopt...)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
328 assert nextNode.isAlive(); |
12702
44c0e08c4150
Lowering should handle the case where the current guard anchor gets lowered and does not exist anymore
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12686
diff
changeset
|
329 loweringTool.guardAnchor = BeginNode.prevBegin(nextNode); |
44c0e08c4150
Lowering should handle the case where the current guard anchor gets lowered and does not exist anymore
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12686
diff
changeset
|
330 } |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
331 assert checkPostNodeLowering(node, loweringTool, preLoweringMark, unscheduledUsages); |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
332 } |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
333 |
11412
7a775592258f
Fix Lowering when the lowered node modifies its successor's predecessor to be somethign that is not a FixedWithNextNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11362
diff
changeset
|
334 if (!nextNode.isAlive()) { |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
335 // can happen when the rest of the block is killed by lowering |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
336 // (e.g. by an unconditional deopt) |
11412
7a775592258f
Fix Lowering when the lowered node modifies its successor's predecessor to be somethign that is not a FixedWithNextNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11362
diff
changeset
|
337 break; |
7a775592258f
Fix Lowering when the lowered node modifies its successor's predecessor to be somethign that is not a FixedWithNextNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11362
diff
changeset
|
338 } else { |
7a775592258f
Fix Lowering when the lowered node modifies its successor's predecessor to be somethign that is not a FixedWithNextNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11362
diff
changeset
|
339 Node nextLastFixed = nextNode.predecessor(); |
11462
ff122ed4b9fd
LoweringPhase: insert begin node to make lowering more robust, if the predecessor is not a FixedWithNextNode anymore
Bernhard Urban <bernhard.urban@jku.at>
parents:
11461
diff
changeset
|
340 if (!(nextLastFixed instanceof FixedWithNextNode)) { |
ff122ed4b9fd
LoweringPhase: insert begin node to make lowering more robust, if the predecessor is not a FixedWithNextNode anymore
Bernhard Urban <bernhard.urban@jku.at>
parents:
11461
diff
changeset
|
341 // insert begin node, to have a valid last fixed for next lowerable node. |
11804
60f6d5939941
LoweringPhase: add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11798
diff
changeset
|
342 // This is about lowering a FixedWithNextNode to a control split while this |
60f6d5939941
LoweringPhase: add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11798
diff
changeset
|
343 // FixedWithNextNode is followed by some kind of BeginNode. |
60f6d5939941
LoweringPhase: add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11798
diff
changeset
|
344 // For example the when a FixedGuard followed by a loop exit is lowered to a |
60f6d5939941
LoweringPhase: add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11798
diff
changeset
|
345 // control-split + deopt. |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
346 BeginNode begin = node.graph().add(new BeginNode()); |
11462
ff122ed4b9fd
LoweringPhase: insert begin node to make lowering more robust, if the predecessor is not a FixedWithNextNode anymore
Bernhard Urban <bernhard.urban@jku.at>
parents:
11461
diff
changeset
|
347 nextLastFixed.replaceFirstSuccessor(nextNode, begin); |
ff122ed4b9fd
LoweringPhase: insert begin node to make lowering more robust, if the predecessor is not a FixedWithNextNode anymore
Bernhard Urban <bernhard.urban@jku.at>
parents:
11461
diff
changeset
|
348 begin.setNext(nextNode); |
ff122ed4b9fd
LoweringPhase: insert begin node to make lowering more robust, if the predecessor is not a FixedWithNextNode anymore
Bernhard Urban <bernhard.urban@jku.at>
parents:
11461
diff
changeset
|
349 nextLastFixed = begin; |
11412
7a775592258f
Fix Lowering when the lowered node modifies its successor's predecessor to be somethign that is not a FixedWithNextNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11362
diff
changeset
|
350 } |
11462
ff122ed4b9fd
LoweringPhase: insert begin node to make lowering more robust, if the predecessor is not a FixedWithNextNode anymore
Bernhard Urban <bernhard.urban@jku.at>
parents:
11461
diff
changeset
|
351 loweringTool.setLastFixedNode((FixedWithNextNode) nextLastFixed); |
11412
7a775592258f
Fix Lowering when the lowered node modifies its successor's predecessor to be somethign that is not a FixedWithNextNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11362
diff
changeset
|
352 } |
6302
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
353 } |
12702
44c0e08c4150
Lowering should handle the case where the current guard anchor gets lowered and does not exist anymore
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12686
diff
changeset
|
354 return loweringTool.getCurrentGuardAnchor(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 } |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
356 |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
357 /** |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
358 * Gets all usages of a floating, lowerable node that are unscheduled. |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
359 * <p> |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
360 * Given that the lowering of such nodes may introduce fixed nodes, they must be lowered in |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
361 * the context of a usage that dominates all other usages. The fixed nodes resulting from |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
362 * lowering are attached to the fixed node context of the dominating usage. This ensures the |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
363 * post-lowering graph still has a valid schedule. |
15001 | 364 * |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
365 * @param node a {@link Lowerable} node |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
366 */ |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
367 private Collection<Node> getUnscheduledUsages(Node node) { |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
368 List<Node> unscheduledUsages = new ArrayList<>(); |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
369 if (node instanceof FloatingNode) { |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
370 for (Node usage : node.usages()) { |
18941
c943ba97b2a7
Remove class ScheduledNode from the node class hierarchy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
371 if (usage instanceof ValueNode) { |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
372 Block usageBlock = schedule.getCFG().blockFor(usage); |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
373 if (usageBlock == null) { |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
374 unscheduledUsages.add(usage); |
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
375 } |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
376 } |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
377 } |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
378 } |
13246
0909754d87f4
tightened assertion about lowering a floating node with unscheduled usages to cases where it really matters
Doug Simon <doug.simon@oracle.com>
parents:
13137
diff
changeset
|
379 return unscheduledUsages; |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
380 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
382 } |