private class BloatedAssignmentScope.ScopeBlock
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<BloatedAssignmentScope.UserObject,java.lang.Integer> |
assocs |
private java.util.List<BloatedAssignmentScope.ScopeBlock> |
children |
private int |
finishLocation |
private boolean |
isCase |
private boolean |
isGoto |
private boolean |
isLoop |
private boolean |
isSync |
private boolean |
isTry |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
loads |
private BloatedAssignmentScope.ScopeBlock |
parent |
private int |
startLocation |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
stores |
Constructor and Description |
---|
ScopeBlock(int start,
int finish)
constructs a new scope block
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(BloatedAssignmentScope.ScopeBlock newChild)
adds a scope block to this subtree by finding the correct place in the hierarchy to store it
|
void |
addLoad(int reg,
int pc)
adds the register as a load in this scope block
|
void |
addStore(int reg,
int pc,
BloatedAssignmentScope.UserObject assocObject)
adds the register as a store in this scope block
|
private boolean |
appearsToBeUserRegister(int reg)
in some cases the java compiler synthesizes variable for its own purposes.
|
void |
findBugs(java.util.Set<java.lang.Integer> parentUsedRegs)
report stores that occur at scopes higher than associated loads that are not involved with loops
|
java.util.List<BloatedAssignmentScope.ScopeBlock> |
getChildren()
returns the children of this scope block
|
int |
getFinish()
returns the end of the block
|
BloatedAssignmentScope.ScopeBlock |
getParent()
returns the scope blocks parent
|
int |
getStart()
returns the start of the block
|
boolean |
hasChildren() |
boolean |
isCase()
returns whether this block was caused from a case block
|
boolean |
isGoto()
returns whether this block was caused from a goto
|
boolean |
isLoop()
returns whether this scope block is a loop
|
boolean |
isSync()
returns whether this block was caused from a synchronized block
|
boolean |
isTry()
returns whether this block was caused from a try block
|
void |
markFieldAssociatedWrites(int sourceReg) |
void |
pushUpLoadStores()
push all loads and stores to this block up to the parent
|
void |
removeByAssoc(java.lang.Object assocObject)
removes stores to registers that where retrieved from method calls on assocObject
|
void |
removeChild(BloatedAssignmentScope.ScopeBlock child)
removes a child from this node
|
void |
setCase()
sets that this block was caused from a case block
|
void |
setFinish(int finish)
sets the finish pc of the block
|
void |
setGoto()
sets that this block was caused from a goto, (an if block exit)
|
void |
setLoop()
sets that this block is a loop
|
void |
setStart(int start)
sets the start pc of the block
|
void |
setSync()
sets that this block was caused from a synchronized block
|
void |
setTry()
sets that this block was caused from a try block
|
java.lang.String |
toString()
returns a string representation of the scope block
|
boolean |
usesReg(java.lang.Integer reg)
returns whether this block either loads or stores into the register in question
|
private BloatedAssignmentScope.ScopeBlock parent
private int startLocation
private int finishLocation
private boolean isLoop
private boolean isGoto
private boolean isSync
private boolean isTry
private boolean isCase
private java.util.Map<java.lang.Integer,java.lang.Integer> loads
private java.util.Map<java.lang.Integer,java.lang.Integer> stores
private java.util.Map<BloatedAssignmentScope.UserObject,java.lang.Integer> assocs
private java.util.List<BloatedAssignmentScope.ScopeBlock> children
public ScopeBlock(int start, int finish)
start
- the beginning of the blockfinish
- the end of the blockpublic java.lang.String toString()
toString
in class java.lang.Object
public BloatedAssignmentScope.ScopeBlock getParent()
public java.util.List<BloatedAssignmentScope.ScopeBlock> getChildren()
public int getStart()
public int getFinish()
public void setStart(int start)
start
- the start pcpublic void setFinish(int finish)
finish
- the finish pcpublic boolean hasChildren()
public void setLoop()
public boolean isLoop()
public void setGoto()
public boolean isGoto()
public void setSync()
public boolean isSync()
public void setTry()
public boolean isTry()
public void setCase()
public boolean isCase()
public void addStore(int reg, int pc, BloatedAssignmentScope.UserObject assocObject)
reg
- the register that was storedpc
- the instruction that did the storeassocObject
- the the object that is associated with this store, usually the field from which this camepublic void removeByAssoc(java.lang.Object assocObject)
assocObject
- the object that a method call was just performed onpublic void addLoad(int reg, int pc)
reg
- the register that was loadedpc
- the instruction that did the loadpublic void addChild(BloatedAssignmentScope.ScopeBlock newChild)
newChild
- the scope block to add to the treepublic void removeChild(BloatedAssignmentScope.ScopeBlock child)
child
- the child to removepublic void markFieldAssociatedWrites(int sourceReg)
public void findBugs(java.util.Set<java.lang.Integer> parentUsedRegs)
parentUsedRegs
- the set of registers that where used by the parent scope blockprivate boolean appearsToBeUserRegister(int reg)
reg
- the register to checkpublic boolean usesReg(java.lang.Integer reg)
reg
- the register to look for loads or storespublic void pushUpLoadStores()
Copyright © 2005-2018 MeBigFatGuy.com. All Rights Reserved.