Your assignment is to implement a basic dataflow
framework for the joeq
system. We will provide the interfaces that
your framework must support. You will write the iterative algorithm
for any analysis matching these interfaces, and also phrase Reaching
Definitions in terms that any implementation of the solver can
understand.
/usr/class/cs243/dataflow
.
Flow.java
contains the interfaces and the main
program. The file ConstantProp.java
contains classes
that define a limited constant propagation algorithm.
Your task is twofold:
MySolver
that implements
Flow.Solver
. Use it to run the constant
propagation algorithm we provide.ReachingDefs
that implements
Flow.Analysis
and solves the reaching
definitions problem.You may define any other classes you need to solve this problem.
However, do not modify either Flow.java
or
ConstantProp.java
. We will be using our own copies for
grading purposes.
Flow
is runnable, and takes three (or more)
arguments. The first argument is the name of the class that holds the
analysis you want to run. The second is the name of the solver to
use. All others are the names of classes to analyze. So, to run
constant propagation on test.class
, enter the
command:
java Flow MySolver ConstantProp test
And it should do the right thing.
A Makefile
is included to help you compile and run your code.
To compile you solver, enter the command:
make solver
To compile your reaching definitions analysis, enter the command:
make reachingdefs
We have provided a very simple program, called
test.java
, in the code directory. The file
test.txt
produces output that should match your output
when you run your Solver with it. We also provide the test.class
to ensure everyone has the same, so you shouldn't compile it yourself.
Here again, the Makefile
is here to help you. To test constant propagation, just type
make test_constantprop
And to test reaching definition:
make test_reachingdefs
To test both:
make test
A submit.sh
script is available in the usr/class/cs243/dataflow/submit.sh. Follow these steps:
MySolver.java
and ReachingDefs.java
.
/usr/class/cs243/dataflow/submit.sh foowhere
foo
is the Sunet ID of your partner.
ConstantProp
classes. You will find
techniques that will be useful to you when you formulate
ReachingDefs
.joeq
is still an
experimental system; if you wish to attempt something
particularly tricky, you may find it enlightening to sourcedive.QuadIterator
interface carefully. It
does a great deal of the work for you.