Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jxcl.cl
Class GraphTransformer  view GraphTransformer download GraphTransformer.java

java.lang.Object
  extended byorg.jxcl.cl.GraphTransformer

public class GraphTransformer
extends java.lang.Object

Build the control flow graph for a method, apply an arbitrary number of GraphXformers to it, and then collapse the graph back to an instruction list. Exception handlers are collected from the control flow graph and made available to callers.

XXX Debug statements should be removed when code is definitely stable. XXX


Field Summary
private  org.apache.bcel.generic.CodeExceptionGen[] ceg
          Exception handlers from the transformed graph.
private  java.util.List gxf
          GraphXformer vector; ordered list of graph processors.
private  org.apache.bcel.generic.CodeExceptionGen[] handlers
          Exception handlers found in the method.
private  org.apache.bcel.generic.InstructionList ilist
          Instruction list generated from the graph.
private  TryStacks ts
           
 
Constructor Summary
GraphTransformer(java.util.List gxf)
          Creates method control flow graphs, applies application- specific transforms, and then collapses the graph to produce a new instruction list.
 
Method Summary
protected  BytecodeCollector collapseGraph(ControlFlowGraph graph)
          Collapse a method control flow graph, writing bytecode back into the MethodGen data structures.
 org.apache.bcel.generic.CodeExceptionGen[] getExceptionHandlers()
          Returns array of exception handlers, empty if the instruction list was null or there were no exception handlers.
static boolean hasInbound(org.apache.bcel.generic.InstructionHandle ih)
          Whether this instruction is target of branch instruction or starts catch block.
protected  ControlFlowGraph makeGraph(org.apache.bcel.generic.ClassGen clazz, org.apache.bcel.generic.MethodGen method)
          Build the graph for the method.
 org.apache.bcel.generic.InstructionList xform(org.apache.bcel.generic.ClassGen clazz, org.apache.bcel.generic.MethodGen method)
          Build a control flow graph for a method's instruction list, apply any transformers to it, and collapse the graph into a new instruction list.
private  void zapGraphXformer(GraphXformer gxf, java.lang.Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gxf

private java.util.List gxf
GraphXformer vector; ordered list of graph processors.


ts

private TryStacks ts

handlers

private org.apache.bcel.generic.CodeExceptionGen[] handlers
Exception handlers found in the method.


ceg

private org.apache.bcel.generic.CodeExceptionGen[] ceg
Exception handlers from the transformed graph.


ilist

private org.apache.bcel.generic.InstructionList ilist
Instruction list generated from the graph.

Constructor Detail

GraphTransformer

public GraphTransformer(java.util.List gxf)
Creates method control flow graphs, applies application- specific transforms, and then collapses the graph to produce a new instruction list.

Method Detail

zapGraphXformer

private void zapGraphXformer(GraphXformer gxf,
                             java.lang.Exception e)

xform

public org.apache.bcel.generic.InstructionList xform(org.apache.bcel.generic.ClassGen clazz,
                                                     org.apache.bcel.generic.MethodGen method)
Build a control flow graph for a method's instruction list, apply any transformers to it, and collapse the graph into a new instruction list.


getExceptionHandlers

public org.apache.bcel.generic.CodeExceptionGen[] getExceptionHandlers()
Returns array of exception handlers, empty if the instruction list was null or there were no exception handlers.


makeGraph

protected final ControlFlowGraph makeGraph(org.apache.bcel.generic.ClassGen clazz,
                                           org.apache.bcel.generic.MethodGen method)
Build the graph for the method.


hasInbound

public static final boolean hasInbound(org.apache.bcel.generic.InstructionHandle ih)
Whether this instruction is target of branch instruction or starts catch block.


collapseGraph

protected final BytecodeCollector collapseGraph(ControlFlowGraph graph)
Collapse a method control flow graph, writing bytecode back into the MethodGen data structures.