Mercurial > hg > truffle
annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java @ 19526:8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 22:22:55 +0100 |
parents | 61d3cb8e1280 |
children | 6b73ce815fc2 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19250
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
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 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
29 import com.oracle.graal.api.meta.*; |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15259
diff
changeset
|
30 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
|
31 import com.oracle.graal.graph.Graph.Mark; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 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
|
33 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
|
34 import com.oracle.graal.nodeinfo.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.nodes.*; |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
36 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
|
37 import com.oracle.graal.nodes.cfg.*; |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9376
diff
changeset
|
38 import com.oracle.graal.nodes.extended.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 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
|
40 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
|
41 import com.oracle.graal.phases.schedule.*; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
42 import com.oracle.graal.phases.tiers.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
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
|
44 /** |
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 * 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
|
46 */ |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
47 public class LoweringPhase extends BasePhase<PhaseContext> { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
16838
27f457a47a44
removed @NodeInfo from non-Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
49 @NodeInfo |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19250
diff
changeset
|
50 static final class DummyGuardHandle extends ValueNode implements GuardedNode { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
51 public static final NodeClass<DummyGuardHandle> TYPE = NodeClass.create(DummyGuardHandle.class); |
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) { |
19396
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19250
diff
changeset
|
55 super(TYPE, StampFactory.forVoid()); |
16838
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; |
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
|
80 |
18966
1eeef8016b86
Do not provide full schedul to LoweringTool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18941
diff
changeset
|
81 public LoweringToolImpl(PhaseContext context, AnchoringNode guardAnchor, NodeBitMap activeGuards, FixedWithNextNode lastFixedNode) { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
82 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
|
83 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
|
84 this.activeGuards = activeGuards; |
11500
d2f31e6ddc35
LoweringTool: pass initial lastFixedNode to constructor
Bernhard Urban <bernhard.urban@jku.at>
parents:
11462
diff
changeset
|
85 this.lastFixedNode = lastFixedNode; |
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
|
86 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
87 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
88 @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
|
89 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
|
90 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
|
91 } |
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 |
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 @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
|
94 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
|
95 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
|
96 } |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
97 |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
98 @Override |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11804
diff
changeset
|
99 public MetaAccessProvider getMetaAccess() { |
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11804
diff
changeset
|
100 return context.getMetaAccess(); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
101 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
102 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
103 @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
|
104 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
|
105 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
|
106 } |
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 |
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 @Override |
8638
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
109 public Replacements getReplacements() { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
110 return context.getReplacements(); |
8638
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
111 } |
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
112 |
8d6265614e13
added getReplacements() to LoweringTool
Doug Simon <doug.simon@oracle.com>
parents:
8298
diff
changeset
|
113 @Override |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
114 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
|
115 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
|
116 } |
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 |
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 @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
|
119 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
|
120 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
|
121 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
122 |
18479
16e61bb57e90
Introduce StampProvider to support different stamps for metadata on different VMs.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
123 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
|
124 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
|
125 } |
16e61bb57e90
Introduce StampProvider to support different stamps for metadata on different VMs.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
126 |
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
|
127 @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
|
128 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
|
129 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
|
130 for (Node usage : condition.usages()) { |
18398
728637aa02e6
Rename GuardNode.negated to GuardNode.isNegated
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18187
diff
changeset
|
131 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
|
132 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
|
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 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
135 } |
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
|
136 StructuredGraph graph = before.graph(); |
18970
edf3a7fdd067
Add utility methods to GuardsStage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18966
diff
changeset
|
137 if (!condition.graph().getGuardsStage().allowsFloatingGuards()) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
138 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
|
139 graph.addBeforeFixed(before, fixedGuard); |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
140 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
|
141 fixedGuard.lower(this); |
17137
ac687cfbed21
Delete temporary node
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16919
diff
changeset
|
142 GuardingNode result = handle.getGuard(); |
ac687cfbed21
Delete temporary node
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16919
diff
changeset
|
143 handle.safeDelete(); |
ac687cfbed21
Delete temporary node
Christian Wimmer <christian.wimmer@oracle.com>
parents:
16919
diff
changeset
|
144 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
|
145 } else { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18490
diff
changeset
|
146 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
|
147 if (OptEliminateGuards.getValue()) { |
15955
3f48e9a1016c
NodeBitMap refactoring
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15407
diff
changeset
|
148 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
|
149 } |
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 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
|
151 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
152 } |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
153 |
5d7d9a6953bd
added InstanceOfSnippets which passes InstanceOfTest but is not yet enabled for general lowering
Doug Simon <doug.simon@oracle.com>
parents:
6285
diff
changeset
|
154 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
|
155 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
|
156 } |
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
|
157 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
158 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
|
159 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
|
160 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
|
161 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
162 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
163 |
11566
aa9ce8d56771
New methods for incremental canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents:
11500
diff
changeset
|
164 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
|
165 private final LoweringTool.LoweringStage loweringStage; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 |
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
|
167 public LoweringPhase(CanonicalizerPhase canonicalizer, LoweringTool.LoweringStage loweringStage) { |
11566
aa9ce8d56771
New methods for incremental canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents:
11500
diff
changeset
|
168 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
|
169 this.loweringStage = loweringStage; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5397
diff
changeset
|
171 |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
172 /** |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
173 * Checks that second lowering of a given graph did not introduce any new nodes. |
15001 | 174 * |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
175 * @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
|
176 * @throws AssertionError if the check fails |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
177 */ |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
178 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
|
179 Mark expectedMark = graph.getMark(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
180 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
|
181 Mark mark = graph.getMark(); |
13126
c07055d2c66e
Fix assertion error message
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12703
diff
changeset
|
182 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
|
183 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
|
184 } |
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
|
185 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 @Override |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
187 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
|
188 lower(graph, context, 0); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
189 assert checkPostLowering(graph, context); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
190 } |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
191 |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
192 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
|
193 IncrementalCanonicalizerPhase<PhaseContext> incrementalCanonicalizer = new IncrementalCanonicalizerPhase<>(canonicalizer); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
194 incrementalCanonicalizer.appendPhase(new Round(i, context)); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
195 incrementalCanonicalizer.apply(graph, context); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
196 assert graph.verify(); |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
197 } |
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
|
198 |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
199 /** |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
200 * 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
|
201 * 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
|
202 * as part of lowering {@code node}. |
15001 | 203 * |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
204 * @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
|
205 * @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
|
206 * @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
|
207 * lowered |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
208 * @throws AssertionError if the check fails |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
209 */ |
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
|
210 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
|
211 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
|
212 Mark postLoweringMark = graph.getMark(); |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 } |
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 } |
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
|
221 } |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
222 for (Node n : newNodesAfterLowering) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
223 if (n instanceof Lowerable) { |
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
224 ((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
|
225 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
|
226 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
|
227 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
|
228 } |
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
|
229 } |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
230 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
|
231 } |
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
|
232 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
233 private final class Round extends Phase { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
235 private final PhaseContext context; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
236 private final SchedulePhase schedule; |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
237 private final int iteration; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
238 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
239 private Round(int iteration, PhaseContext context) { |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
240 this.iteration = iteration; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
241 this.context = context; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
242 this.schedule = new SchedulePhase(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 } |
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 @Override |
15407
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
246 protected CharSequence createName() { |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
247 return "LoweringIteration" + iteration; |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
248 } |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
249 |
2ca44250eee3
removed unnecessary String creation
Doug Simon <doug.simon@oracle.com>
parents:
15261
diff
changeset
|
250 @Override |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
251 public void run(StructuredGraph graph) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
252 schedule.apply(graph, false); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
253 processBlock(schedule.getCFG().getStartBlock(), graph.createNodeBitMap(), null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
256 private void processBlock(Block block, NodeBitMap activeGuards, AnchoringNode parentAnchor) { |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
257 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
258 AnchoringNode anchor = parentAnchor; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
259 if (anchor == null) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
260 anchor = block.getBeginNode(); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
261 } |
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
|
262 anchor = process(block, activeGuards, anchor); |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
263 |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
264 // Process always reached block first. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
265 Block alwaysReachedBlock = block.getPostdominator(); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
266 if (alwaysReachedBlock != null && alwaysReachedBlock.getDominator() == block) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
267 processBlock(alwaysReachedBlock, activeGuards, anchor); |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
268 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
269 |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
270 // Now go for the other dominators. |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
271 for (Block dominated : block.getDominated()) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
272 if (dominated != alwaysReachedBlock) { |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
273 assert dominated.getDominator() == block; |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
274 processBlock(dominated, activeGuards, null); |
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 } |
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
277 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9646
diff
changeset
|
278 if (parentAnchor == null && OptEliminateGuards.getValue()) { |
9646
183d33c76419
Removed ValueNode.dependencies
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9376
diff
changeset
|
279 for (GuardNode guard : anchor.asNode().usages().filter(GuardNode.class)) { |
15955
3f48e9a1016c
NodeBitMap refactoring
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15407
diff
changeset
|
280 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
|
281 activeGuards.clear(guard); |
03c781923573
made snippet and substitution graphs lower themselves before being inlined
Doug Simon <doug.simon@oracle.com>
parents:
11705
diff
changeset
|
282 } |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
283 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
287 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
|
288 |
18966
1eeef8016b86
Do not provide full schedul to LoweringTool.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18941
diff
changeset
|
289 final LoweringToolImpl loweringTool = new LoweringToolImpl(context, startAnchor, activeGuards, b.getBeginNode()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
291 // 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
|
292 List<ValueNode> nodes = schedule.nodesFor(b); |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
293 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
|
294 |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
295 if (node.isDeleted()) { |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
296 // 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
|
297 continue; |
9267
950a385e059b
Make LoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9266
diff
changeset
|
298 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
300 // 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
|
301 // after lowering. |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
302 FixedNode nextNode = null; |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
303 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
|
304 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
|
305 } else { |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
306 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
|
307 } |
10422
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
308 |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
309 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
|
310 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
|
311 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
|
312 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
|
313 ((Lowerable) node).lower(loweringTool); |
13324
e1365fd16104
Make LoweringPhase more robust to disapearing anchors
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13283
diff
changeset
|
314 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
|
315 // 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
|
316 assert nextNode.isAlive(); |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18970
diff
changeset
|
317 loweringTool.guardAnchor = AbstractBeginNode.prevBegin(nextNode); |
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
|
318 } |
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
|
319 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
|
320 } |
a47dd157277e
Simplified lowering phase. Removed "deferred" lowering. Removed custom setLastFixedNode method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10029
diff
changeset
|
321 |
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
|
322 if (!nextNode.isAlive()) { |
11798
2fbb9fd55dde
made lowering recursive instead of iterative
Doug Simon <doug.simon@oracle.com>
parents:
11732
diff
changeset
|
323 // 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
|
324 // (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
|
325 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
|
326 } 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
|
327 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
|
328 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
|
329 // 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
|
330 // 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
|
331 // FixedWithNextNode is followed by some kind of BeginNode. |
60f6d5939941
LoweringPhase: add comment
Bernhard Urban <bernhard.urban@jku.at>
parents:
11798
diff
changeset
|
332 // 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
|
333 // control-split + deopt. |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
334 AbstractBeginNode 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
|
335 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
|
336 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
|
337 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
|
338 } |
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
|
339 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
|
340 } |
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
|
341 } |
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
|
342 return loweringTool.getCurrentGuardAnchor(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 } |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
344 |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
345 /** |
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
|
346 * 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
|
347 * <p> |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
348 * 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
|
349 * 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
|
350 * 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
|
351 * post-lowering graph still has a valid schedule. |
15001 | 352 * |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
353 * @param node a {@link Lowerable} node |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
354 */ |
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
|
355 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
|
356 List<Node> unscheduledUsages = new ArrayList<>(); |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
357 if (node instanceof FloatingNode) { |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
358 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
|
359 if (usage instanceof ValueNode) { |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
360 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
|
361 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
|
362 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
|
363 } |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
364 } |
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
365 } |
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 return unscheduledUsages; |
10693
f8adf47cc05e
checkcast is lowered to instanceof (GRAAL-248)
Doug Simon <doug.simon@oracle.com>
parents:
10660
diff
changeset
|
368 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 } |