zoukankan      html  css  js  c++  java
  • NJU Static Program Analysis 09: Pointer Analysis II

    NJU Static Program Analysis 09: Pointer Analysis II

    Abstract

    • Understand pointer analysis rules
    • Understand pointer flow graph
    • Understand pointer analysis algorithms

    Notes

    In this lecture, we will study some theoretical foundations of pointer analysis. Let's start with the notations:

    Type Notation
    Variables (x,y in V)
    Fields (f, g in F)
    Objects (o_i, o_j in O)
    Instance fields (o_i.f, o_j.g in O imes F)
    Pointers (Pointer = V cup (O imes F))
    Points-to relations (pt: Pointer o mathcal P(O))

    And for the pointer related statements, we furtherly have:

    Type Statement Rule
    New i: x = new T() (overline {o_i in pt(x)})
    Assign x = y (Large frac{o_i~ in~ pt(y)}{oi ~in~ pt(x)})
    Store x.f = y (Large frac{o_i ~in~ pt(x),~ o_j ~in~ pt(y)}{o_j ~in~ pt(o_i.f)})
    Load y = x.f (Large frac{o_i ~in~pt(x),~ o_j ~in~pt(o_i.f)}{o_j ~in~pt(y)})

    Formulas above the line are the premises, and the under ones are the conclusions. The conclusion without a premise is an unconditional one.

    Observing theses rules, we can find that except the New statement, other statements abstractly described the flow of points-to information. Based on this observation, we can construct a Pointer Flow Graph(PFG) that maintaining the flow-to relations of the points-to information. For the assign statement we have an edge (y o x), for the store statement (y o o_i.f) and for the load statement (o_i.f o y).

    If we have constructed a PFG, then after all the transferring of the points-to information, the pointer analysis would be done. However as we can see, the construction of the PFG is somehow relies on the points-to information we need. In this context, the pointer analysis algorithm will become more complex than common SPFA.

    image-20210725124801755

    The (pt) map maintains the final result of our pointer analysis. Solve() differs from normal BFS that it adds edges to the graph while searching through it. Generally it's easy to understand.

  • 相关阅读:
    程序员过年必备 -- Auto.js微信自动抢红包
    VSCode, Django, and Anaconda开发环境集成配置[Windows]
    pandas to_excel 修改excel样式以及格式
    hvac系统开源项目情况匠能智控
    安卓作业(有空再整理)
    在jetson nano中配opencv环境(python通用)
    获取深度图像
    英伟达开发板安装python-opencv下的问题
    在vs2015中对kinectV2环境搭建,环境配置
    PagerSlidingTabStrip 导入 Android Studio 的教程
  • 原文地址:https://www.cnblogs.com/Shimarin/p/15058149.html
Copyright © 2011-2022 走看看