Skip to content

Commit

Permalink
add some definitions to clarify the symbols (RangerNJU#2)
Browse files Browse the repository at this point in the history
* add some definitions

* Remove alt tag

Co-authored-by: Ranger <[email protected]>
  • Loading branch information
2 people authored and LaplaceDem0n committed Dec 4, 2020
1 parent 0d66046 commit b6afa81
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Binary file added .gitbook/assets/image-20201201151956869.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Getting started with static program analysis. Read this and start writing your f
3. 通过邮箱联系我(ranger.nju\#gmail.com\)
* 如果你觉得我写得不错,可以到GitHub仓库中给我一个Star,也可以在自己的社交圈子中宣传,让更多的人了解这个项目。

~~~~👋 ~~根据不完全统计,已经有数千次首页访问,每天都会有数十位世界各地的新读者到访,不过收到的意见和建议寥寥。~~

### 更新记录与里程碑事件

Expand Down
4 changes: 2 additions & 2 deletions ch2/02-03-pointer2-analysis-spa.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ PFG的整个构造过程,需要在构建PFG和在已有的PFG上传递指向

* 由于做流不敏感分析。输入为Set,丢失了语句的顺序关系也没关系。
* WorkList:保存接下来要处理的指向信息,与BFS中的队列作用类似。
* Each worklist entry 𝑛, 𝑝𝑡𝑠 is a pair of pointer 𝑛 and points-to set 𝑝𝑡𝑠, which means that 𝑝𝑡𝑠 should be propagated to 𝑝𝑡\(𝑛\)
* pts定义:Each worklist entry 𝑛, 𝑝𝑡𝑠 is a pair of pointer 𝑛 and points-to set 𝑝𝑡𝑠, which means that 𝑝𝑡𝑠 should be propagated to 𝑝𝑡\(𝑛\)
* E.g., $$[(x,\{o_i\}),(y,\{o_j, o_k\}),(x.f,\{(o_l)\}),\dots]$$

首先,四个红框部分对应之前提到的四种基本语句——New、Assign、Store和Load。接下来做详细讲解。
Expand All @@ -125,7 +125,7 @@ PFG的整个构造过程,需要在构建PFG和在已有的PFG上传递指向

首先考虑两种简单的语句:New和Assign。

* 前三行代码做初始化的工作,并针对所有的**New**语句,将所有的初始指向关系加入WorkList。
* 前三行代码做初始化的工作,并针对所有的**New**语句,将所有的初始指向关系加入WorkList。注意pt(n)初始化后为空集{},随着算法的迭代会增加元素。
* 之后的两行代码处理**Assign**语句,添加`y->x`的边到PFG中。添加边的具体算法如下

![](../.gitbook/assets/image-20201112191630283.png)
Expand Down
4 changes: 4 additions & 0 deletions ch2/02-04-pointer3-analysis-spa.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ void foo(A a) {

这个规则看起来复杂得多,我们一点一点来解析。首先,请读者们暂停一下,回忆一般语言如何处理过程调用。即过程调用时到底发生了什么。

各个符号的定义为:

<img src="F:\Gossip_Proj\SPA\Static-Program-Analysis-Book\.gitbook\assets\image-20201201151956869.png" style="zoom: 67%;" />

![](../.gitbook/assets/image-20201126230831572.png)

> 一个参考答案:保存现场,构造调用栈帧,传递参数,跳转到目标函数开始执行……目标函数执行完毕跳转回来,后从预定的位置取返回值(若需要),恢复现场,继续往下执行……
Expand Down

0 comments on commit b6afa81

Please sign in to comment.