Mercurial > hg > truffle
annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java @ 19950:5ee90d1bf6cd
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 18 Mar 2015 21:36:35 +0100 |
parents | 6ccf3993b7f2 |
children | 841ab4da4dd8 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
23 package com.oracle.graal.phases.common; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
25 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Options.*; |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
26 |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
27 import java.util.function.*; |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
28 |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.debug.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.nodes.*; |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
32 import com.oracle.graal.options.*; |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
33 import com.oracle.graal.phases.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 public class DeadCodeEliminationPhase extends Phase { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
37 public static class Options { |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
38 // @formatter:off |
18674
ecb9d0cedbab
First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17094
diff
changeset
|
39 @Option(help = "Disable optional dead code eliminations", type = OptionType.Debug) |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
40 public static final OptionValue<Boolean> ReduceDCE = new OptionValue<>(true); |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
41 // @formatter:on |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
42 } |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
43 |
6361
ccdf43a09204
PartialEscapeAnalysis: fix for bailout, better metrics, small renaming
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
44 // Metrics |
ccdf43a09204
PartialEscapeAnalysis: fix for bailout, better metrics, small renaming
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
45 private static final DebugMetric metricNodesRemoved = Debug.metric("NodesRemoved"); |
ccdf43a09204
PartialEscapeAnalysis: fix for bailout, better metrics, small renaming
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
46 |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
47 public enum Optionality { |
17094
86888df288ec
fixed case of Optionality constants
Doug Simon <doug.simon@oracle.com>
parents:
17065
diff
changeset
|
48 Optional, |
86888df288ec
fixed case of Optionality constants
Doug Simon <doug.simon@oracle.com>
parents:
17065
diff
changeset
|
49 Required; |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
50 } |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
51 |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
52 /** |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
53 * Creates a dead code elimination phase that will be run irrespective of |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
54 * {@link Options#ReduceDCE}. |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
55 */ |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
56 public DeadCodeEliminationPhase() { |
17094
86888df288ec
fixed case of Optionality constants
Doug Simon <doug.simon@oracle.com>
parents:
17065
diff
changeset
|
57 this(Optionality.Required); |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
58 } |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
59 |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
60 /** |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
61 * Creates a dead code elimination phase that will be run only if it is |
17094
86888df288ec
fixed case of Optionality constants
Doug Simon <doug.simon@oracle.com>
parents:
17065
diff
changeset
|
62 * {@linkplain Optionality#Required non-optional} or {@link Options#ReduceDCE} is false. |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
63 */ |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
64 public DeadCodeEliminationPhase(Optionality optionality) { |
17094
86888df288ec
fixed case of Optionality constants
Doug Simon <doug.simon@oracle.com>
parents:
17065
diff
changeset
|
65 this.optional = optionality == Optionality.Optional; |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
66 } |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
67 |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
68 private final boolean optional; |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
69 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 @Override |
16187
dd3d62dfa0bd
added DebugVerifyHandler implementation to verify all phases delete dead nodes
Doug Simon <doug.simon@oracle.com>
parents:
13327
diff
changeset
|
71 public void run(StructuredGraph graph) { |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
72 if (optional && ReduceDCE.getValue()) { |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
73 return; |
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16196
diff
changeset
|
74 } |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
75 |
9269
71ebe4030676
Make DeadCodeEliminationPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
76 NodeFlood flood = graph.createNodeFlood(); |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
77 int totalNodeCount = graph.getNodeCount(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 flood.add(graph.start()); |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
79 iterateSuccessorsAndInputs(flood); |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
80 int totalMarkedCount = flood.getTotalMarkedCount(); |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
81 if (totalNodeCount == totalMarkedCount) { |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
82 // All nodes are live => nothing more to do. |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
83 return; |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
84 } else { |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
85 // Some nodes are not marked alive and therefore dead => proceed. |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
86 assert totalNodeCount > totalMarkedCount; |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
87 } |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
88 |
16196
8bf243c2c87b
removed explicit tracking of nodes removed by DeadCodeEliminationPhase; added option to enable NoDeadCodeVerifyHandle (disabled by default for now)
Doug Simon <doug.simon@oracle.com>
parents:
16187
diff
changeset
|
89 deleteNodes(flood, graph); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
92 private static void iterateSuccessorsAndInputs(NodeFlood flood) { |
19584
6ccf3993b7f2
Add additional assertions in DCE.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19553
diff
changeset
|
93 BiConsumer<Node, Node> consumer = (n, succOrInput) -> { |
6ccf3993b7f2
Add additional assertions in DCE.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19553
diff
changeset
|
94 assert succOrInput.isAlive() : succOrInput; |
6ccf3993b7f2
Add additional assertions in DCE.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19553
diff
changeset
|
95 flood.add(succOrInput); |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
96 }; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 for (Node current : flood) { |
9434
50f02c7d1cec
Rename EndNode => AbstractEndNode and make abstract class. Introduce concrete EndNode subclass.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9269
diff
changeset
|
98 if (current instanceof AbstractEndNode) { |
50f02c7d1cec
Rename EndNode => AbstractEndNode and make abstract class. Introduce concrete EndNode subclass.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9269
diff
changeset
|
99 AbstractEndNode end = (AbstractEndNode) current; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 flood.add(end.merge()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 } else { |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
102 current.acceptSuccessors(consumer); |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
103 current.acceptInputs(consumer); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 |
16196
8bf243c2c87b
removed explicit tracking of nodes removed by DeadCodeEliminationPhase; added option to enable NoDeadCodeVerifyHandle (disabled by default for now)
Doug Simon <doug.simon@oracle.com>
parents:
16187
diff
changeset
|
108 private static void deleteNodes(NodeFlood flood, StructuredGraph graph) { |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
109 BiConsumer<Node, Node> consumer = (n, input) -> { |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
110 if (input.isAlive() && flood.isMarked(input)) { |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
111 input.removeUsage(n); |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
112 } |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
113 }; |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
114 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 for (Node node : graph.getNodes()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 if (!flood.isMarked(node)) { |
19553
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
117 node.markDeleted(); |
6bff0b223124
Reduce complexity of DCE. We do not need to deal with incoming dead merge branches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
118 node.acceptInputs(consumer); |
6361
ccdf43a09204
PartialEscapeAnalysis: fix for bailout, better metrics, small renaming
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
119 metricNodesRemoved.increment(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 } |