Package edu.umd.cs.findbugs.ba.vna
Class LoadedFieldSet
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.vna.LoadedFieldSet
-
public class LoadedFieldSet extends java.lang.ObjectObject which stores which fields are loaded and stored by the instructions in a method (including through inner-class access methods), and also which fields are loaded/stored by the overall method. The main purpose is for doing redundant load elimination and forward substitution more efficiently, but it might be useful in other situations.- Author:
- David Hovemeyer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLoadedFieldSet.LoadStoreCountCount number of times a field is loaded and/or stored in the method.
-
Constructor Summary
Constructors Constructor Description LoadedFieldSet(org.apache.bcel.generic.MethodGen methodGen)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLoad(org.apache.bcel.generic.InstructionHandle handle, XField field)Add a load of given field at given instruction.voidaddStore(org.apache.bcel.generic.InstructionHandle handle, XField field)Add a store of given field at given instruction.XFieldgetField(org.apache.bcel.generic.InstructionHandle handle)Get the field loaded or stored at given instruction, if any.LoadedFieldSet.LoadStoreCountgetLoadStoreCount(XField field)Get the number of times given field is loaded and stored within the method.booleaninstructionIsLoad(org.apache.bcel.generic.InstructionHandle handle)Return whether or not the given instruction is a load.booleanisLoaded(XField field)Return whether or not the given field is loaded by any instruction in the method.
-
-
-
Method Detail
-
getLoadStoreCount
public LoadedFieldSet.LoadStoreCount getLoadStoreCount(XField field)
Get the number of times given field is loaded and stored within the method.- Parameters:
field- the field- Returns:
- the load/store count object
-
addLoad
public void addLoad(org.apache.bcel.generic.InstructionHandle handle, XField field)Add a load of given field at given instruction.- Parameters:
handle- the instructionfield- the field
-
addStore
public void addStore(org.apache.bcel.generic.InstructionHandle handle, XField field)Add a store of given field at given instruction.- Parameters:
handle- the instructionfield- the field
-
getField
public XField getField(org.apache.bcel.generic.InstructionHandle handle)
Get the field loaded or stored at given instruction, if any.- Parameters:
handle- the instruction- Returns:
- the field loaded or stored at the instruction, or null if the instruction is not a load or store
-
isLoaded
public boolean isLoaded(XField field)
Return whether or not the given field is loaded by any instruction in the method.- Parameters:
field- the field- Returns:
- true if the field is loaded somewhere in the method, false if it is never loaded
-
instructionIsLoad
public boolean instructionIsLoad(org.apache.bcel.generic.InstructionHandle handle)
Return whether or not the given instruction is a load.- Parameters:
handle- the instruction- Returns:
- true if the instruction is a load, false if not
-
-