Phase 4 Instructions

Installation

Same as for phase 3: cp /projects/proganalysis/SEII-project/phase4/phase4.tar in "project", untar, edit "run" to set the root.

New: Configuration

Edit file ~/.cshrc: add lines  setenv JAVAVERSION 12  and  setenv PATH .':'$PATH

Execute .cshrc: source ~/.cshrc

Stage 0: Set up the test harness

Edit file phase4/myharness/config.java: change the value of srcdir to point to your phase4 directory. Compile the harness: cd phase4; javac myharness/*.java.

Stage 1: Set up and run the tests

Compile component "sample", its test driver, and the test: cd phase4; javac sample/*.java. Run the tests through "runOriginal" inside "run". The output may look something like "PASS: ...." - this shows that a test has passed. Do the same for the three other components. (Note: when compiling component "zip", you will get warnings about deprecated APIs; ignore them.)

Read carefully all files in "sample" to understand the structure of the test driver and the tests. The CUT in "sample" is a simplification of program p5 from the previous phases.

Stages 2 and 3

Compile *.java in phase4. Generate JIMPLE and run CHA as in phase3. (You don't need to change anything in the CHA implementation) Examine output files rmethods.cut, nmethods.cut, and edges.cut in "sample". Make sure that you understand everything in these three files.

Finish Stage 4

Run addInstrumentation and examine the JIMPLE files in CLASSES. Read carefully the code in MyTransformer; the comments in the code will tell what exactly needs to be done. Modify MyTransformer to insert JIMPLE calls to the appropriate version of RuntimeTracker.beforeCall for virtualinvoke and interfaceinvoke call sites. Add the method to RuntimeTracker. Generate the instrumented code and examine the JIMPLE files in CLASSES for correctness.

Note: If you rerun stage 4 after you have started making changes to RuntimeTracker (in stage 5, see below), Soot may complain about "phantom classes" or "type inference failed". This is due to a small problem in the infrastructure that I haven't had the time to fix. If this happens, run stage 4 with the original RuntimeTracker downloaded from the web site, not with your own modified version of RuntimeTracker. Of course, when you run stage 5, you will use your own RuntimeTracker.

Finish Stage 5

Run runInstrumented to observe the effects of the instrumentation. Read the current code in RuntimeTracker, and then add new code (possibly reusing some of your code from phase3). Make sure that your new implementation of RuntimeTracker prints all necessary info in files nmethods and nedges, as described in the overview. When working on RuntimeTracker, just do "javac RuntimeTracker.java" followed by "run"; inside "run", only execute runInstrumented.

Submit the results

Create a table

Use latex, MS Word, etc. to create a table with the results, and turn it in on May 5. The table should have the following format:

Component

CUT Classes

CUT Methods

UnreachCM

CovReachCM

NcovReachCM

CUT Edges

NcovCE

sample

2

5

1   (20%)

4   (80%)

0   (0%)

4

1   (25%)

gzip

 

 

 

 

 

 

 

zip

 

 

 

 

 

 

 

collator

 

 

 

 

 

 

 

The table contains

Additional Resources