Class LoadedFieldSet
java.lang.Object
edu.umd.cs.findbugs.ba.vna.LoadedFieldSet
Object 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCount number of times a field is loaded and/or stored in the method. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BitSetprivate final Map<XField, LoadedFieldSet.LoadStoreCount> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a load of given field at given instruction.voidAdd a store of given field at given instruction.getField(org.apache.bcel.generic.InstructionHandle handle) Get the field loaded or stored at given instruction, if any.getLoadStoreCount(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.booleanReturn whether or not the given field is loaded by any instruction in the method.
-
Field Details
-
loadStoreCountMap
-
handleToFieldMap
-
loadHandleSet
-
-
Constructor Details
-
LoadedFieldSet
public LoadedFieldSet(org.apache.bcel.generic.MethodGen methodGen) Constructor. Constructs an empty object.- Parameters:
methodGen- the method being analyzed for loads/stores
-
-
Method Details
-
getLoadStoreCount
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
Add a load of given field at given instruction.- Parameters:
handle- the instructionfield- the field
-
addStore
Add a store of given field at given instruction.- Parameters:
handle- the instructionfield- the field
-
getField
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
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
-