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
GraphPrinterGraph with the specified title, optionally using short names for
nodes.print in interface GraphPrinterIOExceptionprivate void writeGraph(Graph graph) throws IOException
IOExceptionprivate void writeGraph(Graph graph, SchedulePhase predefinedSchedule) throws IOException
IOExceptionprivate void flush() throws IOException
IOExceptionprivate void ensureAvailable(int i) throws IOException
IOExceptionprivate void writeByte(int b) throws IOException
IOExceptionprivate void writeInt(int b) throws IOException
IOExceptionprivate void writeLong(long b) throws IOException
IOExceptionprivate void writeDouble(double b) throws IOException
IOExceptionprivate void writeFloat(float b) throws IOException
IOExceptionprivate void writeShort(char b) throws IOException
IOExceptionprivate void writeString(String str) throws IOException
IOExceptionprivate void writeBytes(byte[] b) throws IOException
IOExceptionprivate void writeInts(int[] b) throws IOException
IOExceptionprivate void writeDoubles(double[] b) throws IOException
IOExceptionprivate void writePoolObject(Object object) throws IOException
IOExceptionprivate static String getClassName(Class<?> klass)
private void addPoolEntry(Object object) throws IOException
IOExceptionprivate void writeEdgesInfo(NodeClass<?> nodeClass, Edges.Type type) throws IOException
IOExceptionprivate void writePropertyObject(Object obj) throws IOException
IOExceptionprivate void writeNodes(Graph graph, NodeMap<Block> nodeToBlocks, ControlFlowGraph cfg) throws IOException
IOExceptionprivate void writeEdges(Node node, Edges.Type type) throws IOException
IOExceptionprivate void writeNodeRef(Node edge) throws IOException
IOExceptionprivate void writeBlocks(List<Block> blocks, BlockMap<List<Node>> blockToNodes) throws IOException
IOExceptionpublic void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) throws IOException
GraphPrinterbeginGroup in interface GraphPrinterIOExceptionpublic void endGroup() throws IOException
GraphPrinterendGroup in interface GraphPrinterIOExceptionpublic void close()
close in interface GraphPrinterclose in interface Closeableclose in interface AutoCloseable