Package daikon
Class PptSliceEquality
-
- All Implemented Interfaces:
Serializable
public class PptSliceEquality extends PptSlice
Holds Equality invariants.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PptSliceEquality.EqualityComparator
Order Equality invariants by the indices of leaders.-
Nested classes/interfaces inherited from class PptSlice
PptSlice.ArityPptnameComparator, PptSlice.ArityVarnameComparator
-
Nested classes/interfaces inherited from class Ppt
Ppt.NameComparator
-
-
Field Summary
Fields Modifier and Type Field Description static Logger
debug
static Logger
debugGlobal
static boolean
dkconfig_set_per_var
If true, create one equality set for each variable.-
Fields inherited from class PptSlice
debugFlow, debugGeneral, debugGuarding, invs, lineSep, parent
-
Fields inherited from class Ppt
emptyInvList, var_infos
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Invariant>
add(ValueTuple vt, int count)
Returns a List of Invariants that have been weakened/destroyed.void
addInvariant(Invariant inv)
int
arity()
List<Invariant>
copyInvsFromLeader(VarInfo leader, List<VarInfo> newVis)
Instantiate invariants from each inv's leader.List<Equality>
createEqualityInvs(List<VarInfo> vis, Equality leader)
Create a List of Equality invariants based on the VarInfos in vis.VarInfo[]
get_leaders_sorted()
Returns an array of all of the leaders sorted by varinfo_index for this equality view.void
instantiate_from_pairs(Set<VarInfo.Pair> eset)
Instantiate the full equality sets from a set of variable pairs where each member of a pair is equal to the other.int
num_mod_samples()
int
num_samples()
Return an approximation of the number of samples seen on this slice.int
num_values()
Return an approximation of the number of distinct values seen on this slice.void
repCheck()
Check the internals of this slice.String
toString()
For debugging only.-
Methods inherited from class PptSlice
allPrestate, contains_inv, contains_inv_exact, containsOnlyGuardingPredicates, copy_new_invs, find_inv_by_class, find_inv_exact, is_inv_true, log, name, processOmissions, remove_falsified, removeInvariant, removeInvariants, usesVar, usesVar, usesVarDerived
-
Methods inherited from class Ppt
containsVar, find_var_by_name, indexOf, trimToSize, varNames, varNames
-
-
-
-
Field Detail
-
dkconfig_set_per_var
public static boolean dkconfig_set_per_var
If true, create one equality set for each variable. This has the effect of turning the equality optimization off, without actually removing the sets themselves (which are presumed to exist in many parts of the code).
-
debugGlobal
public static final Logger debugGlobal
-
-
Method Detail
-
arity
public final int arity(@UnknownInitialization(PptSlice.class) PptSliceEquality this)
-
addInvariant
public void addInvariant(Invariant inv)
- Specified by:
addInvariant
in classPptSlice
-
num_samples
public int num_samples(@UnknownInitialization @GuardSatisfied PptSliceEquality this)
Description copied from class:PptSlice
Return an approximation of the number of samples seen on this slice.- Specified by:
num_samples
in classPptSlice
-
num_mod_samples
public int num_mod_samples()
-
num_values
public int num_values()
Description copied from class:PptSlice
Return an approximation of the number of distinct values seen on this slice.- Specified by:
num_values
in classPptSlice
-
instantiate_from_pairs
public void instantiate_from_pairs(Set<VarInfo.Pair> eset)
Instantiate the full equality sets from a set of variable pairs where each member of a pair is equal to the other.
-
add
public List<Invariant> add(ValueTuple vt, int count)
Returns a List of Invariants that have been weakened/destroyed. However, this handles the creation of new Equality invariants and the instantiation of other invariants.- Returns:
- a List of invariants that have been weakened
-
createEqualityInvs
public List<Equality> createEqualityInvs(List<VarInfo> vis, Equality leader)
Create a List of Equality invariants based on the VarInfos in vis. Assumes that the VarInfos in vis are not missing. The method is used exclusively for reversing optimizations in Daikon.Requires: vis.size() > 0
Ensures: result.size() > 0
- Parameters:
vis
- the VarInfos that were different from leaderleader
- the original leader of VarInfos- Returns:
- a List of Equality invariants bundling together same values from vis
-
copyInvsFromLeader
public List<Invariant> copyInvsFromLeader(VarInfo leader, List<VarInfo> newVis)
Instantiate invariants from each inv's leader. This is like instantiate_invariants at the start of reading the trace file, where we create new PptSliceNs. This is called when newVis have just split off from leader, and we want the leaders of newVis to have the same invariants as leader.post: Adds the newly instantiated invariants and slices to this.parent.
- Parameters:
leader
- the old leadernewVis
- a List of new VarInfos that used to be equal to leader. Actually, it's the list of canonical that were equal to leader, representing their own newly-created equality sets.
-
repCheck
public void repCheck()
Description copied from class:PptSlice
Check the internals of this slice. Each invariant in the slice is checked for consistency and each inv.ppt must equal this.
-
toString
@SideEffectFree public String toString(@GuardSatisfied PptSliceEquality this)
Description copied from class:PptSlice
For debugging only.
-
get_leaders_sorted
public VarInfo[] get_leaders_sorted()
Returns an array of all of the leaders sorted by varinfo_index for this equality view.
-
-