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.

  • 相关阅读:
    2016孤独重视
    什么时候有空写一篇影评 《含泪活着》
    登录页面总结
    心跳机制
    心跳机制详解
    mysql数据库字符编码修改
    mysql20170404代码实现
    2017全面JAVA面试经历总结
    Oracle经典入门教程
    MySQL基础教程-绝对推荐
  • 原文地址:https://www.cnblogs.com/Shimarin/p/15058149.html
Copyright © 2011-2022 走看看