A Semantics for Procedure Local Heaps and its Abstractions Noam Rinetzky Tel Aviv University Jörg Bauer Universität des Saarlandes Thomas Reps University.

Slides:



Advertisements
Similar presentations
Guy Golan-GuetaTel-Aviv University Nathan Bronson Stanford University Alex Aiken Stanford University G. Ramalingam Microsoft Research Mooly Sagiv Tel-Aviv.
Advertisements

Abstract Interpretation Part II
Techniques for proving programs with pointers A. Tikhomirov.
Predicate Abstraction and Canonical Abstraction for Singly - linked Lists Roman Manevich Mooly Sagiv Tel Aviv University Eran Yahav G. Ramalingam IBM T.J.
Shape Analysis by Graph Decomposition R. Manevich M. Sagiv Tel Aviv University G. Ramalingam MSR India J. Berdine B. Cook MSR Cambridge.
Interprocedural Shape Analysis for Recursive Programs Noam Rinetzky Mooly Sagiv.
Heap Decomposition for Concurrent Shape Analysis R. Manevich T. Lev-Ami M. Sagiv Tel Aviv University G. Ramalingam MSR India J. Berdine MSR Cambridge Dagstuhl.
1 A Logic of Reachable Patterns in Linked Data-Structures Greta Yorsh joint work with Alexander Rabinovich, Mooly Sagiv Tel Aviv University Antoine Meyer,
Automated Soundness Proofs for Dataflow Analyses and Transformations via Local Rules Sorin Lerner* Todd Millstein** Erika Rice* Craig Chambers* * University.
1 Lecture 07 – Shape Analysis Eran Yahav. Previously  LFP computation and join-over-all-paths  Inter-procedural analysis  call-string approach  functional.
1 Lecture 08(a) – Shape Analysis – continued Lecture 08(b) – Typestate Verification Lecture 08(c) – Predicate Abstraction Eran Yahav.
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
Local Heap Shape Analysis Noam Rinetzky Tel Aviv University Joint work with Jörg Bauer Universität des Saarlandes Thomas Reps University of Wisconsin Mooly.
Establishing Local Temporal Heap Safety Properties with Applications to Compile-Time Memory Management Ran Shaham Eran Yahav Elliot Kolodner Mooly Sagiv.
Program analysis Mooly Sagiv html://
1 Motivation Dynamically allocated storage and pointers are an essential programming tools –Object oriented –Modularity –Data structure But –Error prone.
An Overview on Static Program Analysis Mooly Sagiv Tel Aviv University Textbook: Principles of.
Program analysis Mooly Sagiv html://
Model Checking of Concurrent Software: Current Projects Thomas Reps University of Wisconsin.
Modular Shape Analysis for Dynamically Encapsulated Programs Noam Rinetzky Tel Aviv University Arnd Poetzsch-HeffterUniversität Kaiserlauten Ganesan RamalingamMicrosoft.
Compile-Time Deallocation of Individual Objects Sigmund Cherem and Radu Rugina International Symposium on Memory Management June, 2006.
Overview of program analysis Mooly Sagiv html://
Detecting Memory Errors using Compile Time Techniques Nurit Dor Mooly Sagiv Tel-Aviv University.
Modular Shape Analysis for Dynamically Encapsulated Programs Noam Rinetzky Tel Aviv University Arnd Poetzsch-HeffterUniversität Kaiserlauten Ganesan RamalingamMicrosoft.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
Program Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Overview of program analysis Mooly Sagiv html://
Static Program Analysis via Three-Valued Logic Thomas Reps University of Wisconsin Joint work with M. Sagiv (Tel Aviv) and R. Wilhelm (U. Saarlandes)
An Overview on Static Program Analysis Mooly Sagiv.
Dagstuhl Seminar "Applied Deductive Verification" November Symbolically Computing Most-Precise Abstract Operations for Shape.
Program Analysis and Verification Noam Rinetzky Lecture 10: Shape Analysis 1 Slides credit: Roman Manevich, Mooly Sagiv, Eran Yahav.
Thread Quantification for Concurrent Shape Analysis Josh BerdineMSR Cambridge Tal Lev-AmiTel Aviv University Roman ManevichTel Aviv University Mooly Sagiv.
June 27, 2002 HornstrupCentret1 Using Compile-time Techniques to Generate and Visualize Invariants for Algorithm Explanation Thursday, 27 June :00-13:30.
1 Iterative Program Analysis Abstract Interpretation Mooly Sagiv Tel Aviv University Textbook:
TVLA: A system for inferring Quantified Invariants Tal Lev-Ami Tom Reps Mooly Sagiv Reinhard Wilhelm Greta Yorsh.
1 Employing decision procedures for automatic analysis and verification of heap-manipulating programs Greta Yorsh under the supervision of Mooly Sagiv.
Shape Analysis Overview presented by Greta Yorsh.
Program Analysis and Verification
Symbolically Computing Most-Precise Abstract Operations for Shape Analysis Greta Yorsh Thomas Reps Mooly Sagiv Tel Aviv University University of Wisconsin.
1 Shape Analysis via 3-Valued Logic Mooly Sagiv Tel Aviv University Shape analysis with applications Chapter 4.6
1 Combining Abstract Interpreters Mooly Sagiv Tel Aviv University
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
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.
Program Analysis via 3-Valued Logic Thomas Reps University of Wisconsin Joint work with Mooly Sagiv and Reinhard Wilhelm.
Roman Manevich Ben-Gurion University Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 16: Shape Analysis.
1 Numeric Abstract Domains Mooly Sagiv Tel Aviv University Adapted from Antoine Mine.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Shape & Alias Analyses Jaehwang Kim and Jaeho Shin Programming Research Laboratory Seoul National University
Interprocedural shape analysis for cutpoint-free programs Noam Rinetzky Tel Aviv University Joint work with Mooly Sagiv Tel Aviv University Eran Yahav.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Putting Static Analysis to Work for Verification A Case Study Tal Lev-Ami Thomas Reps Mooly Sagiv Reinhard Wilhelm.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Partially Disjunctive Shape Analysis Roman Manevich Mooly Sagiv Ganesan Ramalingam advisor: consultant:
Interprocedural shape analysis for cutpoint-free programs
Shape Analysis Termination Analysis Linear Time
Partially Disjunctive Heap Abstraction
Beyond Strong vs. Weak Updates Isil Dillig, Thomas Dillig, Alex Aiken
Spring 2016 Program Analysis and Verification
Program Analysis and Verification
Seminar in automatic tools for analyzing programs with dynamic memory
Spring 2016 Program Analysis and Verification
Symbolic Implementation of the Best Transformer
Parametric Shape Analysis via 3-Valued Logic
Program Analysis and Verification
Parametric Shape Analysis via 3-Valued Logic
Program Analysis and Verification
Program Analysis and Verification
Symbolic Characterization of Heap Abstractions
A Semantics for Procedure Local Heaps and its Abstractions
Program Analysis and Verification
Presentation transcript:

A Semantics for Procedure Local Heaps and its Abstractions Noam Rinetzky Tel Aviv University Jörg Bauer Universität des Saarlandes Thomas Reps University of Wisconsin Mooly Sagiv Tel Aviv University Reinhard Wilhelm Universität des Saarlandes

Motivation Interprocedural shape analysis Conservative static pointer analysis Heap intensive programs Imperative programs with procedures Recursive data structures Challenge Destructive update Localized effect of procedures

Main idea Local heaps y t g x y t g call p(x); x x x

Main idea Local heaps Cutpoints y t g x y t g call p(x); x x x

Main Results Concrete operational semantics Large step Functional analysis Storeless Shape abstractions Local heap Observationally equivalent to “standard” semantics Java and “clean” C Abstractions Shape analysis [Sagiv, Reps, Wilhelm, TOPLAS ‘02] May-alias [Deutsch, PLDI ‘94] …

Outline Motivating example Local heaps Cutpoints Why semantics Local heap storeless semantics Shape abstraction

static List reverse(List t) { } static void main() { } Example p n n t r n n n List x = reverse(p); return r; n n t List y = reverse(q); List z = reverse(x); … n n n t r n n n p x n n q n n q

static List reverse(List t) { } static void main() { } Example List y = reverse(q); return r;List z = reverse(x); List x = reverse(p); n n t t r n n n t r n n n n n n p x q y n n n n t q n n n n n p x n n n

static List reverse(List t) { } static void main() { } Example return r; n n t t r n n n t r n n n n n n p x x z n n n p x List z = reverse(x); List x = reverse(p); List y = reverse(q); q y n n n n n n t n n n t q y n n n p n n n

Separating objects Not pointed-to by a parameter Cutpoints

Separating objects Not pointed-to by a parameter Cutpoints p x n n n n n n proc(x) Stack sharing

Separating objects Not pointed-to by a parameter x n n n n n n n y Cutpoints p x n n n n n n n proc(x) Stack sharing Heap sharing proc(x)

Separating objects Not pointed-to by a parameter Capture external sharing patterns x n n n n n n n y Cutpoints p x n n n n n n n proc(x) Stack sharing Heap sharing proc(x)

static List reverse(List t) { } static void main() { } Example return r; r t n n n r t n n n n n n p x z x n n n p x List z = reverse(x); List x = reverse(p); List y = reverse(q); q y n n n n n n t q y n n n p n n n

Outline Motivating example Why semantics Local heap storeless semantics Shape abstraction

Abstract Interpretation [Cousot and Cousot, POPL ’77] Operational semantics Abstract transformer  

Introducing local heap semantics Operational semantics Abstract transformer Local heap Operational semantics ~ ’’ ’’

Outline Motivating example Why semantics Local heap storeless semantics Shape abstraction

Programming model Single threaded Procedures Value parameters Recursion Heap Recursive data structures Destructive update  No explicit addressing (&)  No pointer arithmetic

Simplifying assumptions No primitive values (only references) No globals Formals not modified

Storeless semantics No addresses Memory state: Object: 2 Access paths Heap: 2 Object Alias analysis y=x x nn x x.n x.n.n x=null x nn xyxy x.n y.n x.n.n y.n.n y y nn y y.n y.n.n

static void main() { } static List reverse(List t) { return r; } Example x List z = reverse(x); p x.n.n n n x.n.n.n p x x.n n y.n.n q n y y.n n y q y.n.n q n y y.n n y q t.n.n t.n.n.n t t.n t.n.n n n t.n.n.n t t.n n t t n n n List x = reverse(p); List y = reverse(q); r.n n n r t r.n.n.n r.n.n n t r r.n n n r t r.n.n.n r.n.n n t r z.n n n z x z.n.n.n z.n.n n z x p?

static void main() { } static List reverse(List t) { return r; } Example x List z = reverse(x); p x.n.n n n x.n.n.n p x x.n n y.n.n q n y y.n n y q y.n.n q n y y.n n y q t.n.n t.n.n.n L t t.n t.n.n n n t.n.n.n L t t.n n L t L t n n n List x = reverse(p); List y = reverse(q); L.n r.n n n LrLr t L.n.n.n r.n.n.n L.n.n r.n.n n L t r L.n r.n n n LrLr t L.n.n.n r.n.n.n L.n.n r.n.n n t L r p.n z.n n n pzpz x p.n.n.n z.n.n.n p.n.n z.n.n n z x p p.n pp.n.n p.n.n.n

Cutpoint labels Relate pre-state with post-state Additional roots Mark cutpoints at and throughout an invocation

Cutpoint labels Cutpoint label : the set of access paths that point to a cutpoint when the invoked procedure starts L t.n.n t.n.n.n L t t.n t L  {t.n.n.n}

Sharing patterns Cutpoint labels encode sharing patterns L t t.n.n n n t.n.n.n L t t.n n L t t.n.n n n t.n.n.n L t t.n n p w n w w.n n L  {t.n.n.n} Stack sharing Heap sharing

Observational equivalence  L   L (Local-heap Storeless Semantics)  G   G (Global-heap Store-based Semantics)  L and  G observationally equivalent when for every access paths AP 1, AP 2  AP 1 = AP 2  (  L )   AP 1 = AP 2  (  G )

Main theorem: semantic equivalence  L   L (Local-heap Storeless Semantics)  G   G (Global-heap Store-based Semantics)  L and  G observationally equivalent  st,  L    ’ L   st,  G    ’ G  ’ L and  ’ G are observationally equivalent LSL GSB

Corollaries Preservation of invariants Assertions: AP 1 = AP 2 Detection of memory leaks

Applications Develop new static analyses Shape analysis Justify soundness of existing analyses May-alias analysis [TAU-TR-26/04]

Outline Motivating example Why semantics Local heap storeless Shape abstraction

Shape descriptors represent unbounded memory states Conservatively In a bounded way Two dimensions Local heap (objects) Sharing pattern (cutpoint labels)

A Shape abstraction L r.n L.n rLrL t, r.n.n.n L.n.n.n r.n.n L.n.n t L={t.n.n.n} r n n n

A Shape abstraction L r.n L.n rLrL t, r.n.n.n L.n.n.n r.n.n L.n.n t L=* r n n n

L rLrL t, r.n L.n r.n L.n t L=* r n n n A Shape abstraction L r.n L.n rLrL t, r.n L.n r.n L.n t L=* r n n n

A Shape abstraction L rLrL t, r.n L.n r.n L.n t L=* r n n n

A Shape abstraction L rLrL t, r.n L.n r.n L.n t L=* r n n n L r.n L.n rLrL t, r.n.n.n L.n.n.n r.n.n L.n.n t L={t.n.n.n} r n n n

A Shape abstraction rLrL t, r.n L.n r.n L.n t L=* r n n n L1 r.n L1.n r L1 t, r.n.n.n L1.n.n.n r.n.n L1.n.n t L1={t.n.n.n} r n n n L2={g.n.n.n} L2 d.n L2.n d L2 g, d.n.n.n L2.n.n.n d.n.n L2.n.n g d n n n L dLdL t, d.n L.n d.n L.n t d n n n

Application (joint work with Eran Yahav) A framework for shape analysis using local heaps Parametric abstraction Local heap (lists, trees, …) Sharing patterns

Application Properties proved Absence of null dereferences Listness preservation API conformance Recursive  Iterative Procedural abstraction

Outline Motivating example Why semantics Local heap storeless Shape abstraction

Related work Storeless semantics Jonkers, Algorithmic Languages ‘81 Deutsch, ICCL ‘92

Related work Interprocedural shape analysis Rinetzky and Sagiv, CC ’01 Global heap Jeannet et al., SAS ’04 Local heap, relational Chong and Rugina, SAS ’03 Local heap Hackett and Rugina, POPL ’05 Next talk …

Related work Local reasoning Ishtiaq and O’Hearn, POPL ‘01 Reynolds, LICS ’02

Summary Operational semantics Storeless Local heap Cutpoints Equivalence theorem Applications Shape analysis May-alias analysis

End A Semantics for procedure local heaps and its abstraction Noam Rinetzky, Jörg Bauer, Thomas Reps, Mooly Sagiv, and Reinhard Wilhelm AVACS Technical Report 1 Interprocedural functional shape analysis using local heaps Noam Rinetzky, Mooly Sagiv, and Eran Yahav School of Computer Science, Tel Aviv University, Technical Report 26/04