Mercurial > hg > truffle
annotate graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java @ 2790:50677668afe3
Towards making goto removal work.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 19:29:40 +0200 |
parents | aeccd2af4e9e |
children | d3fc4fe063bf |
rev | line source |
---|---|
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
22 */ |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.graph; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
25 import java.util.AbstractList; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
26 import java.util.Arrays; |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
27 import java.util.Collections; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
28 import java.util.Iterator; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 public class NodeArray extends AbstractList<Node> { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
32 private final Node node; |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
33 final Node[] nodes; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 public NodeArray(Node node, int length) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
36 this.node = node; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
37 this.nodes = new Node[length]; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
39 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 public Iterator<Node> iterator() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 return Arrays.asList(this.nodes).iterator(); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
42 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 private Node self() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 return this.node; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
46 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
47 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 public Node set(int index, Node node) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
49 assert node == Node.Null || node.graph == self().graph; |
2768
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2674
diff
changeset
|
50 assert node == Node.Null || node.id() != Node.DeletedID : "inserted node must not be deleted"; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
51 Node old = nodes[index]; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
52 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
53 if (old != node) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
54 nodes[index] = node; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
55 if (self().inputs == this) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
56 if (old != null) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
57 old.usages.remove(self()); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
58 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
59 if (node != null) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
60 node.usages.add(self()); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
61 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
62 } else { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
63 assert self().successors == this; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
64 if (old != null) { |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
65 for (int i = 0; i < old.predecessors.size(); ++i) { |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
66 Node cur = old.predecessors.get(i); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
67 if (cur == self() && old.predecessorsIndex.get(i) == index) { |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
68 old.predecessors.remove(i); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
69 old.predecessorsIndex.remove(i); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
70 } |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
71 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
72 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
73 if (node != null) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
74 node.predecessors.add(self()); |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
75 node.predecessorsIndex.add(index); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
76 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
77 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
78 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
79 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
80 return old; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
81 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
82 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
83 public void setAll(NodeArray other) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
84 assert size() == other.size(); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
85 for (int i = 0; i < other.size(); i++) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
86 set(i, other.get(i)); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
87 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
88 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
89 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
90 public Node get(int index) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
91 return nodes[index]; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
92 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
93 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
94 public Node[] toArray() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
95 return Arrays.copyOf(nodes, nodes.length); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
96 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
97 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
98 boolean replaceFirstOccurrence(Node toReplace, Node replacement) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
99 for (int i = 0; i < nodes.length; i++) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
100 if (nodes[i] == toReplace) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
101 nodes[i] = replacement; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
102 return true; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
103 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
104 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
105 return false; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
106 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
107 |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
108 public int replace(Node toReplace, Node replacement) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
109 int result = 0; |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
110 for (int i = 0; i < nodes.length; i++) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
111 if (nodes[i] == toReplace) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
112 set(i, replacement); |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
113 result++; |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
114 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
115 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
116 return result; |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
117 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
118 |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
119 public void setAndClear(int index, Node clearedNode, int clearedIndex) { |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
120 assert self().successors == this; |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
121 Node value = clearedNode.successors.get(clearedIndex); |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
122 assert value != Node.Null; |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
123 clearedNode.successors.nodes[clearedIndex] = Node.Null; |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
124 set(index, Node.Null); |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
125 nodes[index] = value; |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
126 |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
127 for (int i = 0; i < value.predecessors.size(); ++i) { |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
128 if (value.predecessors.get(i) == clearedNode && value.predecessorsIndex.get(i) == clearedIndex) { |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
129 value.predecessors.set(i, self()); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
130 value.predecessorsIndex.set(i, index); |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
131 } |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
132 } |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
133 } |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
134 |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
135 public int size() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
136 return nodes.length; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
137 } |
2781
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
138 |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
139 public void clearAll() { |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
140 for (int i = 0; i < nodes.length; i++) { |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
141 set(i, Node.Null); |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
142 } |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
143 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
144 } |