Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of "Complete Computation Slice" algorithm #1

Open
16 of 17 tasks
KuYaki opened this issue Mar 29, 2021 · 0 comments
Open
16 of 17 tasks

Implementation of "Complete Computation Slice" algorithm #1

KuYaki opened this issue Mar 29, 2021 · 0 comments

Comments

@KuYaki
Copy link
Collaborator

KuYaki commented Mar 29, 2021

We want to extend existent code decomposition tool by adding complete computation slice based on the paper. To achieve this goal we have to implement additional Python tool which will present the result of the decomposition. Base version of that tool should be able to save the result to files in a specified folder or print it via stdout. Input is assumed to be a file or a folder with files. More detailed IO format is described below:

$ python main.py command [-h]
                         [-o OUTPUT]
                         source

Positional arguments:

command - method of decomposition, base version should maintain one method - slice

source - source folder or file

Optional arguments:

-o, --output OUTPUT - output file or directory: depending on what you set as output, you will get folder full of different decompositions or a single file with it. It uses stdout if not specified

-h, --help - show this help message and exit


Motivation:

Complete computation slice allow to obtain new types of decomposition fast and effective. Moreover, this method by itself may be even more extended by 'object state slice' which is described in the same [paper](https://dl.acm.org/doi/abs/10.1016/j.jss.2011.05.016).

Development:

The main.py script should parse arguments and call specified decomposer, that should parse files, decompose them and save the result to a specified folder (or print it if folder is not specified). Each decomposer should be able to be called with a source code String as an argument for its further usage as a submodule in some other project. Therefore complete computational slice decomposer may return a dictionary of variable declarations (i.e number of string where the variable is declared) as a key and the corresponding slice (i.e number of strings where the variable is used) as a value.

Complete Computational Slice Decomposer INPUT:

 1 class A {
 2     int main() {
 3         String a = "";
 4         int b = 0;
 5         a = "Hello, World!";
 6         System.out.println("main:");
 7         b = a.length();
 8         System.out.println(a);
 9         b *= 10;
10         return b;
11     }
12 }

Complete Computational Slice Decomposer OUTPUT:

{
    "3": [5, 7, 8],
    "4": [7, 9],
}

There is a list of necessary steps to implement:

  • 1. Interface - build user interface for testing and usage
  • 2. Control Flow Graph - build the CFG of the source code
  • 3. Control Dependence Graph - build the CDG of the source code
  • 4. Local Variables - obtain all the local variables nodes of the functions in the given source code
  • 5. Seed Statements - for each variable identify the set of seed statements which contain an assignment of that variable
  • 6. Reach - build so called Reach set for each seed statement
  • 7. Dom - build so called Dom set for each seed statement
  • 8. Blocks - build so called Blocks set for each seed statement (check if we really need both Dom and Reach for this task)
  • 9. Common Blocks - calculate the common boundary blocks for each variable
  • 10. Data Dependency Graph - build the DDG of the source code
  • 11. Program Dependency Graph - build the PDG of the source code
  • 12. Backward Slice - for each seed statement build a set of statements that may affect the computation of that statement
  • 13. Complete Computation Slice - for each variable build a backward slice union of its seed statements
  • 14. Code Generation - build new source code based on complete computation slices
  • 15. Multi Application - apply code generation for each combination of complete computation slices
  • 16. Documentation - add readme and functions description
  • 17. Tests - add test suit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant