Pointer Flow Graph with C.S.

Pointer flow graph of a program is a directed graph that expresses how objects flow among the pointers in the program.

Nodes: CSPointer = (C × V) ∪ (C × O × F)

A node n represents a context-sensitive variable or a field of a context-sensitive abstract object. With C.S., the nodes (pointers) are qualified by contexts.

Edges: CSPointer × CSPointer

An edge x→y means that the objects pointed by pointer x may flow to (and also be pointed to by) pointer y. e.g., edge c: a → c’: b means that objects in pt(c: a) may flow to pt(c’: b).

The PFG contains two nodes for variable n in method id(), one node per context.

Untitled

spaces_-MJC1RRYQ991XoNX219t_uploads_git-blob-619ac1c0606d997392db11213c97cca0a8c2d45f_image-20201210184448955.png

Untitled

屏幕截图 2022-08-09 104157.png

callsite 拥有上下文的原因是,同一个 callsite 其在不同的上下文中,调用的方法可能是不同的。以此例来看,如果 x.foo(a1,a2) 中的 x 是由参数传入,那么在不同的上下文之下,x 可能指向不同的对象。

Untitled

Untitled

注:AddEdge(s, t) 中的 s 指 source,t 指 target。

Select in Processcall

spaces_-MJC1RRYQ991XoNX219t_uploads_git-blob-b8bfbda98724b7e8e34ddf6ec5c9a3640ea4ca0b_image-20201216202538515.png

spaces_-MJC1RRYQ991XoNX219t_uploads_git-blob-a32d885d463ffe8ccb3cf608053a1d770210a217_image-20201210191310040.png