public class BinaryGraphPrinter extends Object implements GraphPrinter
Modifier and Type | Class and Description |
---|---|
private static class |
BinaryGraphPrinter.ConstantPool |
Modifier and Type | Field and Description |
---|---|
private static int |
BEGIN_GRAPH |
private static int |
BEGIN_GROUP |
private ByteBuffer |
buffer |
private WritableByteChannel |
channel |
private static int |
CLOSE_GROUP |
private static int |
CONSTANT_POOL_MAX_SIZE |
private BinaryGraphPrinter.ConstantPool |
constantPool |
private static int |
ENUM_KLASS |
private static int |
KLASS |
private static int |
POOL_CLASS |
private static int |
POOL_ENUM |
private static int |
POOL_FIELD |
private static int |
POOL_METHOD |
private static int |
POOL_NEW |
private static int |
POOL_NODE_CLASS |
private static int |
POOL_NULL |
private static int |
POOL_SIGNATURE |
private static int |
POOL_STRING |
private static int |
PROPERTY_ARRAY |
private static int |
PROPERTY_DOUBLE |
private static int |
PROPERTY_FALSE |
private static int |
PROPERTY_FLOAT |
private static int |
PROPERTY_INT |
private static int |
PROPERTY_LONG |
private static int |
PROPERTY_POOL |
private static int |
PROPERTY_SUBGRAPH |
private static int |
PROPERTY_TRUE |
Constructor and Description |
---|
BinaryGraphPrinter(WritableByteChannel channel) |
Modifier and Type | Method and Description |
---|---|
private void |
addPoolEntry(Object object) |
void |
beginGroup(String name,
String shortName,
ResolvedJavaMethod method,
int bci)
Starts a new group of graphs with the given name, short name and method byte code index (BCI)
as properties.
|
void |
close() |
void |
endGroup()
Ends the current group.
|
private void |
ensureAvailable(int i) |
private void |
flush() |
private static String |
getClassName(Class<?> klass) |
private static int |
getNodeId(Node node) |
void |
print(Graph graph,
String title,
SchedulePhase predefinedSchedule)
Prints an entire
Graph with the specified title, optionally using short names for
nodes. |
private void |
writeBlocks(List<Block> blocks,
BlockMap<List<Node>> blockToNodes) |
private void |
writeByte(int b) |
private void |
writeBytes(byte[] b) |
private void |
writeDouble(double b) |
private void |
writeDoubles(double[] b) |
private void |
writeEdges(Node node,
Edges.Type type) |
private void |
writeEdgesInfo(NodeClass<?> nodeClass,
Edges.Type type) |
private void |
writeFloat(float b) |
private void |
writeGraph(Graph graph) |
private void |
writeGraph(Graph graph,
SchedulePhase predefinedSchedule) |
private void |
writeInt(int b) |
private void |
writeInts(int[] b) |
private void |
writeLong(long b) |
private void |
writeNodeRef(Node edge) |
private void |
writeNodes(Graph graph,
NodeMap<Block> nodeToBlocks,
ControlFlowGraph cfg) |
private void |
writePoolObject(Object object) |
private void |
writePropertyObject(Object obj) |
private void |
writeShort(char b) |
private void |
writeString(String str) |
private static final int CONSTANT_POOL_MAX_SIZE
private static final int BEGIN_GROUP
private static final int BEGIN_GRAPH
private static final int CLOSE_GROUP
private static final int POOL_NEW
private static final int POOL_STRING
private static final int POOL_ENUM
private static final int POOL_CLASS
private static final int POOL_METHOD
private static final int POOL_NULL
private static final int POOL_NODE_CLASS
private static final int POOL_FIELD
private static final int POOL_SIGNATURE
private static final int PROPERTY_POOL
private static final int PROPERTY_INT
private static final int PROPERTY_LONG
private static final int PROPERTY_DOUBLE
private static final int PROPERTY_FLOAT
private static final int PROPERTY_TRUE
private static final int PROPERTY_FALSE
private static final int PROPERTY_ARRAY
private static final int PROPERTY_SUBGRAPH
private static final int KLASS
private static final int ENUM_KLASS
private final BinaryGraphPrinter.ConstantPool constantPool
private final ByteBuffer buffer
private final WritableByteChannel channel
public BinaryGraphPrinter(WritableByteChannel channel)
public void print(Graph graph, String title, SchedulePhase predefinedSchedule) throws IOException
GraphPrinter
Graph
with the specified title, optionally using short names for
nodes.print
in interface GraphPrinter
IOException
private void writeGraph(Graph graph) throws IOException
IOException
private void writeGraph(Graph graph, SchedulePhase predefinedSchedule) throws IOException
IOException
private void flush() throws IOException
IOException
private void ensureAvailable(int i) throws IOException
IOException
private void writeByte(int b) throws IOException
IOException
private void writeInt(int b) throws IOException
IOException
private void writeLong(long b) throws IOException
IOException
private void writeDouble(double b) throws IOException
IOException
private void writeFloat(float b) throws IOException
IOException
private void writeShort(char b) throws IOException
IOException
private void writeString(String str) throws IOException
IOException
private void writeBytes(byte[] b) throws IOException
IOException
private void writeInts(int[] b) throws IOException
IOException
private void writeDoubles(double[] b) throws IOException
IOException
private void writePoolObject(Object object) throws IOException
IOException
private static String getClassName(Class<?> klass)
private void addPoolEntry(Object object) throws IOException
IOException
private void writeEdgesInfo(NodeClass<?> nodeClass, Edges.Type type) throws IOException
IOException
private void writePropertyObject(Object obj) throws IOException
IOException
private void writeNodes(Graph graph, NodeMap<Block> nodeToBlocks, ControlFlowGraph cfg) throws IOException
IOException
private void writeEdges(Node node, Edges.Type type) throws IOException
IOException
private void writeNodeRef(Node edge) throws IOException
IOException
private void writeBlocks(List<Block> blocks, BlockMap<List<Node>> blockToNodes) throws IOException
IOException
public void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) throws IOException
GraphPrinter
beginGroup
in interface GraphPrinter
IOException
public void endGroup() throws IOException
GraphPrinter
endGroup
in interface GraphPrinter
IOException
public void close()
close
in interface GraphPrinter
close
in interface Closeable
close
in interface AutoCloseable