Introduction to Shape and Pointer Analysis

Size: px
Start display at page:

Download "Introduction to Shape and Pointer Analysis"

Transcription

1 Introduction to Shape and Pointer Analsis CS 502 Lecture 11 10/30/08 Some slides adapted from Nielson, Nielson, Hankin Principles of Program Analsis

2 Analsis of the Heap Thus far, we have focussed on control and dataflow properties of programs: dataflow analsis approimates, constructs, or derives program properties based on a program s control and dataflow. What about the heap? How do we approimate properties of heapallocated data structures? Points-to analsis: Useful for detecting sharing and aliasing 2

3 Shape Analsis Obtain a finite representation of the shape of the program heap at different program points. Consider a language with pointers and references. Utilit: Aliasing and sharing. Can be used for more efficient code generation. Inlining, constant-folding, method dispatch, etc. Identif possible null-pointer dereferences. Program verification: reverse transforms a non-cclic list to a non-cclic list. 3

4 Pointer Analsis Goal: what objects can a pointer point-to? Staticall undecidable in general. What are good approimations? Can be used to infer aliases: if a points to b, and b points to c, then: {<*a,b>, <*b,c>} ==> {<**a,c>} and thus **a and *b are aliases Fundamentall an interprocedural analsis: A pointer variable can be supplied as arguments or returned as a result from a procedure. Flow-insensitive vs. flow-sensitive contet-sensitivit? shape analsis? field sensitivit? 4

5 Strategies Eample: p = malloc(); q = malloc() fp = &p; fp = &q;... = *fp; Flow-insensitive, equalit-based: fp p q heap1 heap2 5

6 Equalit-based Analses Eample: First three statements are eas: = &a; = &a; = &b; p = &; p = &; p = &; = &b; a a add edge p a b p = &; b collapse and p a b p a b Last statement takes more effort to process: collapse a and b p a b 6

7 Tpe-based Formulation Running eample: Assign each variable a tpe (:t1,:t2,a:t3,b:t4,p:t5) Construct initial constraints: = &a; = &b; p = &; p = &; = &a; t1 = ref(t3) = &b; t2 = ref(t4) p = &; t5 = ref(t1) p = &; t5 = ref(t2) 7

8 Tpe-based formulation(cont) Solve and unif the constraints: t4 = ref(t1) = ref(t2) Merge t1 and t2 into t1: : t1, : t1, a: t3, b:t4, p: t5 t1 = ref(t3), t1 = ref(t4), t5 = ref(t1) Repeat the process: t1 = ref(t3) = ref(t4) Merge: t1 = ref(t3), t5 = ref(t1) 8

9 Strategies Eample: p = malloc(); q = malloc(); fp = &p; fp = &q;... = *fp; Flow-insensitive, subset-based: p heap1 fp q heap2 9

10 Subset-based (inclusion) Eample: q = &; q = &; q q 1 q = &; q = &; p = q; q = &; Third statement. See all the things q points to, and m 1 2 p = q; q 1 2 Dotted line indicates that the points-to set for q must be a subset of the points-to set for p. 3 3 p 10

11 Subset-based (inclusion) q = &; p q 4 Subset constraint (dotted line) indicates that an edge must be established between p and as well. q = &; 1 3 What is the running-time compleit of these two analses? q p 11

12 Shape Analsis Snta Eample a ::= p n a 1 op a a 2 nil p ::=.sel b ::= true false not b b 1 op b b 2 a 1 op r a 2 op p p S ::= [p:=a] l [skip] l S 1 ; S 2 if [b] l then S 1 else S 2 while [b] l do S [malloc p] l [:=nil] 1 ; while [not is-nil()] 2 do ([:=] 3 ; [:=] 4 ; [:=.] 5 ; [.:=] 6 ); [:=nil] 7 12

13 Reversal (heap structure at different iterations of the loop) 0: ξ 1 ξ 2 ξ 3 ξ 4 ξ 5 1: ξ 2 ξ 1 ξ 3 ξ 4 ξ 5 2: ξ 3 ξ 2 ξ 4 ξ 1 ξ 5 3: ξ 4 ξ 3 ξ 5 ξ 2 ξ 1 4: ξ 5 ξ 4 ξ 3 ξ 2 ξ 1 5: ξ 5 ξ 4 ξ 3 ξ 2 ξ 1 13

14 Analsis To anale data structures of this form, develop an approimation to the actual runtime structure of the heap. Approach: First, develop a semantics that describes changes to the heap as the program eecutes. Second, develop a conservative approimation to this semantics. The approimate state of the heap at different program points is the result of the analsis. 14

15 Semantics A configurations consists of a state σ State = Var (Z + Loc + { }) mapping variables to values, locations (in the heap) or the nil-value a heap H Heap = (Loc Sel) fin (Z + Loc + { }) mapping pairs of locations and selectors to values, locations in the heap or the nil-value 15

16 Defining Pointers is defined b : PEp (State Heap) fin (Z + { } + Loc) [[]](σ, H) = σ() [[.sel]](σ, H) = H(σ(), sel) if σ() Loc and H is defined on (σ(), sel) undefined otherwise Arithmetic and boolean epressions A : AEp (State Heap) fin (Z + Loc + { }) B : BEp (State Heap) fin T 16

17 Assignment and Selection Clauses for assignments: [:=a] l, σ, H σ[ A[[a]](σ, H)], H if A[[a]](σ, H) is defined [.sel:=a] l, σ, H σ, H[(σ(), sel) A[[a]](σ, H)] if σ() Loc and A[[a]](σ, H) is defined Clauses for malloc: [malloc ] l, σ, H σ[ ξ], H where ξ does not occur in σ or H [malloc (.sel)] l, σ, H σ, H[(σ(), sel) ξ] where ξ does not occur in σ or H and σ() Loc 17

18 Shape Graphs The analsis will operate on shape graphs (S, H, is) consisting of an abstract state, S, an abstract heap, H, and sharing information, is, for the abstract locations. The nodes of the shape graphs are abstract locations: ALoc = {n X X Var } Note: there will onl be finitel man abstract locations 18

19 PPA Section 2.6 c F.Nielson & H.Riis Nielson & C.Hankin (Ma 2005) 117 Eample Eample In the semantics: In the semantics: 3 ξ 4 ξ 2 ξ 3 In the analsis: n {} n {} n {} Eample 2 In the analsis: ξ 1 ξ 4 ξ 1 5 n n {} n n {} n {} 5 Abstract Locations The abstract location n X represents the location σ() if X The abstract location n is called the abstract summar location: n represents all the locations that cannot be reached directl from the state without consulting the heap Invariant 1 If two abstract locations n X and n Y occur in the same shape graph then either X = Y or X Y = 19

20 Abstract States and Heaps S AState = P(Var ALoc) abstract states H AHeap = P(ALoc Sel ALoc) abstract heap n {} n {} n n {} Invariant 2 If is mapped to n X b the abstract state S then X Invariant 3 Whenever (n V, sel, n W ) and (n V, sel, n W ) are in the abstract heap H then either V = or W = W 20

21 List Reversal (after successive iterations) 0: n {} n 1: n {} n {} n 2: n {} n {} n n {} 3: n {} n {} n n {} 4: n {} n {} n n {} 5: n {} n n {} 21

22 Sharing ξ 4 ξ ξ 4 3 ξ 5 Give rise to the same shape graph: n {} n {} n is: the abstract locations that might be shared due to pointers in the heap: n X is included in is if it might represents a location that is the target of more than one pointer in the heap 22

23 Eamples ξ 4 ξ 5 n {} n {} n 1 2 ξ 4 3 ξ 5 n {} n {} n ξ ξ 5 n {} n {} n 23

24 Sharing Invariants The implicit sharing information of the abstract heap must be consistent with the eplicit sharing information: n {} n {} n Invariant 4 If n X is then either (n, sel, n X ) is in the abstract heap for some sel, or there are two distinct triples (n V, sel 1, n X ) and (n W, sel 2, n X ) in the abstract heap Invariant 5 Whenever there are two distinct triples (n V, sel 1, n X ) and (n W, sel 2, n X ) in the abstract heap and X then n X is 24

Simple example. Analysis of programs with pointers. Program model. Points-to relation

Simple example. Analysis of programs with pointers. Program model. Points-to relation Simple eample Analsis of programs with pointers := 5 ptr := & *ptr := 9 := program S1 S2 S3 S4 What are the defs and uses of in this program? Problem: just looking at variable names will not give ou the

More information

Classes. Compiling Methods. Code Generation for Objects. Implementing Objects. Methods. Fields

Classes. Compiling Methods. Code Generation for Objects. Implementing Objects. Methods. Fields Classes Implementing Objects Components fields/instance variables values differ from to usuall mutable methods values shared b all s of a class usuall immutable component visibilit: public/private/protected

More information

Principles of Program Analysis: Data Flow Analysis

Principles of Program Analysis: Data Flow Analysis Principles of Program Analysis: Data Flow Analysis Transparencies based on Chapter 2 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag

More information

Principles of Program Analysis: A Sampler of Approaches

Principles of Program Analysis: A Sampler of Approaches Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag

More information

PROGRAM ANALYSIS & SYNTHESIS

PROGRAM ANALYSIS & SYNTHESIS Lecture 02 Structural Operational Semantics (SOS) PROGRAM ANALYSIS & SYNTHESIS EranYahav 1 Previously static analysis over-approximation of program behavior abstract interpretation abstraction, transformers,

More information

CS 403 Compiler Construction Lecture 8 Syntax Tree and Intermediate Code Generation [Based on Chapter 6 of Aho2] This Lecture

CS 403 Compiler Construction Lecture 8 Syntax Tree and Intermediate Code Generation [Based on Chapter 6 of Aho2] This Lecture CS 403 Compiler Construction Lecture 8 Snta Tree and Intermediate Code Generation [Based on Chapter 6 of Aho2] 1 This Lecture 2 1 Remember: Phases of a Compiler This lecture: Intermediate Code This lecture:

More information

Alias Analysis. Last time Interprocedural analysis. Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1

Alias Analysis. Last time Interprocedural analysis. Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1 Alias Analysis Last time Interprocedural analysis Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1 Aliasing What is aliasing? When two expressions denote the same mutable

More information

Simple example. Analysis of programs with pointers. Points-to relation. Program model. Points-to graph. Ordering on points-to relation

Simple example. Analysis of programs with pointers. Points-to relation. Program model. Points-to graph. Ordering on points-to relation Simle eamle Analsis of rograms with ointers := 5 tr := @ *tr := 9 := rogram S1 S2 S3 S4 deendences What are the deendences in this rogram? Problem: just looking at variable names will not give ou the correct

More information

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Static Program Analysis Part 9 pointer analysis Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Agenda Introduction to points-to analysis Andersen s analysis Steensgaards s

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-18/spa/ Preliminaries Outline of Lecture 1 Preliminaries Introduction

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Lecture 1: Introduction to Program Analysis Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ws-1415/spa/

More information

Lecture 16 Pointer Analysis

Lecture 16 Pointer Analysis Pros and Cons of Pointers Lecture 16 Pointer Analysis Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis Many procedural languages have pointers

More information

Module Mechanisms CS412/413. Modules + abstract types. Abstract types. Multiple Implementations. How to type-check?

Module Mechanisms CS412/413. Modules + abstract types. Abstract types. Multiple Implementations. How to type-check? CS412/413 Introduction to Compilers and Translators Andrew Mers Cornell Universit Lecture 19: ADT mechanisms 10 March 00 Module Mechanisms Last time: modules, was to implement ADTs Module collection of

More information

A Context-Sensitive Memory Model for Verification of C/C++ Programs

A Context-Sensitive Memory Model for Verification of C/C++ Programs A Context-Sensitive Memory Model for Verification of C/C++ Programs Arie Gurfinkel and Jorge A. Navas University of Waterloo and SRI International SAS 17, August 30th, 2017 Gurfinkel and Navas (UWaterloo/SRI)

More information

Hoare Logic and Model Checking

Hoare Logic and Model Checking Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Pointers Pointers and

More information

Lecture 27. Pros and Cons of Pointers. Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis

Lecture 27. Pros and Cons of Pointers. Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis Pros and Cons of Pointers Lecture 27 Pointer Analysis Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis Many procedural languages have pointers

More information

Lecture 20 Pointer Analysis

Lecture 20 Pointer Analysis Lecture 20 Pointer Analysis Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis (Slide content courtesy of Greg Steffan, U. of Toronto) 15-745:

More information

Linear Programming. Revised Simplex Method, Duality of LP problems and Sensitivity analysis

Linear Programming. Revised Simplex Method, Duality of LP problems and Sensitivity analysis Linear Programming Revised Simple Method, Dualit of LP problems and Sensitivit analsis Introduction Revised simple method is an improvement over simple method. It is computationall more efficient and accurate.

More information

Winter Compiler Construction T9 IR part 2 + Runtime organization. Announcements. Today. Know thy group s code

Winter Compiler Construction T9 IR part 2 + Runtime organization. Announcements. Today. Know thy group s code Winter 26-27 Compiler Construction T9 IR part 2 + Runtime organization Mool Sagiv and Roman Manevich School of Computer Science Tel-Aviv Universit Announcements What is epected in PA3 documentation (5

More information

Lecture 14 Pointer Analysis

Lecture 14 Pointer Analysis Lecture 14 Pointer Analysis Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis [ALSU 12.4, 12.6-12.7] Phillip B. Gibbons 15-745: Pointer Analysis

More information

Announcements. CSCI 334: Principles of Programming Languages. Lecture 19: C++

Announcements. CSCI 334: Principles of Programming Languages. Lecture 19: C++ Announcements CSCI 4: Principles of Programming Languages Lecture 19: C++ HW8 pro tip: the HW7 solutions have a complete, correct implementation of the CPS version of bubble sort in SML. All ou need to

More information

Building up a language SICP Variations on a Scheme. Meval. The Core Evaluator. Eval. Apply. 2. syntax procedures. 1.

Building up a language SICP Variations on a Scheme. Meval. The Core Evaluator. Eval. Apply. 2. syntax procedures. 1. 6.001 SICP Variations on a Scheme Scheme Evaluator A Grand Tour Techniques for language design: Interpretation: eval/appl Semantics vs. snta Sntactic transformations Building up a language... 3. 1. eval/appl

More information

Context-Sensitive Pointer Analysis. Recall Context Sensitivity. Partial Transfer Functions [Wilson et. al. 95] Emami 1994

Context-Sensitive Pointer Analysis. Recall Context Sensitivity. Partial Transfer Functions [Wilson et. al. 95] Emami 1994 Context-Sensitive Pointer Analysis Last time Flow-insensitive pointer analysis Today Context-sensitive pointer analysis Emami invocation graphs Partial Transfer Functions The big picture Recall Context

More information

Points-to Analysis. Xiaokang Qiu Purdue University. November 16, ECE 468 Adapted from Kulkarni 2012

Points-to Analysis. Xiaokang Qiu Purdue University. November 16, ECE 468 Adapted from Kulkarni 2012 Points-to Analysis Xiaokang Qiu Purdue University ECE 468 Adapted from Kulkarni 2012 November 16, 2016 Simple example x := 5 ptr := @x *ptr := 9 y := x program S1 S2 S3 S4 dependences What are the dependences

More information

ECE 573 Midterm 1 September 29, 2009

ECE 573 Midterm 1 September 29, 2009 ECE 573 Midterm 1 September 29, 2009 Name: Purdue email: Please sign the following: I affirm that the answers given on this test are mine and mine alone. I did not receive help from an person or material

More information

2.2 Absolute Value Functions

2.2 Absolute Value Functions . Absolute Value Functions 7. Absolute Value Functions There are a few was to describe what is meant b the absolute value of a real number. You ma have been taught that is the distance from the real number

More information

Static Analysis and Dataflow Analysis

Static Analysis and Dataflow Analysis Static Analysis and Dataflow Analysis Static Analysis Static analyses consider all possible behaviors of a program without running it. 2 Static Analysis Static analyses consider all possible behaviors

More information

Compiler construction

Compiler construction This lecture Compiler construction Lecture 5: Project etensions Magnus Mreen Spring 2018 Chalmers Universit o Technolog Gothenburg Universit Some project etensions: Arras Pointers and structures Object-oriented

More information

Object Oriented Languages. Hwansoo Han

Object Oriented Languages. Hwansoo Han Object Oriented Languages Hwansoo Han Object-Oriented Languages An object is an abstract data tpe Encapsulates data, operations and internal state behind a simple, consistent interface. z Data Code Data

More information

Name Class Date. subtract 3 from each side. w 5z z 5 2 w p - 9 = = 15 + k = 10m. 10. n =

Name Class Date. subtract 3 from each side. w 5z z 5 2 w p - 9 = = 15 + k = 10m. 10. n = Reteaching Solving Equations To solve an equation that contains a variable, find all of the values of the variable that make the equation true. Use the equalit properties of real numbers and inverse operations

More information

CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014

CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014 CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014 1 Introduction to Abstract Interpretation At this point in the course, we have looked at several aspects of programming languages: operational

More information

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers

CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers CS 4120 Lecture 31 Interprocedural analysis, fixed-point algorithms 9 November 2011 Lecturer: Andrew Myers These notes are not yet complete. 1 Interprocedural analysis Some analyses are not sufficiently

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 19 Tuesday, April 3, 2018 1 Introduction to axiomatic semantics The idea in axiomatic semantics is to give specifications

More information

ENGIN 112. Intro to Electrical and Computer Engineering

ENGIN 112. Intro to Electrical and Computer Engineering ENIN 2 Intro to Electrical and Computer Engineering Lecture 6 More Boolean Algebra ENIN2 L6: More Boolean Algebra September 5, 23 A B Overview Epressing Boolean functions Relationships between algebraic

More information

Static analysis and all that

Static analysis and all that Static analysis and all that Martin Steffen IfI UiO Spring 2014 uio Static analysis and all that Martin Steffen IfI UiO Spring 2014 uio Plan approx. 15 lectures, details see web-page flexible time-schedule,

More information

CS711 Advanced Programming Languages Pointer Analysis Overview and Flow-Sensitive Analysis

CS711 Advanced Programming Languages Pointer Analysis Overview and Flow-Sensitive Analysis CS711 Advanced Programming Languages Pointer Analysis Overview and Flow-Sensitive Analysis Radu Rugina 8 Sep 2005 Pointer Analysis Informally: determine where pointers (or references) in the program may

More information

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine No model may be available Programmer Software Abstractions Tests Coverage Code Abhik Roychoudhury CS 5219 National University of Singapore Testing Debug Today s lecture Abstract model (Boolean pgm.) Desirable

More information

Alias Analysis & Points-to Analysis. Hwansoo Han

Alias Analysis & Points-to Analysis. Hwansoo Han Alias Analysis & Points-to Analysis Hwansoo Han May vs. Must Information May information The information is true on some path through a CFG Must information The information is true on all paths through

More information

INFORMATION CODING AND NEURAL COMPUTING

INFORMATION CODING AND NEURAL COMPUTING INFORATION CODING AND NEURAL COPUTING J. Pedro Neto 1, Hava T. Siegelmann 2, and J. Féli Costa 1 jpn@di.fc.ul.pt, iehava@ie.technion.ac.il, and fgc@di.fc.ul.pt 1 Faculdade de Ciências da Universidade de

More information

4 Using The Derivative

4 Using The Derivative 4 Using The Derivative 4.1 Local Maima and Minima * Local Maima and Minima Suppose p is a point in the domain of f : f has a local minimum at p if f (p) is less than or equal to the values of f for points

More information

Types and Type Inference

Types and Type Inference Types and Type Inference Mooly Sagiv Slides by Kathleen Fisher and John Mitchell Reading: Concepts in Programming Languages, Revised Chapter 6 - handout on the course homepage Outline General discussion

More information

Building Interpreters

Building Interpreters Building Interpreters Mool Sagiv html://www.cs.tau.ac.il/~msagiv/courses/wcc13.html Chapter 4 1 Structure of a simple compiler/interpreter Leical analsis Snta analsis Runtime Sstem Design Intermediate

More information

More on Operational Semantics

More on Operational Semantics More on Operational Semantics (Slides modified from those created by Xinyu Feng) 1 / 23 Outline Various formulations Extensions Going wrong Local variable declaration Heap Big-step operational semantics

More information

Lectures 5-6: Introduction to C

Lectures 5-6: Introduction to C Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Section 2.2: Absolute Value Functions, from College Algebra: Corrected Edition by Carl Stitz, Ph.D. and Jeff Zeager, Ph.D. is available under a

Section 2.2: Absolute Value Functions, from College Algebra: Corrected Edition by Carl Stitz, Ph.D. and Jeff Zeager, Ph.D. is available under a Section.: Absolute Value Functions, from College Algebra: Corrected Edition b Carl Stitz, Ph.D. and Jeff Zeager, Ph.D. is available under a Creative Commons Attribution-NonCommercial-ShareAlike.0 license.

More information

Static Program Analysis Part 8 control flow analysis

Static Program Analysis Part 8 control flow analysis Static Program Analysis Part 8 control flow analysis http://cs.au.dk/~amoeller/spa/ Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Agenda Control flow analysis for the -calculus

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages Lecture 10 Variables and Assignment 1 Variable Variable (Math) (CS) Math π CS pi symbol 3.1415828 R definite singular description 3.14 referent symbol R indefinite singular

More information

Non-linear models. Basis expansion. Overfitting. Regularization.

Non-linear models. Basis expansion. Overfitting. Regularization. Non-linear models. Basis epansion. Overfitting. Regularization. Petr Pošík Czech Technical Universit in Prague Facult of Electrical Engineering Dept. of Cbernetics Non-linear models Basis epansion.....................................................................................................

More information

Data Flow Analysis. Agenda CS738: Advanced Compiler Optimizations. 3-address Code Format. Assumptions

Data Flow Analysis. Agenda CS738: Advanced Compiler Optimizations. 3-address Code Format. Assumptions Agenda CS738: Advanced Compiler Optimizations Data Flow Analysis Amey Karkare karkare@cse.iitk.ac.in http://www.cse.iitk.ac.in/~karkare/cs738 Department of CSE, IIT Kanpur Static analysis and compile-time

More information

1.5 LIMITS. The Limit of a Function

1.5 LIMITS. The Limit of a Function 60040_005.qd /5/05 :0 PM Page 49 SECTION.5 Limits 49.5 LIMITS Find its of functions graphicall and numericall. Use the properties of its to evaluate its of functions. Use different analtic techniques to

More information

Lambda Calculus. Concepts in Programming Languages Recitation 6:

Lambda Calculus. Concepts in Programming Languages Recitation 6: Concepts in Programming Languages Recitation 6: Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and Programming

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

Unsupervised Learning. Supervised learning vs. unsupervised learning. What is Cluster Analysis? Applications of Cluster Analysis

Unsupervised Learning. Supervised learning vs. unsupervised learning. What is Cluster Analysis? Applications of Cluster Analysis 7 Supervised learning vs unsupervised learning Unsupervised Learning Supervised learning: discover patterns in the data that relate data attributes with a target (class) attribute These patterns are then

More information

Program Analysis And Its Support in Software Development

Program Analysis And Its Support in Software Development Program Analysis And Its Support in Software Development Qing Yi class web site: www.cs.utsa.edu/~qingyi/cs6463 cs6463 1 A little about myself Qing Yi B.S. Shandong University, China. Ph.D. Rice University,

More information

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions.

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions. CS 6110 S18 Lecture 18 Denotational Semantics 1 What is Denotational Semantics? So far we have looked at operational semantics involving rules for state transitions, definitional semantics involving translations

More information

Formal Syntax and Semantics of Programming Languages

Formal Syntax and Semantics of Programming Languages Formal Syntax and Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html The While

More information

Semantics. Names. Binding Time

Semantics. Names. Binding Time /24/ CSE 3302 Programming Languages Semantics Chengkai Li, Weimin He Spring Names Names: identif language entities variables, procedures, functions, constants, data tpes, Attributes: properties of names

More information

COMP 181. Prelude. Intermediate representations. Today. High-level IR. Types of IRs. Intermediate representations and code generation

COMP 181. Prelude. Intermediate representations. Today. High-level IR. Types of IRs. Intermediate representations and code generation Prelude COMP 181 Lecture 14 Intermediate representations and code generation October 19, 2006 Who is Seth Lloyd? Professor of mechanical engineering at MIT, pioneer in quantum computing Article in Nature:

More information

CS 157: Assignment 6

CS 157: Assignment 6 CS 7: Assignment Douglas R. Lanman 8 Ma Problem : Evaluating Conve Polgons This write-up presents several simple algorithms for determining whether a given set of twodimensional points defines a conve

More information

Discussion: Clustering Random Curves Under Spatial Dependence

Discussion: Clustering Random Curves Under Spatial Dependence Discussion: Clustering Random Curves Under Spatial Dependence Gareth M. James, Wenguang Sun and Xinghao Qiao Abstract We discuss the advantages and disadvantages of a functional approach to clustering

More information

Hoare logic. WHILE p, a language with pointers. Introduction. Syntax of WHILE p. Lecture 5: Introduction to separation logic

Hoare logic. WHILE p, a language with pointers. Introduction. Syntax of WHILE p. Lecture 5: Introduction to separation logic Introduction Hoare logic Lecture 5: Introduction to separation logic In the previous lectures, we have considered a language, WHILE, where mutability only concerned program variables. Jean Pichon-Pharabod

More information

Chapter 4 Section 1 Graphing Linear Inequalities in Two Variables

Chapter 4 Section 1 Graphing Linear Inequalities in Two Variables Chapter 4 Section 1 Graphing Linear Inequalities in Two Variables Epressions of the tpe + 2 8 and 3 > 6 are called linear inequalities in two variables. A solution of a linear inequalit in two variables

More information

Hoare logic. Lecture 5: Introduction to separation logic. Jean Pichon-Pharabod University of Cambridge. CST Part II 2017/18

Hoare logic. Lecture 5: Introduction to separation logic. Jean Pichon-Pharabod University of Cambridge. CST Part II 2017/18 Hoare logic Lecture 5: Introduction to separation logic Jean Pichon-Pharabod University of Cambridge CST Part II 2017/18 Introduction In the previous lectures, we have considered a language, WHILE, where

More information

Interprocedural Analysis and Abstract Interpretation. cs6463 1

Interprocedural Analysis and Abstract Interpretation. cs6463 1 Interprocedural Analysis and Abstract Interpretation cs6463 1 Outline Interprocedural analysis control-flow graph MVP: Meet over Valid Paths Making context explicit Context based on call-strings Context

More information

Automatic Software Verification

Automatic Software Verification Automatic Software Verification Instructor: Mooly Sagiv TA: Oded Padon Slides from Eran Yahav and the Noun Project, Wikipedia Course Requirements Summarize one lecture 10% one lecture notes 45% homework

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

More information

Implementing Object-Oriented Languages. Implementing instance variable access. Implementing dynamic dispatching (virtual functions)

Implementing Object-Oriented Languages. Implementing instance variable access. Implementing dynamic dispatching (virtual functions) Implementing Object-Oriented Languages Implementing instance variable access Ke features: inheritance (possibl multiple) subtping & subtpe polmorphism message passing, dnamic binding, run-time tpe testing

More information

Introduction A Tiny Example Language Type Analysis Static Analysis 2009

Introduction A Tiny Example Language Type Analysis Static Analysis 2009 Introduction A Tiny Example Language Type Analysis 2009 Michael I. Schwartzbach Computer Science, University of Aarhus 1 Questions About Programs Does the program terminate? How large can the heap become

More information

Register Allocation. CS 502 Lecture 14 11/25/08

Register Allocation. CS 502 Lecture 14 11/25/08 Register Allocation CS 502 Lecture 14 11/25/08 Where we are... Reasonably low-level intermediate representation: sequence of simple instructions followed by a transfer of control. a representation of static

More information

Types and Type Inference

Types and Type Inference CS 242 2012 Types and Type Inference Notes modified from John Mitchell and Kathleen Fisher Reading: Concepts in Programming Languages, Revised Chapter 6 - handout on Web!! Outline General discussion of

More information

CS2104 Prog. Lang. Concepts

CS2104 Prog. Lang. Concepts CS2104 Prog. Lang. Concepts Operational Semantics Abhik Roychoudhury Department of Computer Science National University of Singapore Organization An imperative language IMP Formalizing the syntax of IMP

More information

Investigation Free Fall

Investigation Free Fall Investigation Free Fall Name Period Date You will need: a motion sensor, a small pillow or other soft object What function models the height of an object falling due to the force of gravit? Use a motion

More information

Test data generation for LRU cache-memory testing

Test data generation for LRU cache-memory testing Test data generation for LRU cache-memor testing Evgeni Kornikhin Moscow State Universit, Russia Email: kornevgen@gmail.com Abstract Sstem functional testing of microprocessors deals with man assembl programs

More information

9/17/2009. Wenyan Li (Emily Li) Sep. 15, Introduction to Clustering Analysis

9/17/2009. Wenyan Li (Emily Li) Sep. 15, Introduction to Clustering Analysis Introduction ti to K-means Algorithm Wenan Li (Emil Li) Sep. 5, 9 Outline Introduction to Clustering Analsis K-means Algorithm Description Eample of K-means Algorithm Other Issues of K-means Algorithm

More information

SPEED: precise and efficient static estimation of program computational complexity

SPEED: precise and efficient static estimation of program computational complexity SPEED: precise and efficient static estimation of program computational complexity Andrey Breslav report on a paper by S. Gulwani, K. Mehra and T. Chilimbi University of Tartu 2010 Outline Linear Invariant

More information

CS 164, Midterm #2, Spring O, M, C - e1 : Bool O, M, C - e2 : t2 O, M, C - e2 : T3 O, M, C - if e1 then e2 else e3 fi : T2 _ T3

CS 164, Midterm #2, Spring O, M, C - e1 : Bool O, M, C - e2 : t2 O, M, C - e2 : T3 O, M, C - if e1 then e2 else e3 fi : T2 _ T3 Midterm II CS164, Spring 2000 April 11, 2000 Problem #1:: Typing and Code Generation (15 points) Assume that we extend the Cool language with a new looping construct "do e1 until e2". The intended execution

More information

Static Program Analysis Part 1 the TIP language

Static Program Analysis Part 1 the TIP language Static Program Analysis Part 1 the TIP language http://cs.au.dk/~amoeller/spa/ Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Questions about programs Does the program terminate

More information

CSE 3302 Programming Languages Lecture 8: Functional Programming

CSE 3302 Programming Languages Lecture 8: Functional Programming CSE 3302 Programming Languages Lecture 8: Functional Programming (based on the slides by Tim Sheard) Leonidas Fegaras University of Texas at Arlington CSE 3302 L8 Spring 2011 1 Functional Programming Languages

More information

3.6 Graphing Piecewise-Defined Functions and Shifting and Reflecting Graphs of Functions

3.6 Graphing Piecewise-Defined Functions and Shifting and Reflecting Graphs of Functions 76 CHAPTER Graphs and Functions Find the equation of each line. Write the equation in the form = a, = b, or = m + b. For Eercises through 7, write the equation in the form f = m + b.. Through (, 6) and

More information

Internet Technology. 08. Routing. Paul Krzyzanowski. Rutgers University. Spring CS Paul Krzyzanowski

Internet Technology. 08. Routing. Paul Krzyzanowski. Rutgers University. Spring CS Paul Krzyzanowski Internet Technolog 08. Routing Paul Kranoski Rutgers Universit Spring 06 March, 06 CS 0-06 Paul Kranoski Routing algorithm goal st hop router = source router last hop router = destination router router

More information

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology Interprocedural Analysis Course so far: Control Flow Representation Dataflow Representation SSA form Classic DefUse and UseDef Chains Optimizations Scheduling Register Allocation Just-In-Time Compilation

More information

Control Structures. Outline. In Text: Chapter 8. Control structures Selection. Iteration. Gotos Guarded statements. One-way Two-way Multi-way

Control Structures. Outline. In Text: Chapter 8. Control structures Selection. Iteration. Gotos Guarded statements. One-way Two-way Multi-way Control Structures In Text: Chapter 8 1 Control structures Selection One-way Two-way Multi-way Iteration Counter-controlled Logically-controlled Gotos Guarded statements Outline Chapter 8: Control Structures

More information

2.2 Differential Forms

2.2 Differential Forms 2.2 Differential Forms With vector analsis, there are some operations such as the curl derivative that are difficult to understand phsicall. We will introduce a notation called the calculus of differential

More information

CS 320: Concepts of Programming Languages

CS 320: Concepts of Programming Languages CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 04: Basic Haskell Continued o Polymorphic Types o Type Inference with Polymorphism o Standard

More information

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6]

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6] 1 Lecture Overview Types 1. Type systems 2. How to think about types 3. The classification of types 4. Type equivalence structural equivalence name equivalence 5. Type compatibility 6. Type inference [Scott,

More information

Language Based isolation of Untrusted JavaScript

Language Based isolation of Untrusted JavaScript Dept. of Computer Science, Stanford University Joint work with Sergio Maffeis (Imperial College London) and John C. Mitchell (Stanford University) Outline 1 Motivation 2 Case Study : FBJS Design Attacks

More information

Lecture 5: Declarative Programming. The Declarative Kernel Language Machine. September 12th, 2011

Lecture 5: Declarative Programming. The Declarative Kernel Language Machine. September 12th, 2011 Lecture 5: Declarative Programming. The Declarative Kernel Language Machine September 12th, 2011 1 Lecture Outline Declarative Programming contd Dataflow Variables contd Expressions and Statements Functions

More information

CCured. One-Slide Summary. Lecture Outline. Type-Safe Retrofitting of C Programs

CCured. One-Slide Summary. Lecture Outline. Type-Safe Retrofitting of C Programs CCured Type-Safe Retrofitting of C Programs [Necula, McPeak,, Weimer, Condit, Harren] #1 One-Slide Summary CCured enforces memory safety and type safety in legacy C programs. CCured analyzes how you use

More information

EECS1022 Winter 2018 Additional Notes Tracing Point, PointCollector, and PointCollectorTester

EECS1022 Winter 2018 Additional Notes Tracing Point, PointCollector, and PointCollectorTester EECS1022 Winter 2018 Additional Notes Tracing, Collector, and CollectorTester Chen-Wei Wang Contents 1 Class 1 2 Class Collector 2 Class CollectorTester 7 1 Class 1 class { 2 double ; double ; 4 (double

More information

Using a Table of Values to Sketch the Graph of a Polynomial Function

Using a Table of Values to Sketch the Graph of a Polynomial Function A point where the graph changes from decreasing to increasing is called a local minimum point. The -value of this point is less than those of neighbouring points. An inspection of the graphs of polnomial

More information

Unit I - Chapter 3 Polynomial Functions 3.1 Characteristics of Polynomial Functions

Unit I - Chapter 3 Polynomial Functions 3.1 Characteristics of Polynomial Functions Math 3200 Unit I Ch 3 - Polnomial Functions 1 Unit I - Chapter 3 Polnomial Functions 3.1 Characteristics of Polnomial Functions Goal: To Understand some Basic Features of Polnomial functions: Continuous

More information

The Pointer Assertion Logic Engine

The Pointer Assertion Logic Engine The Pointer Assertion Logic Engine [PLDI 01] Anders Mφller Michael I. Schwartzbach Presented by K. Vikram Cornell University Introduction Pointer manipulation is hard Find bugs, optimize code General Approach

More information

Chapter 1 Introduction

Chapter 1 Introduction Chapter 1 Course INF5906 / autum 2017 Chapter 1 Learning Targets of Chapter. Apart from a motivational introduction, the chapter gives a high-level overview over larger topics covered in the lecture. They

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

More information

Lecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions?

Lecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions? Lecture 14 No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions? Friday, February 11 CS 215 Fundamentals of Programming II - Lecture 14 1 Outline Static

More information

The Graph of an Equation

The Graph of an Equation 60_0P0.qd //0 :6 PM Page CHAPTER P Preparation for Calculus Archive Photos Section P. RENÉ DESCARTES (96 60) Descartes made man contributions to philosoph, science, and mathematics. The idea of representing

More information

Classes. Code Generation for Objects. Compiling Methods. Dynamic Dispatch. The Need for Dispatching CS412/CS413

Classes. Code Generation for Objects. Compiling Methods. Dynamic Dispatch. The Need for Dispatching CS412/CS413 Classes CS4/CS43 Introduction to Comilers Tim Teitelbaum Lecture : Imlementing Objects 8 March 5 Comonents ields/instance variables values ma dier rom object to object usuall mutable methods values shared

More information