Configuration - The Indus Java Slicer requires a configuration to specify details such as the type of slice to be performed (backward, forward or complete), the types of dependencies to track in the slice (ready, divergence, interference) [HatcliffSAS99] and the parameters for each dependency. In short, it is the configuration of the slicer. To learn more about the configuration please look at the Indus Java Slicer Documentation
Example 1. Example conversion of Java into Jimple
Consider nw++ , a Java expression. Following is a Jimple representation of this expression:
In the first statement, the reference from monitor field is assigned to a local variable i2. In the next statement, the local variable i3 is assigned the incremented value of i2 and finally the original field is updated.
As the Indus Java Slicer works on Jimple, the criteria for slicing is specified as Jimple chunks. From the above illustration, a Java statement can map to many Jimple statements. Therefore, when a Java statement/expression needs to be used as a slice criteria in Kaveri , the user has to pick one or more of the Jimple statements to which the Java statement/expression is mapped to. For more information about Jimple please refer to [VH98] . For more exposition about how to pick criteria closest to your requirements, please refer to Appendix - How to pick criteria.
Value of the expression - When an expression / statement is specified as a criteria, does this mean that:
In the former we consider all those statements which might affect the computed value of the expression while in the latter we consider only those statements through which control can reach the selected expression or statement.
Example 2. Example to show the influence of control or value while choosing a criteria
Consider the following fragment of code.
public static void main(final String[] args) {
int a, b;
a = b =1 + randInt();
if (a ==2) {
a = 10;
}
else {
b = 20;
}
a = a + b;
}
If the statement a = a + b is chosen as the criteria, picking control or value causes different slices to be generated. If control is picked, the statements corresponding to if conditional will be ignored in the slice as they don't affect the reachability of the chosen statement. However if the value of the expression is picked then the conditional statements have to be included as they affect the computed value of the expression.
Scope Specification - A scope specification restricts the scope that the slicer considers while performing a slice. When a criteria is embedded within a scope, the slicer does not consider elements outside the scope, while calculating the slice. For example, if a backward slice if performed with a criteria C which is present in a method foo and the method foo is specified as a scope and suppose that no other functions are called in foo. Then the backward slice only contains elements withing the method foo. It should be noted that the specified criteria should be contained within the scope, to get a result from the slicer.
Kaveri allows three types of entities to be added to the scope:
The class scope specification defines the class or classes that should be considering as defining a scope, while performing the slice. The scope specification is given a Scope Name to identify it from the other scope specifications. The class scope specification also allows the scope around the class to be specified. These include:
Just this class - Only consider the class and not the relatives of the class. In this case, the class type specification can be entered as a regular expression. All the classes whose names match the expression are added to the scope. For example, giving a type of "foo.bar.*" will match all classes in the package "foo.bar".
Ancestors excluding this class - Consider all the ancestors of this class for scoping, but ignore the chosen class. In this case, the class type should be the fully qualified name of the class.
Ancestors including this class - Consider all the ancestors of this class for scoping, including the chosen class. In this case, the class type should be the fully qualified name of the class.
Descendants excluding this class - Consider all the descendants of this class for scoping, but ignore the chosen class. In this case, the class type should be the fully qualified name of the class.
Descendants including this class - Consider all the descendants of this class for scoping, including the chosen class. In this case, the class type should be the fully qualified name of the class.
Context Sensitive Slicing - Context sensitive slicing allows the user to prune the call chain used by the slicer when calculating a backward slice. For example, if method m contains the criteria C, and there are two call chains z -> y -> x -> m and a -> b -> c -> m (z,y,x,a,b,c are also methods) coming into m . The call chain a -> b -> c -> m might be more interesting with respect to a backward slice from m with C as the criteria than the other call chain. The user can specify the call chain a -> b -> c -> m as the Context for the backward slice. The slicer then ignores the call chain z -> y -> x -> m . Note that beyond a, the call chain is unspecified, so all the call chains beyond that point are considered for slicing.
Note that to perform a context sensitive slice, the call chain should terminate with a method which contains a criteria for the slice.