Points-to Analysis using Types

Similar documents
Liveness based Garbage Collection

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

Liveness based Garbage Collection

COURSE CONTENT for Computer Science & Engineering [CSE]

FOUNDATION COURSES REQUIRED OF ALL MAJORS:

1) Electronic Circuits & Laboratory

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

07 Equational Logic and Algebraic Reasoning

MSR by Examples. Iliano Cervesato. ITT Industries, NRL Washington DC.

Inverse Functions. One-to-one. Horizontal line test. Onto

Prolog and Logic Programming. CS152 Chris Pollett Dec. 3, 2008.

CS 154 Formal Languages and Computability Assignment #2 Solutions

Lecture Notes on A Concurrent Logical Framework

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

Some Mathematical Aspects of Physics Students Problem-Solving Difficulties

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Information Required for Memorization

Type inference in context

CS626: NLP, Speech and the Web. Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 14: Parsing Algorithms 30 th August, 2012

In Class Problem Set #15

Artificial Intelligence

CSE 20. Final Review. CSE 20: Final Review

CSE 105 THEORY OF COMPUTATION

From Fundamentele Informatica 1: inleverdatum 1 april 2014, 13:45 uur. A Set A of the Same Size as B or Larger Than B. A itself is not.

Simons Symposium on Approximation Algorithms, February 26, 2014

Conflict Removal. Less Than, Equals ( <= ) Conflict

Degree Spectra J.Kepler Universitaet Linz NOCAS - RISC. Faculty of Mathematics and Computer Science Sofia University

Electric currents (primarily, in metals)

Pushdown Automata (PDA) The structure and the content of the lecture is based on

Act, 1956) Thursday ME1008. Thermo- Technology. CS1007 Microprocessor and Interfacing. Digital EE1053 SE1005. Computer.

Stability. X(s) Y(s) = (s + 2) 2 (s 2) System has 2 poles: points where Y(s) -> at s = +2 and s = -2. Y(s) 8X(s) G 1 G 2

DEPARTMENT OF AEROSPACE ENGINEERING, IIT MADRAS

CSE 311 Lecture 25: Relating NFAs, DFAs, and Regular Expressions. Emina Torlak and Kevin Zatloukal

On Black-Box Reductions between Predicate Encryption Schemes

Computability Theory

Domain Specific Languages of Mathematics

NPTEL web course on Complex Analysis. A. Swaminathan I.I.T. Roorkee, India. and. V.K. Katiyar I.I.T. Roorkee, India

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Scripture quotations marked cev are from the Contemporary English Version, Copyright 1991, 1992, 1995 by American Bible Society. Used by permission.

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

Context-Free Languages

Supplemental Information. C. elegans AWA Olfactory Neurons Fire. Calcium-Mediated All-or-None Action Potentials

BABEȘ-BOLYAI UNIVERSITY Semester I Semester II. 19 Field of study: PHYSICS Programme of study: COMPUTATIONAL PHYSICS

Turing Machines Part II

Electric Circuits I. Midterm #1

correlated to the Idaho Content Standards Algebra II

Inference in first-order logic. Production systems.

Binary Decision Diagrams

Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y.

Fun and Fascinating Bible Reference for Kids Ages 8 to 12. starts on page 3! starts on page 163!

Computability Theory

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

ECEN 326 Electronic Circuits

3.7 Chem. Eqs & 3.8 Balancing Chem. Eqs

CS 611 Advanced Programming Languages. Andrew Myers Cornell University. Lecture 26 Type reconstruction. 1 Nov 04. Type reconstruction

Deterministic Finite Automata (DFAs)

A non-turing-recognizable language

CSL 356: Analysis and Design of Algorithms. Ragesh Jaiswal CSE, IIT Delhi

CS : Speech, NLP and the Web/Topics in AI

EXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully

Automata Theory CS S-12 Turing Machine Modifications

Non-gaussian spatiotemporal modeling

Complexity Theory Part I

README - Syntax. Skolemization. Skolemization - Example 1. Skolemization - Example 1. Skolemization - Example 1. Skolemization - Example 2

cse541 LOGIC FOR COMPUTER SCIENCE

CSE 460: Computabilty and Formal Languages Turing Machine (TM) S. Pramanik

CIT 596 Theory of Computation Spring 2005, 212 Moore, TR PM. Homework Assignment 2

Features. Symbol Parameter Rating Units V DS Drain-Source Voltage 600 V V GS Gate-Source Voltage ±30 V

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4

1 Unrestricted Computation

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

OCR AS LEVEL CHEMISTRY A ATOMS ELECTRON STRUCTURE PERIODICITY (a) (d) TEST

CS460/626 : Natural Language

Comunicações Ópticas Noise in photodetectors MIEEC EEC038. Henrique Salgado Receiver operation

Homework. Turn in Homework #4. The fifth homework assignment has been posted on the course website. It is due on Monday, March 2.

Processing/Speech, NLP and the Web

ANNA UNIVERSITY, CHENNAI AFFILIATED INSTITUTIONS R-2013 B.E. COMPUTER SCIENCE AND ENGINEERING I TO VIII SEMESTER CURRICULUM AND SYLLABUS SEMESTER I

The Cross Product. MATH 311, Calculus III. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan The Cross Product

CS 275 Automata and Formal Language Theory. Proof of Lemma II Lemma (II )

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

WRITING CHEMICAL FORMULAS & NAMING COMPOUNDS

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Math 121 Homework 2 Solutions

Machine Learning (CS 567) Lecture 3

CSE302: Compiler Design

Knowledge-based systems

Entailment with Conditional Equality Constraints (Extended Version)

CS21004 Formal Languages and Automata Theory, Spring

DEPARTMENT OF ELECTRICAL ENGINEERING. Second Year

Classification s,p,d blocks

Courses THEORY. MA101 Calculus-I MA102 Real Analysis & Matrix Theory Business Communications. Chemistry I LABORATORIES

Systems of two-sided linear fuzzy relation equations and inequalities and their applications

CS460/626 : Natural Language Processing/Speech, NLP and the Web

Curriculum for B.Tech. Degree Programme 2017 Batch

Planning: situation calculus

Appendix B Impact Table - Proposed Routes

1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.

The model companion of the class of pseudo-complemented semilattices is finitely axiomatizable

An extension of HM(X) with bounded existential and universal data-types

Transcription:

CS618: Program Analysis 2016-17 I st Semester Points-to Analysis using Types Amey Karkare karkare@cse.iitk.ac.in karkare@cse.iitb.ac.in Department of CSE, IIT Kanpur/Bombay karkare, CSE, IITK/B CS618 1/10

Reference Papers Bjarne Steensgaard: Points-to Analysis in Almost Linear Time. POPL 1996 Manuvir Das: Unification-based pointer analysis with directional assignments. PLDI 2000 karkare, CSE, IITK/B CS618 2/10

Language S ::= x = y karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y x = y karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y x = y x = allocate(y) karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y x = y x = allocate(y) x = y karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y x = y x = allocate(y) x = y x = fun(f 1,...,f n ) returns r in S karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y x = y x = allocate(y) x = y x = fun(f 1,...,f n ) returns r in S x = p(y 1,...,y n ) karkare, CSE, IITK/B CS618 3/10

Language S ::= x = y x = &y x = y x = allocate(y) x = y x = fun(f 1,...,f n ) returns r in S x = p(y 1,...,y n ) karkare, CSE, IITK/B CS618 3/10

Non standard Types s Symbols karkare, CSE, IITK/B CS618 4/10

Non standard Types s Symbols karkare, CSE, IITK/B CS618 4/10

Non standard Types s Symbols τ Locations ::= (ϕ, α) karkare, CSE, IITK/B CS618 4/10

Non standard Types s Symbols τ Locations ::= (ϕ, α) ϕ Ids ::= {s 1,...,s n } karkare, CSE, IITK/B CS618 4/10

Non standard Types s Symbols τ Locations ::= (ϕ, α) ϕ Ids ::= {s 1,...,s n } α Values ::= ptr(τ) karkare, CSE, IITK/B CS618 4/10

Non standard Types s Symbols τ Locations ::= (ϕ, α) ϕ Ids ::= {s 1,...,s n } α Values ::= ptr(τ) A denotes type environment. karkare, CSE, IITK/B CS618 4/10

Partial Order α 1 α 2 (α 1 = ) (α 1 = α 2 ) karkare, CSE, IITK/B CS618 5/10

: Typing Rules A x : (ϕ,α) A y : (ϕ,α ) α α A welltyped(x = y) karkare, CSE, IITK/B CS618 6/10

: Typing Rules A x : (ϕ,α) A y : (ϕ,α ) α α A welltyped(x = y) A x : (ϕ,α) A y : τ ptr(τ) α A welltyped(x = &y) karkare, CSE, IITK/B CS618 6/10

: Typing Rules A x : (ϕ,α) A y : (ϕ,α ) α α A welltyped(x = y) A x : (ϕ,α) A y : τ ptr(τ) α A welltyped(x = &y) A x : (ϕ,α) A y : (ϕ, ptr(ϕ,α )) α α A welltyped(x = y) karkare, CSE, IITK/B CS618 6/10

: Typing Rules A x : (ϕ,α) A y : (ϕ,α ) α α A welltyped(x = y) A x : (ϕ,α) A y : τ ptr(τ) α A welltyped(x = &y) A x : (ϕ,α) A y : (ϕ, ptr(ϕ,α )) α α A welltyped(x = y) A x : (ϕ, ptr(ϕ,α )) A y : (ϕ,α ) α α A welltyped( x = y) karkare, CSE, IITK/B CS618 6/10

: Typing Rules A x : (ϕ,α) A y : (ϕ,α ) α α A welltyped(x = y) A x : (ϕ,α) A y : τ ptr(τ) α A welltyped(x = &y) A x : (ϕ,α) A y : (ϕ, ptr(ϕ,α )) α α A welltyped(x = y) A x : (ϕ, ptr(ϕ,α )) A y : (ϕ,α ) α α A welltyped( x = y) A x : τ A welltyped(x = allocate(y)) karkare, CSE, IITK/B CS618 6/10

Function Definitions karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ A x : (τ 1...τ n ) τ karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ A x : (τ 1...τ n ) τ i {1...n}.A f i : τ i karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ A x : (τ 1...τ n ) τ i {1...n}.A f i : τ i A r : τ karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ A x : (τ 1...τ n ) τ i {1...n}.A f i : τ i A r : τ s S.A welltyped(s) karkare, CSE, IITK/B CS618 7/10

Function Definitions Need a new type value: (τ 1...τ n ) τ A x : (τ 1...τ n ) τ i {1...n}.A f i : τ i A r : τ s S.A welltyped(s) A welltyped(x = fun(f 1,...,f n ) returns r in S ) karkare, CSE, IITK/B CS618 7/10

Function Calls A x : τ τ = (ϕ,α) karkare, CSE, IITK/B CS618 8/10

Function Calls A x : τ τ = (ϕ,α) karkare, CSE, IITK/B CS618 8/10

Function Calls A x : τ τ = (ϕ,α) A p : (τ 1...τ n ) τ τ i = (ϕ i,α i ) karkare, CSE, IITK/B CS618 8/10

Function Calls A x : τ τ = (ϕ,α) A p : (τ 1...τ n ) τ τ i = (ϕ i,α i ) i {1...n}.A y i : τ i τ i = (ϕ i,α i ) karkare, CSE, IITK/B CS618 8/10

Function Calls A x : τ τ = (ϕ,α) A p : (τ 1...τ n ) τ τ i = (ϕ i,α i ) i {1...n}.A y i : τ i τ i = (ϕ i,α i ) α i α i α α karkare, CSE, IITK/B CS618 8/10

Function Calls A x : τ τ = (ϕ,α) A p : (τ 1...τ n ) τ τ i = (ϕ i,α i ) i {1...n}.A y i : τ i τ i = (ϕ i,α i ) α i α i α α A welltyped(x = p(y 1,...,y n )) karkare, CSE, IITK/B CS618 8/10

Manuvir Das s One-level Flow-based Analysis α 1 α 2 ptr(τ 1 ) ptr(τ 2 ) karkare, CSE, IITK/B CS618 9/10

Manuvir Das s One-level Flow-based Analysis α 1 α 2 ptr(τ 1 ) ptr(τ 2 ) ptr((ϕ,α )) ptr((ϕ,α)) karkare, CSE, IITK/B CS618 9/10

Manuvir Das s One-level Flow-based Analysis α 1 α 2 ptr(τ 1 ) ptr(τ 2 ) ptr((ϕ,α )) ptr((ϕ,α)) (ϕ ϕ) (α = α) karkare, CSE, IITK/B CS618 9/10

One-level Flow-based Analysis Replace by in Steensgaard s analysis karkare, CSE, IITK/B CS618 10/10

One-level Flow-based Analysis Replace by in Steensgaard s analysis Keeps top level pointees separate! karkare, CSE, IITK/B CS618 10/10