Class SlotVariablePartition
- java.lang.Object
-
- com.tonic.analysis.source.recovery.SlotVariablePartition
-
public class SlotVariablePartition extends Object
Partitions each JVM local slot into one or more source variables using a reaching-definition analysis.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSlotVariablePartition.ScopeNameResolverResolves the source name in scope for a(slot, bytecode offset), or null when unknown.
-
Constructor Summary
Constructors Constructor Description SlotVariablePartition(IRMethod method, IntFunction<String> baseNameForSlot, SlotVariablePartition.ScopeNameResolver scopeNameResolver)Partitions the method's slots immediately, using one resolver for both load and store offsets.SlotVariablePartition(IRMethod method, IntFunction<String> baseNameForSlot, SlotVariablePartition.ScopeNameResolver scopeNameResolver, SlotVariablePartition.ScopeNameResolver storeNameResolver)As the three-argument form, with a dedicated resolver for STORE offsets.SlotVariablePartition(IRMethod method, IntFunction<String> baseNameForSlot, SlotVariablePartition.ScopeNameResolver scopeNameResolver, SlotVariablePartition.ScopeNameResolver storeNameResolver, SlotVariablePartition.ScopeNameResolver scopeDescriptorResolver)As the four-argument form, with a resolver for the declared descriptor in scope, so two components cannot share a debug name unless they share a type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringnameForLoad(LoadLocalInstruction load)StringnameForPhi(PhiInstruction phi)StringnameForStore(StoreLocalInstruction store)
-
-
-
Constructor Detail
-
SlotVariablePartition
public SlotVariablePartition(IRMethod method, IntFunction<String> baseNameForSlot, SlotVariablePartition.ScopeNameResolver scopeNameResolver)
Partitions the method's slots immediately, using one resolver for both load and store offsets.- Parameters:
method- the method to analyzebaseNameForSlot- supplies the fallback name for a slot with no scope namescopeNameResolver- resolves the declared name in scope at an offset, may be null
-
SlotVariablePartition
public SlotVariablePartition(IRMethod method, IntFunction<String> baseNameForSlot, SlotVariablePartition.ScopeNameResolver scopeNameResolver, SlotVariablePartition.ScopeNameResolver storeNameResolver)
As the three-argument form, with a dedicated resolver for STORE offsets.- Parameters:
method- the method to analyzebaseNameForSlot- supplies the fallback name for a slot with no scope namescopeNameResolver- resolves the declared name in scope at a load offset, may be nullstoreNameResolver- resolves the declared name in scope at a store offset, may be null
-
SlotVariablePartition
public SlotVariablePartition(IRMethod method, IntFunction<String> baseNameForSlot, SlotVariablePartition.ScopeNameResolver scopeNameResolver, SlotVariablePartition.ScopeNameResolver storeNameResolver, SlotVariablePartition.ScopeNameResolver scopeDescriptorResolver)
As the four-argument form, with a resolver for the declared descriptor in scope, so two components cannot share a debug name unless they share a type.- Parameters:
method- the method to analyzebaseNameForSlot- supplies the fallback name for a slot with no scope namescopeNameResolver- resolves the declared name in scope at a load offset, may be nullstoreNameResolver- resolves the declared name in scope at a store offset, may be nullscopeDescriptorResolver- resolves the declared descriptor in scope at an offset, may be null
-
-
Method Detail
-
nameForStore
public String nameForStore(StoreLocalInstruction store)
- Parameters:
store- the store whose target variable is wanted- Returns:
- the variable name, or null if the store was not analyzed
-
nameForLoad
public String nameForLoad(LoadLocalInstruction load)
- Parameters:
load- the load whose source variable is wanted- Returns:
- the variable name, or null if the load was not analyzed
-
nameForPhi
public String nameForPhi(PhiInstruction phi)
- Parameters:
phi- the phi whose merged variable is wanted- Returns:
- the variable name, or null if the phi does not represent a local slot
-
-