Demand-driven Alias Analysis Implementation Based on Open64 Xiaomi An

Slides:



Advertisements
Similar presentations
Dataflow Analysis for Datarace-Free Programs (ESOP 11) Arnab De Joint work with Deepak DSouza and Rupesh Nasre Indian Institute of Science, Bangalore.
Advertisements

R O O T S Field-Sensitive Points-to-Analysis Eda GÜNGÖR
Link-Time Path-Sensitive Memory Redundancy Elimination Manel Fernández and Roger Espasa Computer Architecture Department Universitat.
Scalable Points-to Analysis. Rupesh Nasre. Advisor: Prof. R. Govindarajan. Comprehensive Examination. Jun 22, 2009.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
Type-Based Flow Analysis: From Polymorphic Subtyping to CFL-Reachability Jakob Rehof and Manuel Fähndrich Microsoft Research.
Flow insensitive pointer analysis: fixed S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l.
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) Pointer Analysis.
Worst case complexity of Andersen *x = y x abc y def x abc y def Worst case: N 2 per statement, so at least N 3 for the whole program. Andersen is in fact.
Rational XL C/C++ Compiler Development © 2007 IBM Corporation Identifying Aliasing Violations in Source Code A Points-to Analysis Approach Ettore Tiotto,
Bebop: A Symbolic Model Checker for Boolean Programs Thomas Ball Sriram K. Rajamani
Refinement-Based Context-Sensitive Points-To Analysis for JAVA Soonho Kong 17 January Work of Manu Sridharan and Rastislav Bodik, UC Berkeley.
Thin Slicing Manu Sridharan, Stephen J. Fink, Rastislav Bodík.
1 Practical Object-sensitive Points-to Analysis for Java Ana Milanova Atanas Rountev Barbara Ryder Rutgers University.
University of Houston Extending Global Optimizations in the OpenUH Compiler for OpenMP Open64 Workshop, CGO ‘08.
Parameterized Object Sensitivity for Points-to Analysis for Java Presented By: - Anand Bahety Dan Bucatanschi.
The Ant and The Grasshopper Fast and Accurate Pointer Analysis for Millions of Lines of Code Ben Hardekopf and Calvin Lin PLDI 2007 (Best Paper & Best.
Semi-Sparse Flow-Sensitive Pointer Analysis Ben Hardekopf Calvin Lin The University of Texas at Austin POPL ’09 Simplified by Eric Villasenor.
Aliases in a bug finding tool Benjamin Chelf Seth Hallem June 5 th, 2002.
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Memory Systems Performance Workshop 2004© David Ryan Koes MSP 2004 Programmer Specified Pointer Independence David Koes Mihai Budiu Girish Venkataramani.
CS 536 Spring Intermediate Code. Local Optimizations. Lecture 22.
Interprocedural pointer analysis for C We’ll look at Wilson & Lam PLDI 95, and focus on two problems solved by this paper: –how to represent pointer information.
Prof. Bodik CS 164 Lecture 171 Register Allocation Lecture 19.
Previous finals up on the web page use them as practice problems look at them early.
Code Generation for Basic Blocks Introduction Mooly Sagiv html:// Chapter
Scaling CFL-Reachability-Based Points- To Analysis Using Context-Sensitive Must-Not-Alias Analysis Guoqing Xu, Atanas Rountev, Manu Sridharan Ohio State.
1 Refinement-Based Context-Sensitive Points-To Analysis for Java Manu Sridharan, Rastislav Bodík UC Berkeley PLDI 2006.
A Context-Sensitive Pointer Analysis Phase in Open64 Compiler Tianwei Sheng, Wenguang Chen, Weimin Zheng Tsinghua University.
Pointer Analysis for CASH Compiler Framework Deepak Garg Himanshu Jain Spring 2005.
Intraprocedural Points-to Analysis Flow functions:
Java Alias Analysis for Online Environments Manu Sridharan 2004 OSQ Retreat Joint work with Rastislav Bodik, Denis Gopan, Jong-Deok Choi.
Intermediate Code. Local Optimizations
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
Load-Reuse Analysis design and evaluation Rastislav Bodík Rajiv Gupta Mary Lou Soffa.
Reps Horwitz and Sagiv 95 (RHS) Another approach to context-sensitive interprocedural analysis Express the problem as a graph reachability query Works.
An Efficient Inclusion-Based Points-To Analysis for Strictly-Typed Languages John Whaley Monica S. Lam Computer Systems Laboratory Stanford University.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
Symbolic Path Simulation in Path-Sensitive Dataflow Analysis Hari Hampapuram Jason Yue Yang Manuvir Das Center for Software Excellence (CSE) Microsoft.
An Integrated IP Packet Shaper and Scheduler for Edge Routers MSEE Project Presentation Student: Yuqing Deng Advisor: Dr. Belle Wei Spring 2002.
Good Programming Practices for Building Less Memory-Intensive EDA Applications Alan Mishchenko University of California, Berkeley.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Fast Points-to Analysis for Languages with Structured Types Michael Jung and Sorin A. Huss Integrated Circuits and Systems Lab. Department of Computer.
Pointer Analysis Lecture 2 G. Ramalingam Microsoft Research, India.
Dataflow Analysis for Concurrent Programs using Datarace Detection Ravi Chugh, Jan W. Voung, Ranjit Jhala, Sorin Lerner LBA Reading Group Michelle Goodstein.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Using Types to Analyze and Optimize Object-Oriented Programs By: Amer Diwan Presented By: Jess Martin, Noah Wallace, and Will von Rosenberg.
Pointer Analysis Survey. Rupesh Nasre. Aug 24, 2007.
Heap liveness and its usage in automatic memory management Ran Shaham Elliot Kolodner Mooly Sagiv ISMM’02 Unpublished TVLA.
Pointer Analysis – Part I CS Pointer Analysis Answers which pointers can point to which memory locations at run-time Central to many program optimization.
D A C U C P Speculative Alias Analysis for Executable Code Manel Fernández and Roger Espasa Computer Architecture Department Universitat Politècnica de.
1PLDI 2000 Off-line Variable Substitution for Scaling Points-to Analysis Atanas (Nasko) Rountev PROLANGS Group Rutgers University Satish Chandra Bell Labs.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Manuel Fahndrich Jakob Rehof Manuvir Das
Harry Xu University of California, Irvine & Microsoft Research
Pointer Analysis Lecture 2
Points-to Analysis for Java Using Annotated Constraints
Interprocedural Analysis Chapter 19
Topic 17: Memory Analysis
Polynomial Manipulation Language
Demand-Driven Context-Sensitive Alias Analysis for Java
Pointer Analysis Lecture 2
The State-of-the-Art of Alias Analysis
Pointer analysis.
Presentation transcript:

Demand-driven Alias Analysis Implementation Based on Open64 Xiaomi An

Outline Demand-driven alias analysis CFL-Reachability based demand-driven alias analysis (DDA) One-level flow demand-driven alias analysis (Olf DDA)

Why Demand driven? Potential of faster analysis speed Less memory requirement Flexible framework to rebuild the lost info Potentially support more aggressive analysis

Previous work on demand driven alias analysis Heintze and Tardieu, Demand-Driven Pointer Analysis, PLDI 2001 Sridharan and Bodik, Refinement-based context- sensitive points-to analysis for Java, PLDI 2006 Xin Zheng and Radu Rugina, Demand-Driven Alias Analysis for C, POPL 2008  Work for C  Answer alias queries without constructing points-to sets

Graph representation of program (PEG)  Pointer dereference edges ( D )  Assignment edges ( A )  Corresponding edges in the opposite direction ( ) Memory alias and value alias:  two l-value expressions are memory aliases, if they might denote the same memory location.  two expressions are value aliases, if they might evaluate to the same value. Alias analysis via CFL-Reachability (1) —Program Representation

Alias analysis via CFL-Reachability (2) — Hierarchical State Machine: Machine M: Machine V: Correspond to Andersen’s inclusion algorithm.

Alias analysis via CFL-Reachability (3) — Example Program: s = &t; r = &z; y = &r; s = r; x = *y; … = *x; *s = …; Program expression graphAnalysis for query MayAlias(*x, *s)

Precision Evaluation (1) — Features of the demand-driven alias analysis (DDA) Set-inclusion based Field-sensitive Flow-insensitive Separate value flows for globals May-alias

case (1)case (2)case (3) int foo () { int **p, **q; int *s1, *s2, *s3; p = &s1; p = &s2; q = &s3; q = p; *p = (int*) malloc(100); *q = (int*) malloc(100); return *s1 + *s2 + *s3; } int a[100] , b[100]; void foo() { int i; int *p, *q; p = &a[0]; q = &b[10]; for (i=0;i<100;i++) { *p = *q; p++; q++; } typedef struct { unsigned int bits_left; unsigned int buffer_size; } bitfile; typedef struct { char is_leaf; char data[4]; } hcb_bin_quad; hcb_bin_quad hcb[10]; void foo (bitfile *ld, int cb, int n, int b){ for (int i=0; i<n; i++) { ld->bits_left += hcb[i].data[b]; } Precision Evaluation (2) — Typical test cases

Test caseMemory operationDDAACAC + FFA + FSA DDA+ FFA + FSA Case (1)1.s1 2.s2 3.s3 4.*p 5.*q 6.*s3 7.*s1 8.*s2 4~{1,2} 5~{1,2,3,4} 7~{6} 8~{6,7} 4~{1,2,3} 5~{1,2,3,4} 7~{6} 8~{6,7} 4~{2} 5~{2} 7~{6} 8~{6,7} 4~{2} 5~{2} 7~{6} 8~{6,7} Case (2)1.global_obj 2.*p 3.*q 2~{1} 3~{1} 2~{1} 3~{1,2} 2~{1, } 3~{1,2} 2~{1} 3~{1} Case (3)1.global_obj 2.ld->bits_left 3.hcb[i].data[b] 2~{1} 3~{1} 2~{1} 3~{1,2} 2~{1} 3~{1,2} 2~{1} 3~{1} Precision Evaluation (3) — Alias analysis results

Precision Evaluation (4) — Analysis and Conclusions Result Analysis  For case (1) DDA is better than AC due to set-inclusion DDA is worse than FSA due to flow-insensitive and MAY-alias info  For case (2) DDA is better than AC due to separate value flows for globals DDA is better than FSA due to complete value flow tracking  For case (3) DDA is better than AC due to field sensitivity, DDA is better than FFA due to its keeping track of high level type info Conclusions  Proper combination of good features leads to good precision.  DDA can replace AC without loss of precision.

Scalability Evaluation (1) — PEG features and alias queries classification Test case Summary of PEGsQuery count By cache By analysis count node countA-edge countQuick analysis DDA analysis totalMaxtotalmax Swim %18%7% Mgrid %36%3% Equake %52%3% Art %65%8% Open64, as an optimizing compiler, has large number of alias queries. Quick disambiguation and caching are necessary. Good alias analysis precision is necessary.

Scalabitlity Evaluation (2) — Results and Conclusion CFL-Reachability based alias analysis implementation doesn’t have good scalability.

To avoid redundant graph traverse To simplify the program expression graph To get some of the scalability from union-based algorithm while keeping most of the precision from inclusion-based algorithm One-level flow demand driven analysis(1) — Motivation

One-level flow demand-driven analysis (2) — One-level flow hierarchical state machine Machine M: Machine V: Correspond to Das’s algorithm which lie between Andersen and Steengaard.

One-level inclusion-based, upper-level unification-based Value flow factorization Online incremental PEG simplification One-level flow demand-driven analysis (3) — New features

One-level flow demand-driven analysis (4) — Example int foo () { int **p, **q; int *s1, *s2, *s3; p = &s1; p = &s2; q = &s3; q = p; *p = (int*) malloc(100); *q = (int*) malloc(100); return *s1 + *s2 + *s3; }

Scalability Evaluation (1) — Percentage of analysis finished

Scalability Evaluation (2) — Percentage of “ not aliased ” results

Conclusion and Future work Conclusion  Demand driven alias analysis can be used in product compiler and give precise alias results.  One-level flow DDA can improve the scalability and give much more precise results for a reasonable compile time. Future work  To extend demand driven analysis to inter-procedural analysis.  To exploit more methods to further improve scalability.

Thank You!