Oberon-2 Slicing Tool

User Interface

Data Dependences are visualized as reaching definitions at the place where a value is used. A popup element collects all reaching definitions. One can select an entry from the popup element in order to highlight the respective definition.
The following source code is a part of module TestIF.Mod. The numbers at the beginning of the line indicate the source code position in the original file (see figure below).

The popup elements for the data dependences are shown in grey, labelled "DDs". The popup element in line 986 has two entries: one for the definition in line 928 and one for the definition in line 831.

By selecting the first entry, the line 928 is selected.

By selecting the second entry, the line 831 is selected.

By clicking in the line 1043, the slice is computed for that line and highlighted in blue. Line 1043, line 720, and line 822 as well as the declaration of i are part of the slice.

By clickinig in the line 986, the slice is computed for that line and highlighted in blue. Lines 720 to 986 are part of the slice, as well as the declarations of i and j.

Another example shows how side effects due to function calls are handled. Procedure DoSideEffects00 calls the function ChangePar during the evaluation of the IF. ChangePar assigns to the reference parameter i. Therefore, the definition of i in line 3389 is killed by the definition due to the function call in line 3407.

Function ChangePar has a parameter info element indicating the flow of information. An upward arrow indicates the definition of a parameter without usage (OUT parameter), a downward arrow indicates the usage of a parameter without definition (IN parameter). Exclamation marks indicate possible problems like "parameter is never used" or "assignment to value parameter" for value parameters and "possibly not set" for reference parameters.

By clicking on the parameter info element, the procedure is sliced for the output parameter i. Only the assignment in line 409 is included into the slice.

All call sites are collected in the popup element labelled "called at". The call site within procedure DoSideEffects00 is the first entry in the list of entries.

By selecting an entry, the respective procedure is highlighted (see below for selecting the first entry). The popup element at the call site (labelled "calling", e.g. in line 3407 of procedure DoSideEffects00) can be used to navigate backwards. Clicking on this popup element jumps back to the called function (in this case ChangePar).

There are two reaching definitions for the variable j in line 3543: one to the initial definition in line 3398 and another one for the definition within the IF.

By selecting the second entry, the initial definition is selected.

By selecting the first entry, the definition within the IF is selected.

Module TestCall.Mod demonstrates how the slicer handles procedure calls and recursion. If a called procedure accesses global variables, these variables are shown as additional parameters. E.g., procedure TestIndirectRecursion2 calls procedure DefGlobal. Procedure DefGlobal defines the global variable global which becomes an additional parameter of procedure DefGlobal and also of procedure TestIndirectRecursion2. Since TestIndirectRecursion1 calls TestIndirectRecursion2, it becomes also an additional parameter of TestIndirectRecursion1. If there is a naming conflict between an additional parameter and a local variable or ordinary parameter, the additional parameter is fully qualified (e.g. Modulename.Procedurename).

The parameter info element for the parameter i of procedure UseVarParSometimes shows an exclamation mark because the reference parameter i is used but not assigned (which might be intended at the call site).

The parameter info element for the parameter i of procedure DefValueParSometimes shows an exclamation mark because the value parameter i is defined but the assignment will not affect the variable at the call site (which might be the intention of the definition).

Module TestDyn.Mod demonstrates how polymorphic choice nodes are used.
Procedure Call has a reference parameter t that may have dynamic T or any of its extensions T1, T2, T3, T4, T5.

In Line 904 we see a popup element collecting all methods that might be called via dynamic binding. The last line indicates that there might be further extensions of T in other modules.

The polymorphic choice due to the dynamically bound method call in line 904 is represented by a popup element labelled "dynamic types" that collects the possible dynamic types of the receiver. The user can decide which dynamic types are of interest. She can enable and disable some types or all of them.

When all dynamic types are enabled, there will be two reaching definitions for j in line 927: the initial definition in line 894 and the possible definition due to the method call in line 904.

By selecting the first entry, the initial definition will be selected.

Likewise, by selecting the second entry, the definition due to the method call will be selected.

There will be only one reaching definition for i in line 917. By clicking in the line 917, the slice will be computed with respect to this line. The method call will not be included into the slice.

By clicking on the popup element "DDs" in line 917, the initial definition in line 886 is selected.

By clicking in the line 927, the slice will be computed with respect to this line. The method call in line 904 will be included with all the possibly called methods, leading to a slice that contains 55% of the whole program.

The user can interactively disable some call destinations. And then initiate a computation of more precise data flow information. Disabled call destinations are shown in light grey in the popup element of the dynamic types.

If all call destinations but T.M are disabled, the side-effect due to the second parameter of the method call changes from "non-killing" to "killing". This means that in the above example, the parameter j may have been assigned (e.g. in method T.M) but may not have been assigned (e.g. in methods T1.M and T3.M). Therefore, it has been a non-killing definition, since it may kill previous definitions in some cases but not in all. Now, since T.M is the only possible call destination, the previous definitions must be killed by the method call. Therefore, the slice with respect to line 927 does no longer include the definition of j in line 894. Note, that the value of j is not used in the called method T.M. Thus, it is not necessary to have a reaching definition from the actual parameter j to the reaching definition in line 894 (this is also indicated by the lack of a DDs-popup element!).

A dialog interface can be use to produce a slicing windows and to select some slicing options: