|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.markcrocker.purifier.LocalVariables
This class implements an array of local variables used for StackMap generation. Data is stored as StackMapTypes, which is not entirely consistent with symbolic JVM storage because some StackMapType entries represent two storage words. Consequently, the two set methods check for longs or doubles and modify the subsequent entry appropriately.
Field Summary | |
private boolean |
astoreConflictOverride
|
private int |
astoreOverrideIndex
|
private int |
javaLangObjectIndex
|
private org.apache.bcel.classfile.StackMapType[] |
locals
The StackMapType[] containing the local variable information. |
private static org.apache.log4j.Logger |
log
|
Constructor Summary | |
LocalVariables(int maxLocals)
Constructs a new LocalVariables object, and leaves entries as nulls. |
|
LocalVariables(org.apache.bcel.generic.MethodGen mg,
org.apache.bcel.generic.ConstantPoolGen cpg)
Construct pre-initialized LocalVariables suitable for normal Method invokation. |
|
LocalVariables(org.apache.bcel.classfile.StackMapType[] stackMapTypes)
Constructs a new LocalVariables object from an array of existing StackMapTypes |
Method Summary | |
static void |
addStackMapTypeToStringBuffer(org.apache.bcel.classfile.StackMapType smt,
java.lang.StringBuffer s)
|
protected java.lang.Object |
clone()
Returns a deep copy of this object. |
boolean |
equals(java.lang.Object o)
|
boolean |
getAstoreConflictOverride()
|
int |
getAstoreOverrideIndex()
|
LocalVariables |
getClone()
Returns a (correctly typed) clone of this object. |
int |
getIndex(int i)
Returns the ConstantPool index of the local variable slot i. |
int |
getJavaLangObjectIndex()
|
org.apache.bcel.classfile.StackMapType[] |
getLocals(org.apache.bcel.classfile.ConstantPool cp)
Returns a copy of the local variables. |
int |
getMaxLocals()
Returns the number of local variable slots this LocalVariables instance has. |
org.apache.bcel.classfile.StackMapType |
getStackMapType(int i)
Returns the local variable at slot i. |
byte |
getType(int i)
Returns the type of the local variable slot i. |
private static void |
indent(java.lang.StringBuffer sb,
java.lang.String indentString,
int indentLevel)
|
void |
methodEntrySetup(org.apache.bcel.generic.MethodGen mg,
org.apache.bcel.generic.ConstantPoolGen cpg)
Setup LocalVariables to be pre-initialized in a way that is suitable for normal Method invokation. |
LocalVariables |
resolveConflicts(LocalVariables challenger)
If a target has already been visited and a discrepancy exists between the local variables on the new Frame and the stored Frame, then the conflict has to be resolved. |
void |
set(int i,
byte type,
int index,
org.apache.bcel.classfile.ConstantPool cp)
Sets a new Type for the given local variable slot. |
void |
set(int i,
org.apache.bcel.classfile.StackMapType stackMapType)
Sets a new Type for the given local variable slot. |
void |
setAstoreOverride(int astoreOverrideIndex,
int javaLangObjectIndex)
|
static boolean |
stackMapTypeEquals(org.apache.bcel.classfile.StackMapType smta,
org.apache.bcel.classfile.StackMapType smtb)
|
static java.lang.String |
stackMapTypeToString(org.apache.bcel.classfile.StackMapType smt)
|
static java.lang.String |
stackMapTypeToString(org.apache.bcel.classfile.StackMapType smt,
java.lang.String indentString,
int indentLevel)
|
java.lang.String |
toString()
Returns a String representation of the LocalVariables object. |
java.lang.String |
toString(java.lang.String indentString,
int indentLevel)
Returns a String representation of the LocalVariables object, prepending each line with the indent string. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static org.apache.log4j.Logger log
private org.apache.bcel.classfile.StackMapType[] locals
private boolean astoreConflictOverride
private int astoreOverrideIndex
private int javaLangObjectIndex
Constructor Detail |
public LocalVariables(int maxLocals)
public LocalVariables(org.apache.bcel.classfile.StackMapType[] stackMapTypes)
public LocalVariables(org.apache.bcel.generic.MethodGen mg, org.apache.bcel.generic.ConstantPoolGen cpg)
Method Detail |
public byte getType(int i)
public int getIndex(int i)
public org.apache.bcel.classfile.StackMapType getStackMapType(int i)
public org.apache.bcel.classfile.StackMapType[] getLocals(org.apache.bcel.classfile.ConstantPool cp)
protected java.lang.Object clone()
clone
in class java.lang.Object
public void set(int i, byte type, int index, org.apache.bcel.classfile.ConstantPool cp)
public void set(int i, org.apache.bcel.classfile.StackMapType stackMapType)
public LocalVariables getClone()
public int getMaxLocals()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public static boolean stackMapTypeEquals(org.apache.bcel.classfile.StackMapType smta, org.apache.bcel.classfile.StackMapType smtb)
public void methodEntrySetup(org.apache.bcel.generic.MethodGen mg, org.apache.bcel.generic.ConstantPoolGen cpg)
public void setAstoreOverride(int astoreOverrideIndex, int javaLangObjectIndex)
public boolean getAstoreConflictOverride()
public int getAstoreOverrideIndex()
public int getJavaLangObjectIndex()
public LocalVariables resolveConflicts(LocalVariables challenger)
There is also another, related source of confusion caused by the fact that some branch sources will use a subtype of the class that a variable is intended to hold. Using a subtype is perfectly valid, however, when comparing the Frames, there appears to be a conflict. Consequently, these apparent conflicts also need to be resolved and the most general type needs to be the one that is stored in the Frame's local variables. The Java VM Specification refers to this as "merging".
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String indentString, int indentLevel)
indentString
- String to prepend to each line to allow indent matching.indentLevel
- How many copies of indent string to append.public static void addStackMapTypeToStringBuffer(org.apache.bcel.classfile.StackMapType smt, java.lang.StringBuffer s)
public static java.lang.String stackMapTypeToString(org.apache.bcel.classfile.StackMapType smt, java.lang.String indentString, int indentLevel)
public static java.lang.String stackMapTypeToString(org.apache.bcel.classfile.StackMapType smt)
private static void indent(java.lang.StringBuffer sb, java.lang.String indentString, int indentLevel)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |