wala / WALA

T.J. Watson Libraries for Analysis, with frontends for Java, Android, and JavaScript, and may common static program analyses
http://github.com/wala/WALA
Eclipse Public License 2.0
750 stars 221 forks source link

Phis in Wala #320

Open sohah opened 6 years ago

sohah commented 6 years ago

I am trying to understand how phis are constructed in WALA. It looks like they are generated in two places, addPhiForLocal and addPhiForStackSlot. These two are embedded in the larger context of meet method. Now I really do not understand why do we need addPhiForLocal when in fact addPhiForStackSlot will take care of all phis, it doesn't seem that we need the other one. Can anyone explain the reasoning behind that?

Thanks

msridhar commented 6 years ago

Oof it's been a long time since I've been in this code. @juliandolby any thoughts here?

juliandolby commented 5 years ago

I assume you are talking about SSA for bytecode; note that SSA is constructed for the source front ends using the standard dominance frontier algorithm.

I believe what can happen is that the same local can be written in two different basic blocks, and then read in a successor block. This requires a 𝜙 node to merge the writes to the stack slot.