jist.runtime
Class RewriterTraversalAddEntityMethodStubs

java.lang.Object
  extended by jist.runtime.ClassTraversal.Empty
      extended by jist.runtime.RewriterTraversalAddEntityMethodStubs
All Implemented Interfaces:
ClassTraversal.Visitor

 class RewriterTraversalAddEntityMethodStubs
extends ClassTraversal.Empty

Traversal object that adds fields in an entity object that store method references. These method stubs greatly improve the speed of method invocation, since reflection is not performed each time. This traversal also inserts code within the class initializer (creating it if no such method exists) to call the generic method stub initialization method (Rewriter.initializeMethodStubs). This method uses reflection (at load time only) to initialize the stub fields.

Since:
JIST1.0
Author:
Rimon Barr <barr+jist@cs.cornell.edu>
See Also:
Rewriter.initializeMethodStubs(java.lang.String)

Field Summary
private  org.apache.bcel.generic.MethodGen clinit
          class initializer.
private  org.apache.bcel.generic.InstructionFactory ifc
          class instruction factory.
private  Rewriter rewriter
          primary rewriter.
 
Constructor Summary
RewriterTraversalAddEntityMethodStubs(Rewriter rewriter)
          Create rewriter object that add entity method stubs.
 
Method Summary
 org.apache.bcel.generic.ClassGen doClass(org.apache.bcel.generic.ClassGen cg)
          Upcall to process class before field and method processing.
 org.apache.bcel.generic.ClassGen doClassPost(org.apache.bcel.generic.ClassGen cg)
          Upcall to process class after field and method processing.
 org.apache.bcel.generic.MethodGen doMethod(org.apache.bcel.generic.ClassGen cg, org.apache.bcel.generic.MethodGen mg)
          Upcall to process method before instruction processing.
 
Methods inherited from class jist.runtime.ClassTraversal.Empty
doField, doInstruction, doMethodPost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ifc

private org.apache.bcel.generic.InstructionFactory ifc
class instruction factory.


rewriter

private Rewriter rewriter
primary rewriter.


clinit

private org.apache.bcel.generic.MethodGen clinit
class initializer.

Constructor Detail

RewriterTraversalAddEntityMethodStubs

public RewriterTraversalAddEntityMethodStubs(Rewriter rewriter)
Create rewriter object that add entity method stubs.

Parameters:
rewriter - reference to primary rewriter
Method Detail

doClass

public org.apache.bcel.generic.ClassGen doClass(org.apache.bcel.generic.ClassGen cg)
Upcall to process class before field and method processing.

Specified by:
doClass in interface ClassTraversal.Visitor
Overrides:
doClass in class ClassTraversal.Empty
Parameters:
cg - BCEL class generator object to process
Returns:
processed BCEL class generator object

doMethod

public org.apache.bcel.generic.MethodGen doMethod(org.apache.bcel.generic.ClassGen cg,
                                                  org.apache.bcel.generic.MethodGen mg)
                                           throws java.lang.ClassNotFoundException
Upcall to process method before instruction processing.

Specified by:
doMethod in interface ClassTraversal.Visitor
Overrides:
doMethod in class ClassTraversal.Empty
Parameters:
cg - BCEL class generator object
mg - BCEL method generator object to process
Returns:
processed BCEL method generator object
Throws:
java.lang.ClassNotFoundException

doClassPost

public org.apache.bcel.generic.ClassGen doClassPost(org.apache.bcel.generic.ClassGen cg)
Upcall to process class after field and method processing.

Specified by:
doClassPost in interface ClassTraversal.Visitor
Overrides:
doClassPost in class ClassTraversal.Empty
Parameters:
cg - BCEL class generator object to process
Returns:
processed BCEL class generator object