Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java @ 15611:9129a2237dd8
clean up frame states during FrameStateAssignmentPhase
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 13 May 2014 16:16:05 +0200 |
parents | 4e3c2247daf4 |
children | 342fe74e3b90 |
rev | line source |
---|---|
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.phases.common; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
24 |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
25 import java.util.*; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
26 |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15145
diff
changeset
|
27 import com.oracle.graal.compiler.common.*; |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
28 import com.oracle.graal.graph.*; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
29 import com.oracle.graal.graph.iterators.*; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
30 import com.oracle.graal.nodes.*; |
11626
340e67bf1758
Rename GuardsPhase to GuardsStage to avoid confusion with existing Phases
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11579
diff
changeset
|
31 import com.oracle.graal.nodes.StructuredGraph.GuardsStage; |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
32 import com.oracle.graal.nodes.util.*; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
33 import com.oracle.graal.phases.*; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
34 import com.oracle.graal.phases.graph.*; |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
35 import com.oracle.graal.phases.graph.ReentrantNodeIterator.NodeIteratorClosure; |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
36 |
11627
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
37 /** |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
38 * This phase transfers {@link FrameState} nodes from {@link StateSplit} nodes to |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
39 * {@link DeoptimizingNode DeoptimizingNodes}. |
14941
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
40 * |
11627
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
41 * This allow to enter the {@link GuardsStage#AFTER_FSA AFTER_FSA} stage of the graph where no new |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
42 * node that may cause deoptimization can be introduced anymore. |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
43 * <p> |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
44 * This Phase processes the graph in post order, assigning the {@link FrameState} from the last |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
45 * {@link StateSplit} node to {@link DeoptimizingNode DeoptimizingNodes}. |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
46 */ |
8983
6c4ac1a8cd20
Run dead code elimination after framestate assignment
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8957
diff
changeset
|
47 public class FrameStateAssignmentPhase extends Phase { |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
48 |
9730 | 49 private static class FrameStateAssignmentClosure extends NodeIteratorClosure<FrameState> { |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
50 |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
51 @Override |
14941
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
52 protected FrameState processNode(FixedNode node, FrameState previousState) { |
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
53 FrameState currentState = previousState; |
14734
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
54 if (node instanceof DeoptimizingNode.DeoptBefore) { |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
55 DeoptimizingNode.DeoptBefore deopt = (DeoptimizingNode.DeoptBefore) node; |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
56 if (deopt.canDeoptimize() && deopt.stateBefore() == null) { |
9878
d0a007fb65af
simplify FrameStateAssignmentPhase, add guarantee that every DeoptimizingNode has a FrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
9730
diff
changeset
|
57 GraalInternalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt); |
14734
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
58 deopt.setStateBefore(currentState); |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
59 } |
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
60 } |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
61 |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
62 if (node instanceof StateSplit) { |
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
63 StateSplit stateSplit = (StateSplit) node; |
14536
b3937b8b9ae1
tiny change in FrameStateAssignmentPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13283
diff
changeset
|
64 FrameState stateAfter = stateSplit.stateAfter(); |
b3937b8b9ae1
tiny change in FrameStateAssignmentPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13283
diff
changeset
|
65 if (stateAfter != null) { |
14941
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
66 currentState = stateAfter; |
9633
5207bb46598e
simplify "clever" code in FrameStateAssignmentPhase
Lukas Stadler <lukas.stadler@jku.at>
parents:
9624
diff
changeset
|
67 stateSplit.setStateAfter(null); |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
68 } |
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
69 } |
14734
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
70 |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
71 if (node instanceof DeoptimizingNode.DeoptDuring) { |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
72 DeoptimizingNode.DeoptDuring deopt = (DeoptimizingNode.DeoptDuring) node; |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
73 if (deopt.canDeoptimize()) { |
14941
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
74 GraalInternalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt); |
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
75 deopt.computeStateDuring(currentState); |
14734
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
76 } |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
77 } |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
78 |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
79 if (node instanceof DeoptimizingNode.DeoptAfter) { |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
80 DeoptimizingNode.DeoptAfter deopt = (DeoptimizingNode.DeoptAfter) node; |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
81 if (deopt.canDeoptimize() && deopt.stateAfter() == null) { |
14941
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
82 GraalInternalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt); |
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
83 deopt.setStateAfter(currentState); |
14734
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
84 } |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
85 } |
6ae9af961b7c
Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents:
14536
diff
changeset
|
86 |
14941
8c3d77087894
Code cleanup in FrameStateAssignmentPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
14734
diff
changeset
|
87 return currentState; |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
88 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
89 |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
90 @Override |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
91 protected FrameState merge(MergeNode merge, List<FrameState> states) { |
9878
d0a007fb65af
simplify FrameStateAssignmentPhase, add guarantee that every DeoptimizingNode has a FrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
9730
diff
changeset
|
92 return merge.stateAfter() != null ? merge.stateAfter() : singleFrameState(merge, states); |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
93 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
94 |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
95 @Override |
15145
df2ef5204f2b
Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14941
diff
changeset
|
96 protected FrameState afterSplit(BeginNode node, FrameState oldState) { |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
97 return oldState; |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
98 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
99 |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
100 @Override |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
101 protected Map<LoopExitNode, FrameState> processLoop(LoopBeginNode loop, FrameState initialState) { |
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
102 return ReentrantNodeIterator.processLoop(this, loop, initialState).exitStates; |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
103 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
104 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
105 |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
106 @Override |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
107 protected void run(StructuredGraph graph) { |
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:
11705
diff
changeset
|
108 assert graph.getGuardsStage().ordinal() >= GuardsStage.FIXED_DEOPTS.ordinal() && checkFixedDeopts(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:
11705
diff
changeset
|
109 if (graph.getGuardsStage().ordinal() < GuardsStage.AFTER_FSA.ordinal()) { |
15467
4e3c2247daf4
simplify ReentrantNodeIterator
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15193
diff
changeset
|
110 ReentrantNodeIterator.apply(new FrameStateAssignmentClosure(), graph.start(), null); |
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:
11705
diff
changeset
|
111 graph.setGuardsStage(GuardsStage.AFTER_FSA); |
15611
9129a2237dd8
clean up frame states during FrameStateAssignmentPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15467
diff
changeset
|
112 graph.getNodes(FrameState.class).filter(state -> state.usages().isEmpty()).forEach(GraphUtil::killWithUnusedFloatingInputs); |
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:
11705
diff
changeset
|
113 } |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
114 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
115 |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
116 private static boolean checkFixedDeopts(StructuredGraph graph) { |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
117 NodePredicate isFloatingNode = GraphUtil.isFloatingNode(); |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
118 for (Node n : graph.getNodes().filterInterface(DeoptimizingNode.class)) { |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
119 if (((DeoptimizingNode) n).canDeoptimize() && isFloatingNode.apply(n)) { |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
120 return false; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
121 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
122 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
123 return true; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
124 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
125 |
9624
87eafaddf9d9
let ReentrantBlockIterator.processBlock return the next state
Lukas Stadler <lukas.stadler@jku.at>
parents:
9387
diff
changeset
|
126 private static FrameState singleFrameState(@SuppressWarnings("unused") MergeNode merge, List<FrameState> states) { |
9878
d0a007fb65af
simplify FrameStateAssignmentPhase, add guarantee that every DeoptimizingNode has a FrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
9730
diff
changeset
|
127 FrameState singleState = states.get(0); |
9381
addc2a25d727
Implement merging of frame states if they differ at a merge that does not have its own frame state.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8983
diff
changeset
|
128 for (int i = 1; i < states.size(); ++i) { |
9878
d0a007fb65af
simplify FrameStateAssignmentPhase, add guarantee that every DeoptimizingNode has a FrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
9730
diff
changeset
|
129 if (states.get(i) != singleState) { |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
130 return null; |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
131 } |
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
132 } |
9878
d0a007fb65af
simplify FrameStateAssignmentPhase, add guarantee that every DeoptimizingNode has a FrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
9730
diff
changeset
|
133 return singleState; |
9381
addc2a25d727
Implement merging of frame states if they differ at a merge that does not have its own frame state.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8983
diff
changeset
|
134 } |
8957
1af9b5d75139
Move framestate assignement to the hir
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
135 } |