Mercurial > hg > truffle
annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java @ 21070:2ee48d02afe3
mx: Merge graal service files
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 21 Apr 2015 16:44:27 +0200 |
parents | 3e41eb69def4 |
children | cba35d171cd1 |
rev | line source |
---|---|
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
16895
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.phases.common; |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
24 |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15192
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 |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
27 import java.util.*; |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
28 import java.util.Map.Entry; |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
29 |
13723
1834ae0bc965
GuardLowering: do not use trapping accesses for guards with a speculation
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13641
diff
changeset
|
30 import com.oracle.graal.api.meta.*; |
15192
644dfe49c0f4
Move packages com.oracle.graal.cfg to com.oracle.graal.compiler.common.cfg.
Josef Eisl <josef.eisl@jku.at>
parents:
15157
diff
changeset
|
31 import com.oracle.graal.compiler.common.cfg.*; |
13323
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13290
diff
changeset
|
32 import com.oracle.graal.debug.*; |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
33 import com.oracle.graal.graph.*; |
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
34 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
|
35 import com.oracle.graal.nodes.StructuredGraph.GuardsStage; |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
36 import com.oracle.graal.nodes.calc.*; |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
37 import com.oracle.graal.nodes.cfg.*; |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
38 import com.oracle.graal.nodes.extended.*; |
8299
22cab6e509a3
Remove orphaned condition in implicit null check detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8296
diff
changeset
|
39 import com.oracle.graal.nodes.util.*; |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
40 import com.oracle.graal.phases.*; |
10081
20fd8760cb34
pull ScheduledNodeIterator into separate class
Lukas Stadler <lukas.stadler@jku.at>
parents:
9864
diff
changeset
|
41 import com.oracle.graal.phases.graph.*; |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
42 import com.oracle.graal.phases.schedule.*; |
11719
0b1f0763bb18
Use earliest schedule for guards
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11715
diff
changeset
|
43 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy; |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
44 import com.oracle.graal.phases.tiers.*; |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
45 |
11396
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
46 /** |
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
47 * This phase lowers {@link GuardNode GuardNodes} into corresponding control-flow structure and |
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
48 * {@link DeoptimizeNode DeoptimizeNodes}. |
14976
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
49 * |
11627
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
50 * This allow to enter the {@link GuardsStage#FIXED_DEOPTS FIXED_DEOPTS} stage of the graph where |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
51 * all node that may cause deoptimization are fixed. |
1ca5e39d0433
Add javadoc to GuardsStage and FrameStateAssignmentPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11626
diff
changeset
|
52 * <p> |
11396
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
53 * It first makes a schedule in order to know where the control flow should be placed. Then, for |
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
54 * each block, it applies two passes. The first one tries to replace null-check guards with implicit |
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
55 * null checks performed by access to the objects that need to be null checked. The second phase |
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
56 * does the actual control-flow expansion of the remaining {@link GuardNode GuardNodes}. |
a268b0de65d6
Add some javadoc for GuardLoweringPhase, ConvertDeoptimizeToGuardPhase and DeoptimizeNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10081
diff
changeset
|
57 */ |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
58 public class GuardLoweringPhase extends BasePhase<MidTierContext> { |
14713
c8fb80093621
metric for number of implicit null checks in GuardLoweringPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13723
diff
changeset
|
59 |
c8fb80093621
metric for number of implicit null checks in GuardLoweringPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13723
diff
changeset
|
60 private static final DebugMetric metricImplicitNullCheck = Debug.metric("ImplicitNullCheck"); |
c8fb80093621
metric for number of implicit null checks in GuardLoweringPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13723
diff
changeset
|
61 |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
62 private static class UseImplicitNullChecks extends ScheduledNodeIterator { |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
63 |
18383
1518c3296cc8
use deterministic iteration order Set and Map data structures when in the scope of a replay compilation context
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
64 private final Map<ValueNode, GuardNode> nullGuarded = Node.newIdentityMap(); |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
65 private final int implicitNullCheckLimit; |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
66 |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
67 UseImplicitNullChecks(int implicitNullCheckLimit) { |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
68 this.implicitNullCheckLimit = implicitNullCheckLimit; |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
69 } |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
70 |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
71 @Override |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
72 protected void processNode(Node node) { |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
73 if (node instanceof GuardNode) { |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
74 processGuard(node); |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
75 } else if (node instanceof Access) { |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
76 processAccess((Access) node); |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
77 } |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
78 if (node instanceof StateSplit && ((StateSplit) node).stateAfter() != null) { |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
79 nullGuarded.clear(); |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
80 } else { |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
81 Iterator<Entry<ValueNode, GuardNode>> it = nullGuarded.entrySet().iterator(); |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
82 while (it.hasNext()) { |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
83 Entry<ValueNode, GuardNode> entry = it.next(); |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
84 GuardNode guard = entry.getValue(); |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
85 if (guard.usages().contains(node)) { |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
86 it.remove(); |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
87 } |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
88 } |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
89 } |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
90 } |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
91 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
92 private void processAccess(Access access) { |
14976
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
93 if (access.canNullCheck()) { |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
94 GuardNode guard = nullGuarded.get(access.object()); |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
95 if (guard != null && isImplicitNullCheck(access.accessLocation())) { |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
96 metricImplicitNullCheck.increment(); |
15008
01fdabd19cd5
new AnchoringNode interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14976
diff
changeset
|
97 access.setGuard(null); |
14976
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
98 FixedAccessNode fixedAccess; |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
99 if (access instanceof FloatingAccessNode) { |
16402
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
100 FloatingAccessNode floatingAccessNode = (FloatingAccessNode) access; |
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
101 MemoryNode lastLocationAccess = floatingAccessNode.getLastLocationAccess(); |
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
102 fixedAccess = floatingAccessNode.asFixedNode(); |
14976
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
103 replaceCurrent(fixedAccess); |
16402
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
104 if (lastLocationAccess != null) { |
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
105 // fixed accesses are not currently part of the memory graph |
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
106 GraphUtil.tryKillUnused(lastLocationAccess.asNode()); |
639716622dc8
GuardLoweringPhase should not leave dead nodes behind
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16251
diff
changeset
|
107 } |
14976
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
108 } else { |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
109 fixedAccess = (FixedAccessNode) access; |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
110 } |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
111 fixedAccess.setNullCheck(true); |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
112 LogicNode condition = guard.condition(); |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
113 guard.replaceAndDelete(fixedAccess); |
18937
ff232ff8d028
Add utility Node#hasNoUsages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
114 if (condition.hasNoUsages()) { |
14976
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
115 GraphUtil.killWithUnusedFloatingInputs(condition); |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
116 } |
82399ac30721
make implicit null checking optional for Access nodes (fixes CAS crash)
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14713
diff
changeset
|
117 nullGuarded.remove(fixedAccess.object()); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
118 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
119 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
120 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
121 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
122 private void processGuard(Node node) { |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
123 GuardNode guard = (GuardNode) node; |
18490
ca81508f2a19
Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
18398
diff
changeset
|
124 if (guard.isNegated() && guard.condition() instanceof IsNullNode && (guard.getSpeculation() == null || guard.getSpeculation().equals(JavaConstant.NULL_POINTER))) { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15551
diff
changeset
|
125 ValueNode obj = ((IsNullNode) guard.condition()).getValue(); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
126 nullGuarded.put(obj, guard); |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
127 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
128 } |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
129 |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
130 private boolean isImplicitNullCheck(LocationNode location) { |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
131 if (location instanceof ConstantLocationNode) { |
9525
038fa65cbd8d
Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9512
diff
changeset
|
132 return ((ConstantLocationNode) location).getDisplacement() < implicitNullCheckLimit; |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
133 } else { |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
134 return false; |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
135 } |
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
136 } |
8295
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
137 } |
60f90b4b6a12
Implement implicit null check on HIR during guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8221
diff
changeset
|
138 |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
139 private static class LowerGuards extends ScheduledNodeIterator { |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
140 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
141 private final Block block; |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13323
diff
changeset
|
142 private boolean useGuardIdAsDebugId; |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
143 |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13323
diff
changeset
|
144 public LowerGuards(Block block, boolean useGuardIdAsDebugId) { |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
145 this.block = block; |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13323
diff
changeset
|
146 this.useGuardIdAsDebugId = useGuardIdAsDebugId; |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
147 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
148 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
149 @Override |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
150 protected void processNode(Node node) { |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
151 if (node instanceof GuardNode) { |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
152 GuardNode guard = (GuardNode) node; |
13154
1e22792abdbc
Make GuardNode extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
12719
diff
changeset
|
153 FixedWithNextNode lowered = guard.lowerGuard(); |
1e22792abdbc
Make GuardNode extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
12719
diff
changeset
|
154 if (lowered != null) { |
1e22792abdbc
Make GuardNode extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
12719
diff
changeset
|
155 replaceCurrent(lowered); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
156 } else { |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
157 lowerToIf(guard); |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
158 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
159 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
160 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
161 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
162 private void lowerToIf(GuardNode guard) { |
9602
19c5a07c7843
Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
163 StructuredGraph graph = guard.graph(); |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
164 AbstractBeginNode fastPath = graph.add(new BeginNode()); |
12699
38b84d5a66fd
Start passing down a 'speculation id' to deoptimizations.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11719
diff
changeset
|
165 @SuppressWarnings("deprecation") |
19647
3e41eb69def4
Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18994
diff
changeset
|
166 int debugId = useGuardIdAsDebugId ? guard.getId() : DeoptimizeNode.DEFAULT_DEBUG_ID; |
3e41eb69def4
Give a debugId to DeoptimizeNodes that do not come from Guard lowering
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
18994
diff
changeset
|
167 DeoptimizeNode deopt = graph.add(new DeoptimizeNode(guard.action(), guard.reason(), debugId, guard.getSpeculation(), null)); |
18994
8b4ef818169c
Make AbstractBeginNode an abstract class and create concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
168 AbstractBeginNode deoptBranch = BeginNode.begin(deopt); |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18970
diff
changeset
|
169 AbstractBeginNode trueSuccessor; |
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18970
diff
changeset
|
170 AbstractBeginNode falseSuccessor; |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
171 insertLoopExits(deopt); |
18398
728637aa02e6
Rename GuardNode.negated to GuardNode.isNegated
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
18383
diff
changeset
|
172 if (guard.isNegated()) { |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
173 trueSuccessor = deoptBranch; |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
174 falseSuccessor = fastPath; |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
175 } else { |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
176 trueSuccessor = fastPath; |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
177 falseSuccessor = deoptBranch; |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
178 } |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18814
diff
changeset
|
179 IfNode ifNode = graph.add(new IfNode(guard.condition(), trueSuccessor, falseSuccessor, trueSuccessor == fastPath ? 1 : 0)); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
180 guard.replaceAndDelete(fastPath); |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
181 insert(ifNode, fastPath); |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
182 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
183 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
184 private void insertLoopExits(DeoptimizeNode deopt) { |
15108
b6711b514576
Remove LoopBeginNode loopBegin() from Loop.
Josef Eisl <josef.eisl@jku.at>
parents:
15107
diff
changeset
|
185 Loop<Block> loop = block.getLoop(); |
9602
19c5a07c7843
Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
186 StructuredGraph graph = deopt.graph(); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
187 while (loop != null) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18814
diff
changeset
|
188 LoopExitNode exit = graph.add(new LoopExitNode((LoopBeginNode) loop.getHeader().getBeginNode())); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
189 graph.addBeforeFixed(deopt, exit); |
15534
4bd6ad45ee0a
Encapsulate members of Loop.
Josef Eisl <josef.eisl@jku.at>
parents:
15259
diff
changeset
|
190 loop = loop.getParent(); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
191 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
192 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
193 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
194 |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
195 @Override |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
196 protected void run(StructuredGraph graph, MidTierContext context) { |
18970
edf3a7fdd067
Add utility methods to GuardsStage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18937
diff
changeset
|
197 if (graph.getGuardsStage().allowsFloatingGuards()) { |
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:
13154
diff
changeset
|
198 SchedulePhase schedule = new SchedulePhase(SchedulingStrategy.EARLIEST); |
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13154
diff
changeset
|
199 schedule.apply(graph); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
200 |
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:
13154
diff
changeset
|
201 for (Block block : schedule.getCFG().getBlocks()) { |
13284
a3500d145fe1
make GuardLoweringPhase work even when no context can provide an implicitNullCheckLimit
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13283
diff
changeset
|
202 processBlock(block, schedule, context != null ? context.getTarget().implicitNullCheckLimit : 0); |
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:
13154
diff
changeset
|
203 } |
17c9afa0bfcb
Allow GuardLoweringPhase, FrameStateAssignementPhase and the different lowerings to work with graph at any valid guards stage
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13154
diff
changeset
|
204 graph.setGuardsStage(GuardsStage.FIXED_DEOPTS); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
205 } |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11396
diff
changeset
|
206 |
18814
cf984e876194
Simplify assertion in GuardLoweringPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18812
diff
changeset
|
207 assert assertNoGuardsLeft(graph); |
18812
c9d5decf4c27
Remove GuardNode from iterable node types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
208 } |
c9d5decf4c27
Remove GuardNode from iterable node types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
209 |
18814
cf984e876194
Simplify assertion in GuardLoweringPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18812
diff
changeset
|
210 private static boolean assertNoGuardsLeft(StructuredGraph graph) { |
cf984e876194
Simplify assertion in GuardLoweringPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18812
diff
changeset
|
211 assert graph.getNodes().filter(GuardNode.class).isEmpty(); |
18812
c9d5decf4c27
Remove GuardNode from iterable node types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18490
diff
changeset
|
212 return true; |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
213 } |
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
214 |
9268
2d80e5f17bf8
Make GuardLoweringPhase reentrant.
Roland Schatz <roland.schatz@oracle.com>
parents:
9203
diff
changeset
|
215 private static void processBlock(Block block, SchedulePhase schedule, int implicitNullCheckLimit) { |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9646
diff
changeset
|
216 if (OptImplicitNullChecks.getValue() && implicitNullCheckLimit > 0) { |
11715
100e196f8728
ScheduledNodeIterator needs to be able to reconnect even if something is inserted after the last fixed node of a block when there is only one successor
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11705
diff
changeset
|
217 new UseImplicitNullChecks(implicitNullCheckLimit).processNodes(block, schedule); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
218 } |
13323
48e821e409eb
Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13290
diff
changeset
|
219 new LowerGuards(block, Debug.isDumpEnabledForMethod() || Debug.isLogEnabledForMethod()).processNodes(block, schedule); |
8404
24ddd568aa0c
Refactor GuardLoweringPhase: use the same iterator code for implict null checks and guard lowering
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8403
diff
changeset
|
220 } |
8207
ed880b9992b4
Add GuardLoweringPhase which transforms floating guards into fixed if+deopt
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
221 } |