• 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.

  • 相关阅读:
    vi常用命令学习
    [Oracle]约束(constraint)
    [Oracle]高水位标记(HWM)
    线性表&顺序线性表
    ERP,ARP瘦身并如何删除。
    Oracle 如何开启归档模式
    oracle9i的erp数据库无法正常关闭的解决方法。
    C语言学习之assert
    ORA-00257 archiver error的处理
    单利与复利
  • 原文地址:https://www.cnblogs.com/Shimarin/p/15058149.html
Copyright © 2020-2023  润新知