Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java @ 16895:06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 18 Aug 2014 14:04:21 +0200 |
parents | cbd42807a31f |
children | f90dcdbbb75e |
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 */ |
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:
13327
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:
16811
diff
changeset
|
50 @NodeInfo |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
51 static class DummyGuardHandle extends ValueNode implements GuardedNode { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
52 @Input(InputType.Guard) private GuardingNode guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
53 |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
54 public static DummyGuardHandle create(GuardingNode guard) { |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
55 return new LoweringPhase_DummyGuardHandleGen(guard); |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
56 } |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
57 |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
58 protected DummyGuardHandle(GuardingNode guard) { |
16838
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
59 super(StampFactory.forVoid()); |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
60 this.guard = guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
61 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
62 |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
63 public GuardingNode getGuard() { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
64 return guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
65 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
66 |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
67 public void setGuard(GuardingNode guard) { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
68 updateUsagesInterface(this.guard, guard); |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
69 this.guard = guard; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
70 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
71 |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
72 @Override |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
73 public ValueNode asNode() { |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
74 return this; |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
75 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
76 } |
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
77 |
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
|
78 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
|
79 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
80 private final PhaseContext context; |
7535
f057113c7a87
provide TargetDescription in LoweringTool
Lukas Stadler <lukas.stadler@jku.at>
parents:
7307
diff
changeset
|
81 private final NodeBitMap activeGuards; |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
82 private AnchoringNode guardAnchor; |
7535
f057113c7a87
provide TargetDescription in LoweringTool
Lukas Stadler <lukas.stadler@jku.at>
parents:
7307
diff
changeset
|
83 private FixedWithNextNode lastFixedNode; |
f057113c7a87
provide TargetDescription in LoweringTool
Lukas Stadler <lukas.stadler@jku.at>
parents:
7307
diff
changeset
|
84 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
|
85 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
86 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
|
87 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
|
88 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
|
89 this.activeGuards = activeGuards; |
11500
d2f31e6ddc35
LoweringTool: pass initial lastFixedNode to constructor
Bernhard Urban <bernhard.urban@jku.at>
parents:
11462
diff
changeset
|
90 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
|
91 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
|
92 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
93 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
94 @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:
13327
diff
changeset
|
95 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:
13327
diff
changeset
|
96 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:
13327
diff
changeset
|
97 } |
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:
13327
diff
changeset
|
98 |
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:
13327
diff
changeset
|
99 @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
|
100 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
|
101 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
|
102 } |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
103 |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
104 @Override |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11804
diff
changeset
|
105 public MetaAccessProvider getMetaAccess() { |
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11804
diff
changeset
|
106 return context.getMetaAccess(); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
107 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
108 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
109 @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
|
110 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
|
111 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
|
112 } |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
113 |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
114 @Override |
8638
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
115 public Replacements getReplacements() { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
116 return context.getReplacements(); |
8638
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
117 } |
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
118 |
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
119 @Override |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
120 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
|
121 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
|
122 } |
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
|
123 |
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
|
124 @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
|
125 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
|
126 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
|
127 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
128 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
129 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
130 public Assumptions assumptions() { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
131 return context.getAssumptions(); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
132 } |
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
|
133 |
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()) { |
8298
1774e72a60b3
Guards with different anchors should be commoned out in the lowering phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8273
diff
changeset
|
138 if (!activeGuards.isNew(usage) && activeGuards.isMarked(usage) && ((GuardNode) usage).negated() == 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()) { |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
145 FixedGuardNode fixedGuard = graph.add(FixedGuardNode.create(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); |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
147 DummyGuardHandle handle = graph.add(DummyGuardHandle.create(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); |
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
|
149 return handle.getGuard(); |
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
|
150 } else { |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
151 GuardNode newGuard = graph.unique(GuardNode.create(condition, guardAnchor, deoptReason, action, negated, Constant.NULL_OBJECT)); |
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 if (OptEliminateGuards.getValue()) { |
15955
3f48e9a1016c
NodeBitMap refactoring
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15407
diff
changeset
|
153 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
|
154 } |
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
|
155 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
|
156 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
157 } |
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 |
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
|
159 @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
|
160 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
|
161 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
|
162 } |
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 |
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
|
164 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
|
165 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
|
166 } |
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
|
167 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
168 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
|
169 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
|
170 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
|
171 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
172 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
173 |
11566
aa9ce8d56771
New methods for incremental canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents:
11500
diff
changeset
|
174 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:
13327
diff
changeset
|
175 private final LoweringTool.LoweringStage loweringStage; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 |
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:
13327
diff
changeset
|
177 public LoweringPhase(CanonicalizerPhase canonicalizer, LoweringTool.LoweringStage loweringStage) { |
11566
aa9ce8d56771
New methods for incremental canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents:
11500
diff
changeset
|
178 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:
13327
diff
changeset
|
179 this.loweringStage = loweringStage; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
181 |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
182 /** |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
183 * Checks that second lowering of a given graph did not introduce any new nodes. |
15001 | 184 * |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
185 * @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
|
186 * @throws AssertionError if the check fails |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
187 */ |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
188 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
|
189 Mark expectedMark = graph.getMark(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
190 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
|
191 Mark mark = graph.getMark(); |
13126
c07055d2c66e
Fix assertion error message
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12703
diff
changeset
|
192 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
|
193 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
|
194 } |
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
|
195 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 @Override |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
197 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
|
198 lower(graph, context, 0); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
199 assert checkPostLowering(graph, context); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
200 } |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
201 |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
202 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
|
203 IncrementalCanonicalizerPhase<PhaseContext> incrementalCanonicalizer = new IncrementalCanonicalizerPhase<>(canonicalizer); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
204 incrementalCanonicalizer.appendPhase(new Round(i, context)); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
205 incrementalCanonicalizer.apply(graph, context); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
206 assert graph.verify(); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
207 } |
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
|
208 |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
209 /** |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
210 * 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
|
211 * 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
|
212 * as part of lowering {@code node}. |
15001 | 213 * |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
214 * @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
|
215 * @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
|
216 * @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
|
217 * lowered |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
218 * @throws AssertionError if the check fails |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
219 */ |
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
|
220 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
|
221 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
|
222 Mark postLoweringMark = graph.getMark(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 } |
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 } |
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 } |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
232 for (Node n : newNodesAfterLowering) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
233 if (n instanceof Lowerable) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
234 ((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
|
235 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
|
236 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
|
237 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
|
238 } |
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
|
239 } |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
240 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
|
241 } |
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
|
242 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
243 private final class Round extends Phase { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
245 private final PhaseContext context; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
246 private final SchedulePhase schedule; |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
247 private final int iteration; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
248 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
249 private Round(int iteration, PhaseContext context) { |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
250 this.iteration = iteration; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
251 this.context = context; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
252 this.schedule = new SchedulePhase(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
255 @Override |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
256 protected CharSequence createName() { |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
257 return "LoweringIteration" + iteration; |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
258 } |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
259 |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
260 @Override |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
261 public void run(StructuredGraph graph) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
262 schedule.apply(graph, false); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
263 processBlock(schedule.getCFG().getStartBlock(), graph.createNodeBitMap(), null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
266 private void processBlock(Block block, NodeBitMap activeGuards, AnchoringNode parentAnchor) { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
267 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
268 AnchoringNode anchor = parentAnchor; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
269 if (anchor == null) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
270 anchor = block.getBeginNode(); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
271 } |
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
|
272 anchor = process(block, activeGuards, anchor); |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
273 |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
274 // Process always reached block first. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
275 Block alwaysReachedBlock = block.getPostdominator(); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
276 if (alwaysReachedBlock != null && alwaysReachedBlock.getDominator() == block) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
277 processBlock(alwaysReachedBlock, activeGuards, anchor); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
278 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
279 |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
280 // Now go for the other dominators. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
281 for (Block dominated : block.getDominated()) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
282 if (dominated != alwaysReachedBlock) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
283 assert dominated.getDominator() == block; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
284 processBlock(dominated, activeGuards, null); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
285 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
286 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
287 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9646
diff
changeset
|
288 if (parentAnchor == null && OptEliminateGuards.getValue()) { |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9376
diff
changeset
|
289 for (GuardNode guard : anchor.asNode().usages().filter(GuardNode.class)) { |
15955
3f48e9a1016c
NodeBitMap refactoring
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15407
diff
changeset
|
290 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
|
291 activeGuards.clear(guard); |
03c781923573
made snippet and substitution graphs lower themselves before being inlined
Doug Simon <doug.simon@oracle.com>
parents:
11705
diff
changeset
|
292 } |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
293 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
297 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
|
298 |
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
|
299 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
|
300 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
301 // Lower the instructions of this block. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
302 List<ScheduledNode> nodes = schedule.nodesFor(b); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
303 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
|
304 |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
305 if (node.isDeleted()) { |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
306 // 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
|
307 continue; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
308 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
310 // 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
|
311 // after lowering. |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
312 FixedNode nextNode = null; |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
313 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
|
314 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
|
315 } else { |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
316 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
|
317 } |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
318 |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
319 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
|
320 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
|
321 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
|
322 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
|
323 ((Lowerable) node).lower(loweringTool); |
13327
e1365fd16104
Make LoweringPhase more robust to disapearing anchors
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13283
diff
changeset
|
324 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
|
325 // 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
|
326 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
|
327 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
|
328 } |
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
|
329 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
|
330 } |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
331 |
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
|
332 if (!nextNode.isAlive()) { |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
333 // 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
|
334 // (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
|
335 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
|
336 } 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
|
337 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
|
338 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
|
339 // 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
|
340 // 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
|
341 // FixedWithNextNode is followed by some kind of BeginNode. |
60f6d5939941
LoweringPhase: add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11798
diff
changeset
|
342 // 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
|
343 // control-split + deopt. |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
344 BeginNode begin = node.graph().add(BeginNode.create()); |
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
|
345 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
|
346 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
|
347 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
|
348 } |
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
|
349 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
|
350 } |
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
|
351 } |
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
|
352 return loweringTool.getCurrentGuardAnchor(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 } |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
354 |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
355 /** |
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
|
356 * 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
|
357 * <p> |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
358 * 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
|
359 * 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
|
360 * 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
|
361 * post-lowering graph still has a valid schedule. |
15001 | 362 * |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
363 * @param node a {@link Lowerable} node |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
364 */ |
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
|
365 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
|
366 List<Node> unscheduledUsages = new ArrayList<>(); |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
367 if (node instanceof FloatingNode) { |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
368 for (Node usage : node.usages()) { |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
369 if (usage instanceof ScheduledNode) { |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
370 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
|
371 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
|
372 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
|
373 } |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
374 } |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
375 } |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
376 } |
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
|
377 return unscheduledUsages; |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
378 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 } |