Upwards exposed uses serves a similar purpose to reaching definitions analysis. Instead of finding which definitions reach each point, we find which uses of a variable have not yet been matched with one or more definitions. Given a control flow graph <V,E> the use of the variable x at vertex v is upwards exposed at a vertex u (i.e., <x,v> ∈ UEU(u)) iff:
The input will be in the form of a Java .class file. For the output you should print all the upward exposed uses to a file called exposed-uses.txt in the same location from where the code is run.
Note that you should not print the upward exposed uses to STDOUT. Any output to STDOUT or STDERR will be ignored. If the program creates any .jimple/.jimp files in the directory sootOutput, let them stay there; you should not delete them.
z = 2 y = 10 x = y*zFor example in the case of the above code, there are just three nodes in the graph- z = 2, y = 10, and x = y*z, in which case the output to the file exposed-uses.txt should be:
z=2 x = y*z z y = 10 x = y*z z y = 10 x = y*z yWhile actually running your code for the above case the names of the nodes, branch labels, and variables in the control flow graph passed to your analysis class may vary slightly depending on Soot's pre-processing, and so the names of the nodes and variables printed to the file may be different; that is okay.
You may print the exposed uses in any order. But you should cover all upward exposed uses for the exit points of all nodes and you should not repeat the same exposed use twice in the file. You are given few test cases and the expected outputs in the base code.
You should write the solutions to parts (a) - (c) in a PDF files called hw3.pdf. For part (d), you will be implementing data flow analyses using SOOT. You are given the base Java code . You will modify the file UpwardExposedUses.java to add your code. You will not edit any other file. You are expected to submit only the file UpwardExposedUses.java. (Any helper or additional classes you may need to create should be created within this file itself.)
You must create your UpwardExposedUses class by extending any of the Data Flow Analysis classes provided by Soot, and overriding the appropriate functions accordingly. You must not use any library or package (other than Soot) or code from any such library or package- all code you submit must be your own.
The code will be tested on different examples. For each correct output, you will get an equal fraction of the problem points. In other words, if your code returns the correct output on all tests, you will get a full mark, and for every wrong answer you will lose (proportionally) some points. Beyond this, there are no partial marks for any partial efforts.
If the code fails to compile, returns a runtime error due to your fault, or fails to print the results in the correct format to the exposed-uses.txt file you may not get any marks.