org.quilt.cl
Class SortedBlocks

java.lang.Object
  |
  +--org.quilt.cl.SortedBlocks

public class SortedBlocks
extends java.lang.Object

Manages an index into the bytecode vertices in a method's control flow graph. The vertices (blocks) are indexed by their position in the original code. The blocks may be from different graphs in a set of nested graphs.

Author:
< a href="jdd@dixons.org">Jim Dixon

Constructor Summary
SortedBlocks()
          Creates an empty map.
 
Method Summary
 boolean add(CodeVertex v)
          Add a vertex at its bytecode position.
 CodeVertex add(int pos, Edge e)
          Add a vertex at bytecode offset pos along edge e.
 boolean exists(int pos)
          Does a vertex exist with this bytecode offset?
 CodeVertex find(int pos, ControlFlowGraph currGraph, Edge e)
          Find or create a code vertex starting at a given position.
 CodeVertex get(int pos)
          Find the code vertex starting at a given bytecode offset.
 int size()
          How many code vertices are currently in the index?
 java.lang.String toString()
          Standard toString(), XXX needs some work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedBlocks

public SortedBlocks()
Creates an empty map.

Method Detail

add

public boolean add(CodeVertex v)
Add a vertex at its bytecode position. * It is an error if there is already a vertex at this position. XXX SHOULD THROW EXCEPTION IN SUCH A CASE.

Parameters:
v - CodeVertex to be inserted
Returns:
True if the operation succeeds, false if something is already present at that position.

find

public CodeVertex find(int pos,
                       ControlFlowGraph currGraph,
                       Edge e)
Find or create a code vertex starting at a given position.

Parameters:
pos - Byte offset in the original bytecode.
e - If the vertex must be created, Edge into which it gets inserted. Otherwise, edge target becomes the existing vertex.

add

public CodeVertex add(int pos,
                      Edge e)
Add a vertex at bytecode offset pos along edge e. No other vertex with that bytecode offset may exist.

Parameters:
pos - Bytecode offset.
e - Edge along which the Vertex will be created
Returns:
Reference to the Vertex created.

exists

public boolean exists(int pos)
Does a vertex exist with this bytecode offset?


get

public CodeVertex get(int pos)
Find the code vertex starting at a given bytecode offset. The vertex must exist. XXX Should throw an exception if it doesn't.

Parameters:
pos - Bytecode offset of first instruction in the block.
Returns:
The matching vertex.

size

public int size()
How many code vertices are currently in the index?

Returns:
The number of vertices in the index.

toString

public java.lang.String toString()
Standard toString(), XXX needs some work.

Overrides:
toString in class java.lang.Object
Returns:
Roughly formatted table of vertices.


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.