annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java @ 11335:ccbbb7dbca69

Make sure the created ProxyNode is of PhiType.Guard.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 16 Aug 2013 21:40:42 +0200
parents a07d9113d1f6
children a268b0de65d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
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;
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.util.*;
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 import com.oracle.graal.debug.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
28 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.nodes.*;
8382
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
30 import com.oracle.graal.nodes.util.*;
6526
ee651c726397 split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents: 6525
diff changeset
31 import com.oracle.graal.phases.*;
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 public class ConvertDeoptimizeToGuardPhase extends Phase {
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
35 private static AbstractBeginNode findBeginNode(Node startNode) {
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 Node n = startNode;
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 while (true) {
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
38 if (n instanceof AbstractBeginNode) {
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
39 return (AbstractBeginNode) n;
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 } else {
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 n = n.predecessor();
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 }
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 }
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 }
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 @Override
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 protected void run(final StructuredGraph graph) {
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
48 if (graph.getNodes(DeoptimizeNode.class).isEmpty()) {
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 return;
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 }
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
52 for (DeoptimizeNode d : graph.getNodes(DeoptimizeNode.class)) {
8384
0edb2a515cb1 Fixes a corner case when killing the control flowing into a deoptimize node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8382
diff changeset
53 assert d.isAlive();
5095
57ae0b1cc74a Fix possible endless recursion in ConvertDeoptimizeToGuardPhase.
Andreas Woess <andreas.woess@jku.at>
parents: 5061
diff changeset
54 visitDeoptBegin(findBeginNode(d), d, graph);
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 }
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 new DeadCodeEliminationPhase().apply(graph);
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
59
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
60 private void visitDeoptBegin(AbstractBeginNode deoptBegin, DeoptimizeNode deopt, StructuredGraph graph) {
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
61 if (deoptBegin instanceof MergeNode) {
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
62 MergeNode mergeNode = (MergeNode) deoptBegin;
5095
57ae0b1cc74a Fix possible endless recursion in ConvertDeoptimizeToGuardPhase.
Andreas Woess <andreas.woess@jku.at>
parents: 5061
diff changeset
63 Debug.log("Visiting %s followed by %s", mergeNode, deopt);
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
64 List<AbstractBeginNode> begins = new ArrayList<>();
9434
50f02c7d1cec Rename EndNode => AbstractEndNode and make abstract class. Introduce concrete EndNode subclass.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9361
diff changeset
65 for (AbstractEndNode end : mergeNode.forwardEnds()) {
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
66 AbstractBeginNode newBeginNode = findBeginNode(end);
8387
9f0ae7df921e Bug fix and additional assertions in deoptimize to guard phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8384
diff changeset
67 assert !begins.contains(newBeginNode);
9f0ae7df921e Bug fix and additional assertions in deoptimize to guard phase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8384
diff changeset
68 begins.add(newBeginNode);
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
69 }
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
70 for (AbstractBeginNode begin : begins) {
8384
0edb2a515cb1 Fixes a corner case when killing the control flowing into a deoptimize node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8382
diff changeset
71 assert !begin.isDeleted();
0edb2a515cb1 Fixes a corner case when killing the control flowing into a deoptimize node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8382
diff changeset
72 visitDeoptBegin(begin, deopt, graph);
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
73 }
8384
0edb2a515cb1 Fixes a corner case when killing the control flowing into a deoptimize node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8382
diff changeset
74 assert mergeNode.isDeleted();
8382
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
75 return;
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
76 } else if (deoptBegin.predecessor() instanceof IfNode) {
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
77 IfNode ifNode = (IfNode) deoptBegin.predecessor();
9436
ae815a4c112a Rename BeginNode => AbstractBeginNode and make abstract. Introduce concrete subclass BeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9434
diff changeset
78 AbstractBeginNode otherBegin = ifNode.trueSuccessor();
7767
4a6646d8eb87 separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
79 LogicNode conditionNode = ifNode.condition();
9360
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
80 FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), deoptBegin == ifNode.trueSuccessor()));
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
81 FixedWithNextNode pred = (FixedWithNextNode) ifNode.predecessor();
11308
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
82 AbstractBeginNode survivingSuccessor;
9360
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
83 if (deoptBegin == ifNode.trueSuccessor()) {
11308
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
84 survivingSuccessor = ifNode.falseSuccessor();
9360
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
85 } else {
11308
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
86 survivingSuccessor = ifNode.trueSuccessor();
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
87 }
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
88 graph.removeSplitPropagate(ifNode, survivingSuccessor);
11333
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
89 ProxyNode proxyGuard = null;
11308
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
90 for (Node n : survivingSuccessor.usages().snapshot()) {
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
91 if (n instanceof GuardNode || n instanceof ProxyNode) {
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
92 // Keep wired to the begin node.
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
93 } else {
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
94 // Rewire to the fixed guard.
11333
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
95 if (survivingSuccessor instanceof LoopExitNode) {
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
96 if (proxyGuard == null) {
11335
ccbbb7dbca69 Make sure the created ProxyNode is of PhiType.Guard.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11333
diff changeset
97 proxyGuard = ProxyNode.forGuard(guard, survivingSuccessor, graph);
11333
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
98 }
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
99 n.replaceFirstInput(survivingSuccessor, proxyGuard);
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
100 } else {
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
101 n.replaceFirstInput(survivingSuccessor, guard);
a07d9113d1f6 Fix in ConvertDeoptimizeToGuardPhase for the case where we need to insert a ProxyNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11308
diff changeset
102 }
11308
77167d6f868c Fix forward propagation of guarded nodes in ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9436
diff changeset
103 }
6548
4dc9e468c8b0 The lowering currently does not support a FixedGuard as the usage of an InstanceOfNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
104 }
9360
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
105 Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s.", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin);
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
106 FixedNode next = pred.next();
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
107 pred.setNext(guard);
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
108 guard.setNext(next);
412f6e6dad73 Allow FixedGuard usages for InstanceOf nodes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8441
diff changeset
109 return;
8382
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
110 }
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
111
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
112 // We could not convert the control split - at least cut off control flow after the split.
8388
bcfe9832552a Speical case ExceptionObjectNode in deopt to guard conversion.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8387
diff changeset
113 FixedWithNextNode deoptPred = deoptBegin;
bcfe9832552a Speical case ExceptionObjectNode in deopt to guard conversion.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8387
diff changeset
114 FixedNode next = deoptPred.next();
bcfe9832552a Speical case ExceptionObjectNode in deopt to guard conversion.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8387
diff changeset
115
8382
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
116 if (next != deopt) {
8384
0edb2a515cb1 Fixes a corner case when killing the control flowing into a deoptimize node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8382
diff changeset
117 DeoptimizeNode newDeoptNode = (DeoptimizeNode) deopt.clone(graph);
8388
bcfe9832552a Speical case ExceptionObjectNode in deopt to guard conversion.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8387
diff changeset
118 deoptPred.setNext(newDeoptNode);
bcfe9832552a Speical case ExceptionObjectNode in deopt to guard conversion.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8387
diff changeset
119 assert deoptPred == newDeoptNode.predecessor();
8382
496db8bf756d Killing cfg path to deoptimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8276
diff changeset
120 GraphUtil.killCFG(next);
4682
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
121 }
7cb57ac24ab8 Better ConvertDeoptimizeToGuardPhase (experimental).
Andreas Woess <andreas.woess@jku.at>
parents: 4548
diff changeset
122 }
4548
f55914bc1d67 Added experimental ConvertDeoptimizeToGuardPhase.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 }