Complete the program dependence graphs for the program shown above and
a) Complete the
1. Add edges for data dependences in all graphs.
2. Combine the individual SDGs. In particular, you need to add call edges from the call sites to
the invoked method entry node, parameter-in edges from the actual parameters to the formal
parameter nodes, and parameter-out edges from the return value ($ret) to the node where the
result is used or from the fields of objects that constitute a side-effect.
3. Add Summary Edges that summarize the effect of parameters on the result. Any summary edge
symbolizes a parameter that has a directed path from its parameter edge to the return value of
the respective function invocation.
b) Determine the 2-phase (context-sensitive) slice of the second call to println(o.get()). Which nodes
are marked in the first phase, which in the second?
![1 class A {
2
int x;
3
void set() { x = 0;}
void set (int i) {x:
=
int get() {return x; }
4
5
6
7 class B extends A {
}
8 void set (){ x = 1;}
9 }
i;}
10 class Main {
11
12
13
14
15
16
17
18
19
20 }
static void main(String[] args) {
int pub 1; int sec = 0;
A o = new A();
o.set(pub);
=
System.out.println (o.get());
if (sec==0 && args[0].equals("042"))
o = new B();
o.set();
System.out.println (o.get());](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1f508c53-af29-498e-8791-77e45ebbdaaf%2Fd5638a14-20e6-4960-81aa-934d2bd47a6a%2Flqk79e_processed.png&w=3840&q=75)

Step by step
Solved in 8 steps with 7 images









