Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/graph/BlockMap.java @ 2602:0c6564c254af
new node layout: BlockBegin, BlockEnd
-Dc1x.dot=regex for pdf output
escape dot graph labels (<, >, &)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 06 May 2011 10:25:37 +0200 |
parents | f6125fb5bfbc |
children | 8e44074058af |
comparison
equal
deleted
inserted
replaced
2601:224e8b4007bd | 2602:0c6564c254af |
---|---|
24 | 24 |
25 import static com.sun.cri.bytecode.Bytecodes.*; | 25 import static com.sun.cri.bytecode.Bytecodes.*; |
26 | 26 |
27 import java.util.*; | 27 import java.util.*; |
28 | 28 |
29 import com.oracle.graal.graph.*; | |
29 import com.sun.c1x.ir.*; | 30 import com.sun.c1x.ir.*; |
30 import com.sun.c1x.util.*; | 31 import com.sun.c1x.util.*; |
31 import com.sun.cri.bytecode.*; | 32 import com.sun.cri.bytecode.*; |
32 import com.sun.cri.ci.*; | 33 import com.sun.cri.ci.*; |
33 import com.sun.cri.ri.*; | 34 import com.sun.cri.ri.*; |
113 * contains the blocks at 0, 5, 9, 15, 19, 22, with 22 as the loop header. (N.B. the loop header block is added multiple | 114 * contains the blocks at 0, 5, 9, 15, 19, 22, with 22 as the loop header. (N.B. the loop header block is added multiple |
114 * (4) times to this list). (Should 0 be in? It's not inside the loop). | 115 * (4) times to this list). (Should 0 be in? It's not inside the loop). |
115 * | 116 * |
116 * If the {@code computeStoresInLoops} argument to {@code build} is true, the {@code loopBlocks} list is processed to | 117 * If the {@code computeStoresInLoops} argument to {@code build} is true, the {@code loopBlocks} list is processed to |
117 * mark all local variables that are stored in the blocks in the list. | 118 * mark all local variables that are stored in the blocks in the list. |
118 * | |
119 * @author Ben L. Titzer | |
120 */ | 119 */ |
121 public final class BlockMap { | 120 public final class BlockMap { |
122 | 121 |
123 private static final BlockBegin[] NONE = {}; | 122 private static final BlockBegin[] NONE = {}; |
124 private static final List<BlockBegin> NONE_LIST = Collections.emptyList(); | 123 private static final List<BlockBegin> NONE_LIST = Collections.emptyList(); |
220 /** | 219 /** |
221 * Used for initial block ID (count up) and post-order number (count down). | 220 * Used for initial block ID (count up) and post-order number (count down). |
222 */ | 221 */ |
223 private int blockNum; | 222 private int blockNum; |
224 | 223 |
224 private final Graph graph; | |
225 | |
225 /** | 226 /** |
226 * Creates a new BlockMap instance from bytecode of the given method . | 227 * Creates a new BlockMap instance from bytecode of the given method . |
227 * @param method the compiler interface method containing the code | 228 * @param method the compiler interface method containing the code |
228 * @param firstBlockNum the first block number to use when creating {@link BlockBegin} nodes | 229 * @param firstBlockNum the first block number to use when creating {@link BlockBegin} nodes |
229 */ | 230 * @param graph |
230 public BlockMap(RiMethod method, int firstBlockNum) { | 231 */ |
232 public BlockMap(RiMethod method, int firstBlockNum, Graph graph) { | |
233 this.graph = graph; | |
231 byte[] code = method.code(); | 234 byte[] code = method.code(); |
232 this.code = code; | 235 this.code = code; |
233 firstBlock = firstBlockNum; | 236 firstBlock = firstBlockNum; |
234 blockNum = firstBlockNum; | 237 blockNum = firstBlockNum; |
235 blockMap = new BlockBegin[code.length]; | 238 blockMap = new BlockBegin[code.length]; |
263 } | 266 } |
264 | 267 |
265 BlockBegin make(int bci) { | 268 BlockBegin make(int bci) { |
266 BlockBegin block = blockMap[bci]; | 269 BlockBegin block = blockMap[bci]; |
267 if (block == null) { | 270 if (block == null) { |
268 block = new BlockBegin(bci, blockNum++); | 271 block = new BlockBegin(bci, blockNum++, graph); |
269 blockMap[bci] = block; | 272 blockMap[bci] = block; |
270 } | 273 } |
271 return block; | 274 return block; |
272 } | 275 } |
273 | 276 |