Modular Heap Analysis Of Higher Order Programs Ravichandhran Madhavan + * Ganesan Ramalingam * Kapil Vaswani * * Microsoft Research India + EPFL, Switzerland.

Slides:



Advertisements
Similar presentations
Study on Ensemble Learning By Feng Zhou. Content Introduction A Statistical View of M3 Network Future Works.
Advertisements

Dataflow Analysis for Datarace-Free Programs (ESOP 11) Arnab De Joint work with Deepak DSouza and Rupesh Nasre Indian Institute of Science, Bangalore.
Simplifications of Context-Free Grammars
Precise Interprocedural Analysis using Random Interpretation Sumit Gulwani George Necula UC-Berkeley.
Program Analysis using Random Interpretation Sumit Gulwani UC-Berkeley March 2005.
Analysis of Computer Algorithms
Table de multiplication, division, addition et soustraction.
February 21, 2002 Simplex Method Continued
Maximal Independent Subsets of Linear Spaces. Whats a linear space? Given a set of points V a set of lines where a line is a k-set of points each pair.
Pseudorandom Generators for Polynomial Threshold Functions 1 Raghu Meka UT Austin (joint work with David Zuckerman)
R O O T S Field-Sensitive Points-to-Analysis Eda GÜNGÖR
1 Machine Learning: Lecture 1 Overview of Machine Learning (Based on Chapter 1 of Mitchell T.., Machine Learning, 1997)
1 Parallel Algorithms (chap. 30, 1 st edition) Parallel: perform more than one operation at a time. PRAM model: Parallel Random Access Model. p0p0 p1p1.
DIVISIBILITY, FACTORS & MULTIPLES
Chapter 13 (Ch. 11 in 2nd Can. Ed.)
© 2009 IBM Corporation IBM Research Xianglong Liu 1, Junfeng He 2,3, and Bo Lang 1 1 Beihang University, Beijing, China 2 Columbia University, New York,
Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
ASSUMPTION HIERARCHY FOR A CHA CALL GRAPH CONSTRUCTION ALGORITHM JASON SAWIN & ATANAS ROUNTEV.
Equations of Lines Equations of Lines
1 Termination and shape-shifting heaps Byron Cook Microsoft Research, Cambridge Joint work with Josh Berdine, Dino Distefano, and.
Functional Image Synthesis. Pan An image synthesis “language” Images are functions Continuous and infinite Embedded in a functional host language Reusable.
Sep 15, 2014 Lirong Xia Computational social choice The easy-to-compute axiom.
2 x0 0 12/13/2014 Know Your Facts!. 2 x1 2 12/13/2014 Know Your Facts!
Symbolic Analysis. Symbolic analysis tracks the values of variables in programs symbolically as expressions of input variables and other variables, which.
2 x /18/2014 Know Your Facts!. 11 x /18/2014 Know Your Facts!
2 x /10/2015 Know Your Facts!. 8 x /10/2015 Know Your Facts!
Mani Srivastava UCLA - EE Department Room: 6731-H Boelter Hall Tel: WWW: Copyright 2003.
R O O T S Interprocedural Analysis Aleksandra Biresev
Ken McMillan Microsoft Research
5 x4. 10 x2 9 x3 10 x9 10 x4 10 x8 9 x2 9 x4.
Linear Programming – Simplex Method: Computational Problems Breaking Ties in Selection of Non-Basic Variable – if tie for non-basic variable with largest.
Production Mix Problem Graphical Solution med lrg Electronics Cabinetry Profit (10,20) (Optimal Product Mix!) Profit.
Multiplication Facts Practice
Constraint Optimization We are interested in the general non-linear programming problem like the following Find x which optimizes f(x) subject to gi(x)
Variational Inference Amr Ahmed Nov. 6 th Outline Approximate Inference Variational inference formulation – Mean Field Examples – Structured VI.
Shannon Expansion Given Boolean expression F = w 2 ’ + w 1 ’w 3 ’ + w 1 w 3 Shannon Expansion of F on a variable, say w 2, is to write F as two parts:
Graeme Henchel Multiples Graeme Henchel
0 x x2 0 0 x1 0 0 x3 0 1 x7 7 2 x0 0 9 x0 0.
Scalable Points-to Analysis. Rupesh Nasre. Advisor: Prof. R. Govindarajan. Comprehensive Examination. Jun 22, 2009.
The Mechanical Cryptographer (Tolerant Algebraic Side-Channel Attacks using pseudo-Boolean Solvers) 1.
Data-Flow Analysis II CS 671 March 13, CS 671 – Spring Data-Flow Analysis Gather conservative, approximate information about what a program.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
7x7=.
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
Purity Analysis : Abstract Interpretation Formulation Ravichandhran Madhavan, G. Ramalingam, Kapil Vaswani Microsoft Research, India.
Interprocedural analyses and optimizations. Costs of procedure calls Up until now, we treated calls conservatively: –make the flow function for call nodes.
Recap Mooly Sagiv. Outline Subjects Studied Questions & Answers.
Control Flow Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
1 Control Flow Analysis Mooly Sagiv Tel Aviv University Textbook Chapter 3
Previous finals up on the web page use them as practice problems look at them early.
X := 11; if (x == 11) { DoSomething(); } else { DoSomethingElse(); x := x + 1; } y := x; // value of y? Phase ordering problem Optimizations can interact.
1 Refinement-Based Context-Sensitive Points-To Analysis for Java Manu Sridharan, Rastislav Bodík UC Berkeley PLDI 2006.
Compile-Time Deallocation of Individual Objects Sigmund Cherem and Radu Rugina International Symposium on Memory Management June, 2006.
1 Program Analysis Systematic Domain Design Mooly Sagiv Tel Aviv University Textbook: Principles.
Composing Dataflow Analyses and Transformations Sorin Lerner (University of Washington) David Grove (IBM T.J. Watson) Craig Chambers (University of Washington)
Rethinking Soot for Summary-Based Whole- Program Analysis PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Dacong Yan.
CS 343 presentation Concrete Type Inference Department of Computer Science Stanford University.
Generating Precise and Concise Procedure Summaries Greta Yorsh Eran Yahav Satish Chandra.
(1) ICS 313: Programming Language Theory Chapter 11: Abstract Data Types (Data Abstraction)
Design-Directed Programming Martin Rinard Daniel Jackson MIT Laboratory for Computer Science.
Pointer Analysis – Part I CS Pointer Analysis Answers which pointers can point to which memory locations at run-time Central to many program optimization.
ReIm & ReImInfer: Checking and Inference of Reference Immutability and Method Purity Wei Huang 1, Ana Milanova 1, Werner Dietl 2, Michael D. Ernst 2 1.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Inter-procedural analysis
Assemblers, linkers, loaders
Pointer Analysis Lecture 2
Graph-Based Operational Semantics
자바 언어를 위한 정적 분석 (Static Analyses for Java) ‘99 한국정보과학회 가을학술발표회 튜토리얼
Languages and Compilers (SProg og Oversættere)
Presentation transcript:

Modular Heap Analysis Of Higher Order Programs Ravichandhran Madhavan + * Ganesan Ramalingam * Kapil Vaswani * * Microsoft Research India + EPFL, Switzerland

Goal 1: Analyze Modularly Compute succinct summaries for procedures Summaries: total functions approximating the relational semantics Input State Output States

Goal 2: Track Heap Information The summary of a procedure should capture the transformation of the input mutable heap Goal 3: Analyze HO programs Should be able to summarize higher order procedures Input state includes data as well as code

Challenge Indirect procedure calls esp. Call backs Virtual method calls, function pointer calls, lambda expressions Foo(PTR* p, FP* fp) { *p = (**fp)(0); } Count() { iter = this.iterator(); i = 0; while(iter.HasNext()) { iter.next(); i++; }

Challenge All widely used languages support Higher Order constructs But how do existing modular analyses handle them ?

A Common Hack Estimate the targets of the indirect calls through an inexpensive analysis E.g. CHA, RTI analysis for OO programs Light weight pointer analysis … Construct a conservative call graph Analyze bottom up

Limitations of the Hack Over-approximated targets A call-graph is necessarily context insensitive for HO programs A C B D E Bs context As context

Limitations of the Hack Inability to construct client independent summaries Foo(FP* fp) { (*fp)(…); } m1() { … } C1() { Foo(m1); } m2() { … } C2() { Foo(m2) } Resolved to m1

Limitations of the Hack Reuse of summaries possible only within an analysis Need to analyze libraries together with clients Need to reanalyze libraries for each new client Doesnt allow library compositional analysis

Our approach Use existing techniques for summarizing first-order code segments: [Whaley, Salcianu, Rinard, OOPSLA 99, VMCAI 04] [Madhavan et al., SAS 11] Retain the call backs in the summaries

Our approach Perform as much simplification as possible without the knowledge of the calling context Eliminate fully resolved calls from the summaries Enables efficient library compositional analysis

Illustration *fp(a,b)

Illustration *fp(a,b)

Illustration *fp(a,b) 7 1

Illustration 3 5 *fp(a,b) 7 1

Exploiting Local Context 3 5 *fp(a,b) Frame Rule

Exploiting Local Context 3 5 *fp(a,b) Frame Rule

Flow Insensitive Abstraction 3 5 *fp(a,b)

Flow Insensitive Abstraction

Composition Operation ID

Composition Operation ID

Composition Operation

Handling Direct Calls Handle direct calls via summary composition Call backs in the callee are inlined in the caller

Indirect call Resolution B A

Indirect Call Resolution A B C

A B C ….. Fixed point

Eliminating resolved calls *fp1 … Resolved calls Foo *fp2 … Bar

Experimental Evaluation Applied to Purity/Side-effects Analysis for C# libraries Every method is classified as: Pure – No side-effects Conditionally Pure – Purity depends on the calling context Impure – Has side-effects Impure and Incomplete – Has side-effects and can have more depending on the calling context

Experimental Results BenchmarkLOCPureC-PureImpureI-ImpureTime DocX 10K~ 1 min FB APIs2.2%32% Data Disp.57% Test APIs Json Libs Quickgraph Refactory libs30%8% Utility Libs32%8% PDF libs28.4% GPS libs 250K~ 2 hrs 10 – 20% 15 – 30% 20 – 30% 2 – 27 min

Analysis Statistics BenchmarkUnresolved Calls Non Escaping Abs. Objects DocX FB APIs9% Data Disp. Test APIs Json Libs7.3 Quickgraph Refactory libs Utility Libs PDF libs37% GPS libs5.9 2 – 4 10 – 33 %

Comparison with CHA CG based Bottom up Analysis BenchmarkTime# of SCCsAvg. Scc size DocX12x0NA FB APIs11x3x1.5x Data Disp.6x Test APIs6x2x1.25x Json Libs2x6x Quickgraph11x33x Refactory libs1.4x5.6x Utility Libs30x4x12x PDF libs2x3.5x1.5x

Conclusion A principled approach Formalized as an Abstract Interpretation A generic theory agnostic to the underlying compositional heap analysis Goto for a hands-on experiencewww.rise4fun.com/seal