Mercurial > hg > truffle
annotate graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java @ 2966:0048537e3cd7
Added input to Merge node.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 15 Jun 2011 13:49:12 +0200 |
parents | 0966a5a904ad |
children | 60a58915c94d |
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 */ |
2874
d90bf514d647
Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2872
diff
changeset
|
23 package com.oracle.max.graal.graph; |
2674
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; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
27 import java.util.Iterator; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
28 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 public class NodeArray extends AbstractList<Node> { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 private final Node node; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
32 private Node[] nodes; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
33 private final int fixedLength; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
34 private int variableLength; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
36 public NodeArray(Node node, int length) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
37 this.node = node; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 this.nodes = new Node[length]; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
39 this.fixedLength = length; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 |
2851
14708c03abba
Remove isNonNull
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2842
diff
changeset
|
42 @Override |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 public Iterator<Node> iterator() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 return Arrays.asList(this.nodes).iterator(); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 } |
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 private Node self() { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 return this.node; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
49 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
50 |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
51 Node silentSet(int index, Node node) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
52 Node result = nodes[index]; |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
53 nodes[index] = node; |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
54 return result; |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
55 } |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
56 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
57 public AbstractList<Node> variablePart() { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
58 return new AbstractList<Node>() { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
59 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
60 @Override |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
61 public Node get(int index) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
62 checkIndex(index); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
63 return NodeArray.this.get(fixedLength + index); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
64 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
65 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
66 @Override |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
67 public int size() { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
68 return variableLength; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
69 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
70 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
71 public Node set(int index, Node element) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
72 checkIndex(index); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
73 return NodeArray.this.set(fixedLength + index, element); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
74 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
75 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
76 public void add(int index, Node element) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
77 variableLength++; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
78 checkIndex(index); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
79 NodeArray.this.ensureSize(); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
80 for (int i=size() - 1; i > index; i--) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
81 NodeArray.this.nodes[fixedLength + i] = NodeArray.this.nodes[fixedLength + i-1]; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
82 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
83 set(index, element); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
84 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
85 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
86 private void checkIndex(int index) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
87 if (index < 0 || index >= size()) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
88 throw new IndexOutOfBoundsException(); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
89 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
90 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
91 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
92 @Override |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
93 public Node remove(int index) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
94 checkIndex(index); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
95 Node n = get(index); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
96 set(index, Node.Null); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
97 for (int i=index; i < size() - 1; i++) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
98 NodeArray.this.nodes[fixedLength + i] = NodeArray.this.nodes[fixedLength + i + 1]; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
99 } |
2966
0048537e3cd7
Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2961
diff
changeset
|
100 NodeArray.this.nodes[fixedLength + size() - 1] = Node.Null; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
101 variableLength--; |
2966
0048537e3cd7
Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2961
diff
changeset
|
102 assert variableLength >= 0; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
103 return n; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
104 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
105 }; |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
106 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
107 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
108 private void ensureSize() { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
109 if (size() > nodes.length) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
110 nodes = Arrays.copyOf(nodes, (nodes.length + 1)*2); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
111 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
112 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
113 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
114 public void setOrExpand(int index, Node node) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
115 if (index < 0) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
116 throw new IndexOutOfBoundsException(); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
117 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
118 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
119 while (index >= size()) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
120 variablePart().add(Node.Null); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
121 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
122 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
123 set(index, node); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
124 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
125 |
2851
14708c03abba
Remove isNonNull
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2842
diff
changeset
|
126 @Override |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
127 public Node set(int index, Node node) { |
2935
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2894
diff
changeset
|
128 assert !self().isDeleted() : "trying to set input/successor of deleted node: " + self().shortName(); |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
129 assert node == Node.Null || node.graph == self().graph : "node is from different graph: (this=" + self() + ") and (node=" + node + ")"; |
2768
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2674
diff
changeset
|
130 assert node == Node.Null || node.id() != Node.DeletedID : "inserted node must not be deleted"; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
131 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
132 Node old = get(index); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
133 if (old != node) { |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
134 silentSet(index, node); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
135 if (self().inputs == this) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
136 if (old != null) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
137 old.usages.remove(self()); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
138 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
139 if (node != null) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
140 node.usages.add(self()); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
141 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
142 } else { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
143 assert self().successors == this; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
144 if (old != null) { |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
145 for (int i = 0; i < old.predecessors.size(); ++i) { |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
146 Node cur = old.predecessors.get(i); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
147 if (cur == self() && old.predecessorsIndex.get(i) == index) { |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
148 old.predecessors.remove(i); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
149 old.predecessorsIndex.remove(i); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
150 } |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
151 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
152 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
153 if (node != null) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
154 node.predecessors.add(self()); |
2790
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
155 node.predecessorsIndex.add(index); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
156 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
157 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
158 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
159 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
160 return old; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
161 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
162 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
163 public void setAll(NodeArray other) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
164 assert size() == other.size(); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
165 for (int i = 0; i < other.size(); i++) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
166 set(i, other.get(i)); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
167 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
168 } |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
169 |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
170 private void checkIndex(int index) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
171 if (index < 0 || index >= size()) { |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
172 throw new IndexOutOfBoundsException(); |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
173 } |
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
174 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
175 |
2851
14708c03abba
Remove isNonNull
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2842
diff
changeset
|
176 @Override |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
177 public Node get(int index) { |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
178 checkIndex(index); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
179 return nodes[index]; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
180 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
181 |
2851
14708c03abba
Remove isNonNull
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2842
diff
changeset
|
182 @Override |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
183 public Node[] toArray() { |
2966
0048537e3cd7
Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2961
diff
changeset
|
184 return Arrays.copyOf(nodes, size()); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
185 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
186 |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
187 boolean replaceFirstOccurrence(Node toReplace, Node replacement) { |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
188 for (int i = 0; i < size(); i++) { |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
189 if (nodes[i] == toReplace) { |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
190 nodes[i] = replacement; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
191 return true; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
192 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
193 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
194 return false; |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
195 } |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
196 |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
197 public int remove(Node n) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
198 return replace(n, null); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
199 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
200 |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
201 public int replace(Node toReplace, Node replacement) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
202 int result = 0; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
203 for (int i = 0; i < size(); i++) { |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
204 if (nodes[i] == toReplace) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
205 set(i, replacement); |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
206 result++; |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
207 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
208 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
209 return result; |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
210 } |
2888
224412c24426
Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2880
diff
changeset
|
211 |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
212 int silentRemove(Node n) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
213 return silentReplace(n, null); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
214 } |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
215 |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
216 int silentReplace(Node toReplace, Node replacement) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
217 int result = 0; |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
218 for (int i = 0; i < size(); i++) { |
2880
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
219 if (nodes[i] == toReplace) { |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
220 silentSet(i, replacement); |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
221 result++; |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
222 } |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
223 } |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
224 return result; |
385a4d7c2a78
Added new duplication phase (for verification). Fixes in Node.copy method implementations.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
225 } |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
226 |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
227 public void setAndClear(int index, Node clearedNode, int clearedIndex) { |
2935
9b8f30608e62
deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2894
diff
changeset
|
228 assert !self().isDeleted() : "trying to setAndClear successor of deleted node: " + self().shortName(); |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
229 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
|
230 Node value = clearedNode.successors.get(clearedIndex); |
2960
49a8b14e9d24
Tentative change that adds successor tags.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2935
diff
changeset
|
231 self().successorTags[index] = clearedNode.successorTags[clearedIndex]; |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 nodes[index] = value; |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
236 |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
237 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
|
238 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
|
239 value.predecessors.set(i, self()); |
50677668afe3
Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
240 value.predecessorsIndex.set(i, index); |
2842
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
241 return; |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
242 } |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
243 } |
2842
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2793
diff
changeset
|
244 assert false; |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
245 } |
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
246 |
2851
14708c03abba
Remove isNonNull
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2842
diff
changeset
|
247 @Override |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
248 public int size() { |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
249 return fixedLength + variableLength; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
250 } |
2781
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
251 |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
252 public void clearAll() { |
2961
0966a5a904ad
Created variable part in NodeArray.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2960
diff
changeset
|
253 for (int i = 0; i < size(); i++) { |
2781
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
254 set(i, Node.Null); |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
255 } |
bda5972a40a5
remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents:
2768
diff
changeset
|
256 } |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
257 } |