|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.stego.CodeEditor | +--edu.wisc.cs.stego.modules.Unprofile
This implementation of CodeEditor does not add code to build a watermark graph, but simply locates and removes the calls to the profiling methods. This class may be used as a super class for further implementations of CodeEditors, to take advantage of the profile point location and code removal capability.
Field Summary | |
protected WatermarkGraph |
graph
The watermark graph to be built in the run-time heap. |
protected static java.lang.String |
INIT_DESC
The descriptor of the profile initialization method. |
protected static java.lang.String |
INIT_METHOD
The name of the profile initialization method. |
protected static int |
INIT_POINT
|
protected static java.lang.String |
NO_ARGS_VOID
The descriptor of the profile point recorder method with no parameters. |
protected int |
num_points
The number of profile points across which the graph code will be distributed. |
protected static int |
POINT
|
protected static java.lang.String |
PROFILE_CLASS
The fully qualified name of the profiling class. |
protected static java.lang.String |
RECORD_POINT
The name of the profile point recorder method. |
Constructor Summary | |
protected |
Unprofile()
Constructs a new Unprofile object. |
Method Summary | |
protected void |
addDefaultConstructor(ClassFile node)
Given a class, add a constructor with no parameters if there isn't already a constructor with that signature. |
static CodeEditor |
buildCodeEditor(java.lang.String[] params)
Returns a new instance of an Unprofile object. |
protected int |
getProfilingMethodIndex(ConstantPool cpool,
int which)
Given a constant pool for a class, locates the specified method_ref constant and returns its index. |
protected void |
insertWatermarkCode(ClassFile cls,
CodeAttribute code,
int where)
This method does nothing. |
void |
instrumentClasses(WatermarkGraph graph,
ProfilePoint[] profile,
java.util.Map classes,
java.lang.String nodec)
Looks in the classes referenced in the profile points and removes calls to the profiling methods. |
protected void |
instrumentNodeClass(ClassFile node,
WatermarkGraph graph)
This method does nothing. |
protected int |
removeProfilePoint(int cpindex,
CodeAttribute code,
ProfilePoint point)
Given a CodeAttribute and a ProfilePoint, remove the bytecode which implements the profile point from the code. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static final int INIT_POINT
protected static final int POINT
protected static final java.lang.String PROFILE_CLASS
protected static final java.lang.String INIT_METHOD
protected static final java.lang.String INIT_DESC
protected static final java.lang.String RECORD_POINT
protected static final java.lang.String NO_ARGS_VOID
protected WatermarkGraph graph
instrumentClasses
method is invoked.protected int num_points
instrumentClasses
method is invoked.Constructor Detail |
protected Unprofile()
Method Detail |
public static CodeEditor buildCodeEditor(java.lang.String[] params)
params
- array of parameters to the Unprofile constructor.CodeEditor.buildCodeEditor(java.lang.String[])
public void instrumentClasses(WatermarkGraph graph, ProfilePoint[] profile, java.util.Map classes, java.lang.String nodec)
graph
- the watermark graph.profile
- the array of profile points.classes
- a map containing the classfiles, keyed on the classnames.nodec
- the name of the class to be used as the nodes in the graph.protected void instrumentNodeClass(ClassFile node, WatermarkGraph graph)
node
- the classfile representing the node class.fields
- the names of the pointer fields to add to the class.protected void addDefaultConstructor(ClassFile node)
node
- the class to which to add a default constructor.protected void insertWatermarkCode(ClassFile cls, CodeAttribute code, int where)
code
- the code attribute in which to insert code.where
- the index at which to insert the code.protected int getProfilingMethodIndex(ConstantPool cpool, int which)
cpool
- the constant pool of the class in which to search.which
- either INIT_POINT or POINT.protected int removeProfilePoint(int cpindex, CodeAttribute code, ProfilePoint point)
If the profile point to be removed is the initialization point, this
method attempts to remove the expression that loads the reference to the
filename string onto the stack. The algorithm currently in use will remove
a simple load from a local or static variable, or a constant from the
constant pool. Future versions may attempt to remove more complex
operations. If the expression cannot be removed by this simple algorithm,
the invokestatic
instruction will simply be replaced with a
pop
.
cpindex
- the constant pool index of the method to which calls should
be removed.code
- the code attribute which contains the profile point.point
- the profile point which should be removed from the code.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |