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

Size: px
Start display at page:

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

Transcription

1 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 correct information After statement S2, program names and *ptr are both epressions that refer to the same memor location (aliases) We sa that ptr points-to after statement S2. In a C-like language that has pointers, we must know the points-to relation to be able to determine defs and uses correctl For now, onl tpes are int, int*, int** etc. No heap All pointers point to onl to stack variables No procedure or function calls Statements involving pointer variables: address: := & cop: := load: := * store: * := Arbitrar computations involving ints Program model a c a c a c a c b d b d b d b d initial state = =* *= Points-to relation Directed graph: nodes are program variables edge (a,b): variable a points-to variable b ptr Can use a special node to represent NULL Points-to relation is different at different program points 1

2 Points-to graph Out-degree of node ma be more than one if points-to graph has edges (a,b) and (a,c), it means that variable a ma point to either b or c depending on how we got to that point, one or the other will be true path-sensitive analses: track how ou got to a program point (we will not do this) if (p) then := & else := &z.. := & p := &z Ordering on points-to relation Subset ordering: for a given set of variables Least element is graph with no edges 1 <= 2 if 2 has all the edges 1 has and mabe some more iven two points-to relations 1 and 2 1 U 2: least graph that contains all the edges in 1 and in 2 What does point to here? Overview We will look at three different points-to analses. Flow-sensitive points-to analsis Dataflow analsis Computes a different points-to relation at each point in program Flow-insensitive points-to analsis Computes a single points-to graph for entire program Andersen s algorithm Natural simplification of flow-sensitive algorithm Steensgard s algorithm Nodes in tree are equivalence classes of variables if ma point-to either or z, put and z in the same equivalence class Points-to relation is a tree with edges from children to parents rather than a general graph Less precise than Andersen s algorithm but faster := &z ptr := & := &w ptr := & Eample ptr z w ptr z w Andersen s algorithm ptr, Flow-sensitive algorithm z,w Steensgard s algorithm 2

3 Notation Suppose S and S1 are set-d variables. S S1: strong update set assignment S U S1: weak update set union: this is like S S U S1 Flow-sensitive algorithm Dataflow equations Dataflow equations (contd.) Forward flow, an path analsis Confluence operator: 1 U 2 Statements := & := = with pt () { = with pt () ) := * * := = with pt () U a) for all a in ) = with pt (a) U) for all a in ) := & = with pt () { := = with pt () ) strong updates := * * := = with pt () U a) for all a in ) = with pt (a) U) for all a in ) weak update (wh?) 3

4 Strong vs. weak updates Strong update: At assignment statement, ou know precisel which variable is being written to Eample: :=. You can remove points-to information about coming into the statement in the dataflow analsis. Weak update: You do not know precisel which variable is being updated; onl that it is one among some set of variables. Eample: * := Problem: at analsis time, ou ma not know which variable points to (see slide on control-flow and out-degree of nodes) Refinement: if out-degree of in points-to graph is 1 and is known not be nil, we can do a strong update even for * := Structures Structure tpes struct cell {int ; struct cell *left, *right; struct cell,; Use a field-sensitive model and are nodes each node has three internal fields labeled, left, right This representation permits pointers into fields of structures If this is not necessar, we can simpl have a node for each structure and label outgoing edges with field name int main(void) { struct cell {int ; struct cell *net; ; struct cell,,z,*p; int sum;. = 5;.net = &;. = 6;.net = &z; z. = 7; z.net = NULL; p = &; sum = 0; while (p!= NULL) { sum = sum + (*p).; p = (*p).net; return sum; Eample net p net p net z net NULL net z net NULL Flow-insensitive algorithms 4

5 Flow-insensitive analsis Andersen s algorithm Flow-sensitive analsis computes a different graph at each program point. This can be quite epensive. One alternative: flow-insensitive analsis Intuition:compute a points-to relation which is the least upper bound of all the points-to relations computed b the flowsensitive analsis Approach: Ignore control-flow Consider all assignment statements together replace strong updates in dataflow equations with weak updates Compute a single points-to relation that holds regardless of the order in which assignment statements are actuall eecuted Statements := & = with ) U { := = with ) U) := * * := = with ) Ua) for all a in ) weak updates onl = with a) U) for all a in ) int main(void) { struct cell {int ; struct cell *net; ; struct cell,,z,*p; int sum;. = 5;.net = &;. = 6;.net = &z; z. = 7; z.net = NULL; p = &; sum = 0; while (p!= NULL) { sum = sum + (*p).; p = (*p).net; return sum; Eample.net = &;.net = &z; z.net = NULL; p = &; p = (*p).net; Assignments for flow-insensitive analsis... Solution to flow-insensitive equations net p z net net NULL - Compare with points-to graphs for flow-sensitive solution - Wh does p point-to NULL in this graph? 5

6 Andersen s algorithm formulated using set constraints Steensgard s algorithm Statements pt : var 2 var := & ) := ) ) := * a ). ) a) * := a ). a) ) Flow-insensitive Computes a points-to graph in which there is no fan-out In points-to graph produced b Andersen s algorithm, if points-to and z, and z are collapsed into an equivalence class Less accurate than Andersen s but faster We can eploit this to design an O(N* (N)) algorithm, where N is the number of statements in the program. Statements Steensgard s algorithm using set constraints pt : var 2 var No fan-out., z ). ) z) Trick for one-pass processing Consider the following equations ) ) dumm ) z ) ) ) z ) := & ) := ) ) := * a ). ) a) * := a ). a) ) When first equation on left is processed, and are not pointing to anthing. Once second equation is processed, we need to go back and reprocess first equation. Trick to avoid doing this: when processing first equation, if and are not pointing to anthing, create a dumm node and make and point to that this is like solving the sstem on the right It is eas to show that this avoids the need for revisiting equations. 6

7 Algorithm Auiliar methods Can be implemented in single pass through program Algorithm uses union-find to maintain equivalence classes (sets) of nodes Points-to relation is implemented as a pointer from a variable to a representative of a set Basic operations for union find: rep(v): find the node that is the representative of the set that v is in union(v1,v2): create a set containing elements in sets containing v1 and v2, and return representative of that set class var { //instance variables points_to: var; name: string; //constructor; also creates singleton set in union-find data structure var(string); //class method; also creates singleton set in union-find data structure make-dumm-var():var; //instance methods get_): var; set_var);//updates rep rec_union(var v1, var v2) { p1 = rep(v1)); p2 = rep(v2)); t1 = union(rep(v1), rep(v2)); if (p1 == p2) return; else if (p1!= null && p2!= null) t2 = rec_union(p1, p2); else if (p1!= null) t2 = p1; else if (p2!= null) t2 = p2; else t2 = null; t1.set_t2); return t1; var v) { //v does not have to be representative t = rep(v); return t.get_); //alwas returns a representative element Algorithm Initialization: make each program variable into an object of tpe var and enter object into union-find data structure for each statement S in the program do S is := &: {if () == null).set-rep()); else rec-union(),); S is := : {if () == null and ) == null).set-var.make-dumm-var());.set-rec-union(),))); S is := *:{if () == null).set-var.make-dumm-var()); var a := ); if(a) == null) a.set-var.make-dumm-var());.set-rec-union(),a))); S is * := :{if () == null).set-var.make-dumm-var()); var a := ); if(a) == null) a.set-var.make-dumm-var());.set-rec-union(),a))); Inter-procedural analsis What do we do if there are function calls? 1 = &a 1 = &b swap(1, 1) swap (p1, p2) { 2 = &a 2 = &b swap(2, 2) 7

8 Two approaches Contet-sensitive approach: treat each function call separatel just like real program eecution would problem: what do we do for recursive functions? need to approimate Contet-insensitive approach: merge information from all call sites of a particular function in effect, inter-procedural analsis problem is reduced to intra-procedural analsis problem Contet-sensitive approach is obviousl more accurate but also more epensive to compute Contet-insensitive approach 1 = &a 1 = &b swap(1, 1) swap (p1, p2) { 2 = &a 2 = &b swap(2, 2) Contet-sensitive approach Contet-insensitive/Flowinsensitive Analsis 1 = &a 1 = &b swap(1, 1) swap (p1, p2) { 2 = &a 2 = &b swap(2, 2) swap (p1, p2) { For now, assume we do not have function parameters this means we know all the call sites for a given function Set up equations for binding of actual and formal parameters at each call site for that function use same variables for formal parameters for all call sites Intuition: each invocation provides a new set of constraints to formal parameters 8

9 Swap eample Heap allocation 1 = &a 1 = &b p1 = 1 p2 = 1 2 = &a 2 = &b p1 = 2 p2 = 2 Simplest solution: use one node in points-to graph to represent all heap cells More elaborate solution: use a different node for each malloc site in the program Even more elaborate solution: shape analsis goal: summarize potentiall infinite data structures but keep around enough information so we can disambiguate pointers from stack into the heap, if possible Summar Less precise More precise Equalit-based Subset-based Histor of points-to analsis Flow-insensitive Flow-sensitive Contet-insensitive Contet-sensitive No consensus about which technique to use Eperience: if ou are contet-insensitive, ou might as well be flow-insensitive from Rder and Raside 9

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

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

Introduction to Shape and Pointer Analysis

Introduction to Shape and Pointer Analysis Introduction to Shape and Pointer Analsis CS 502 Lecture 11 10/30/08 Some slides adapted from Nielson, Nielson, Hankin Principles of Program Analsis Analsis of the Heap Thus far, we have focussed on control

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

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

0 COORDINATE GEOMETRY

0 COORDINATE GEOMETRY 0 COORDINATE GEOMETRY Coordinate Geometr 0-1 Equations of Lines 0- Parallel and Perpendicular Lines 0- Intersecting Lines 0- Midpoints, Distance Formula, Segment Lengths 0- Equations of Circles 0-6 Problem

More information

Variables and Bindings

Variables and Bindings Net: Variables Variables and Bindings Q: How to use variables in ML? Q: How to assign to a variable? # let = 2+2;; val : int = 4 let = e;; Bind the value of epression e to the variable Variables and Bindings

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

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

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

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

Register Allocation 3/16/11. What a Smart Allocator Needs to Do. Global Register Allocation. Global Register Allocation. Outline.

Register Allocation 3/16/11. What a Smart Allocator Needs to Do. Global Register Allocation. Global Register Allocation. Outline. What a Smart Allocator Needs to Do Register Allocation Global Register Allocation Webs and Graph Coloring Node Splitting and Other Transformations Determine ranges for each variable can benefit from using

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

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology Intermediate Algebra Gregg Waterman Oregon Institute of Technolog c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license

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

Roberto s Notes on Differential Calculus Chapter 8: Graphical analysis Section 5. Graph sketching

Roberto s Notes on Differential Calculus Chapter 8: Graphical analysis Section 5. Graph sketching Roberto s Notes on Differential Calculus Chapter 8: Graphical analsis Section 5 Graph sketching What ou need to know alread: How to compute and interpret limits How to perform first and second derivative

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

CS S-11 Memory Management 1

CS S-11 Memory Management 1 CS414-2017S-11 Management 1 11-0: Three places in memor that a program can store variables Call stack Heap Code segment 11-1: Eecutable Code Code Segment Static Storage Stack Heap 11-2: Three places in

More information

Determining the 2d transformation that brings one image into alignment (registers it) with another. And

Determining the 2d transformation that brings one image into alignment (registers it) with another. And Last two lectures: Representing an image as a weighted combination of other images. Toda: A different kind of coordinate sstem change. Solving the biggest problem in using eigenfaces? Toda Recognition

More information

L3 Rigid Motion Transformations 3.1 Sequences of Transformations Per Date

L3 Rigid Motion Transformations 3.1 Sequences of Transformations Per Date 3.1 Sequences of Transformations Per Date Pre-Assessment Which of the following could represent a translation using the rule T (, ) = (, + 4), followed b a reflection over the given line? (The pre-image

More information

Using the same procedure that was used in Project 5, enter matrix A and its label into an Excel spreadsheet:

Using the same procedure that was used in Project 5, enter matrix A and its label into an Excel spreadsheet: Math 6: Ecel Lab 6 Summer Inverse Matrices, Determinates and Applications: (Stud sections, 6, 7 and in the matri book in order to full understand the topic.) This Lab will illustrate how Ecel can help

More information

Find the Relationship: An Exercise in Graphical Analysis

Find the Relationship: An Exercise in Graphical Analysis Find the Relationship: An Eercise in Graphical Analsis In several laborator investigations ou do this ear, a primar purpose will be to find the mathematical relationship between two variables. For eample,

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

Unit 5 Lesson 2 Investigation 1

Unit 5 Lesson 2 Investigation 1 Name: Investigation 1 Modeling Rigid Transformations CPMP-Tools Computer graphics enable designers to model two- and three-dimensional figures and to also easil manipulate those figures. For eample, interior

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

What are the rules of elementary algebra

What are the rules of elementary algebra What are the rules of elementar algebra James Davenport & Chris Sangwin Universities of Bath & Birmingham 7 Jul 2010 Setting A relativel traditional mathematics course, at, sa first-ear undergraduate level.

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

ACTIVITY 9 Continued Lesson 9-2

ACTIVITY 9 Continued Lesson 9-2 Continued Lesson 9- Lesson 9- PLAN Pacing: 1 class period Chunking the Lesson Eample A Eample B #1 #3 Lesson Practice M Notes Learning Targets: Graph on a coordinate plane the solutions of a linear inequalit

More information

Math 1050 Lab Activity: Graphing Transformations

Math 1050 Lab Activity: Graphing Transformations Math 00 Lab Activit: Graphing Transformations Name: We'll focus on quadratic functions to eplore graphing transformations. A quadratic function is a second degree polnomial function. There are two common

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

A Formal Definition of Limit

A Formal Definition of Limit 5 CHAPTER Limits and Their Properties L + ε L L ε (c, L) c + δ c c δ The - definition of the it of f as approaches c Figure. A Formal Definition of Limit Let s take another look at the informal description

More information

Implicit differentiation

Implicit differentiation Roberto s Notes on Differential Calculus Chapter 4: Basic differentiation rules Section 5 Implicit differentiation What ou need to know alread: Basic rules of differentiation, including the chain rule.

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

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

Rational Functions with Removable Discontinuities

Rational Functions with Removable Discontinuities Rational Functions with Removable Discontinuities 1. a) Simplif the rational epression and state an values of where the epression is b) Using the simplified epression in part (a), predict the shape for

More information

Sample Problems for Quiz # 3

Sample Problems for Quiz # 3 EE 1301 UMN Introduction to Computing Sstems Spring 2013 Sample Problems for Quiz # 3 1. Implementing XOR with AND gates Recall that the Eclusive-OR (XOR) function is 1 if an odd number of the inputs are

More information

Lecture Notes: Pointer Analysis

Lecture Notes: Pointer Analysis Lecture Notes: Pointer Analysis 15-819O: Program Analysis Jonathan Aldrich jonathan.aldrich@cs.cmu.edu Lecture 9 1 Motivation for Pointer Analysis In programs with pointers, program analysis can become

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

Monday, September 28, 2015

Monday, September 28, 2015 Monda, September 28, 2015 Topics for toda Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global variables

More information

Laurie s Notes. Overview of Section 6.3

Laurie s Notes. Overview of Section 6.3 Overview of Section.3 Introduction In this lesson, eponential equations are defined. Students distinguish between linear and eponential equations, helping to focus on the definition of each. A linear function

More information

B + -trees. Kerttu Pollari-Malmi

B + -trees. Kerttu Pollari-Malmi B + -trees Kerttu Pollari-Malmi This tet is based partl on the course tet book b Cormen and partl on the old lecture slides written b Matti Luukkainen and Matti Nkänen. 1 Introduction At first, read the

More information

Scale Invariant Feature Transform (SIFT) CS 763 Ajit Rajwade

Scale Invariant Feature Transform (SIFT) CS 763 Ajit Rajwade Scale Invariant Feature Transform (SIFT) CS 763 Ajit Rajwade What is SIFT? It is a technique for detecting salient stable feature points in an image. For ever such point it also provides a set of features

More information

COMP 524 Spring 2018 Midterm Thursday, March 1

COMP 524 Spring 2018 Midterm Thursday, March 1 Name PID COMP 524 Spring 2018 Midterm Thursday, March 1 This exam is open note, open book and open computer. It is not open people. You are to submit this exam through gradescope. Resubmissions have been

More information

Optional: Building a processor from scratch

Optional: Building a processor from scratch Optional: Building a processor from scratch In this assignment we are going build a computer processor from the ground up, starting with transistors, and ending with a small but powerful processor. The

More information

Systems of Linear Equations

Systems of Linear Equations Sstems of Linear Equations Gaussian Elimination Tpes of Solutions A linear equation is an equation that can be written in the form: a a a n n b The coefficients a i and the constant b can be real or comple

More information

Answers. Chapter 4. Cumulative Review Chapters 1 3, pp Chapter Self-Test, p Getting Started, p a) 49 c) e)

Answers. Chapter 4. Cumulative Review Chapters 1 3, pp Chapter Self-Test, p Getting Started, p a) 49 c) e) . 7" " " 7 "7.. "66 ( ") cm. a, (, ), b... m b.7 m., because t t has b ac 6., so there are two roots. Because parabola opens down and is above t-ais for small positive t, at least one of these roots is

More information

Graphs and Functions

Graphs and Functions CHAPTER Graphs and Functions. Graphing Equations. Introduction to Functions. Graphing Linear Functions. The Slope of a Line. Equations of Lines Integrated Review Linear Equations in Two Variables.6 Graphing

More information

Programming Language Concepts Scoping. Janyl Jumadinova January 31, 2017

Programming Language Concepts Scoping. Janyl Jumadinova January 31, 2017 Programming Language Concepts Scoping Janyl Jumadinova January 31, 2017 Scope Rules A scope is a program section of maximal size in which no bindings change, or at least in which no re-declarations are

More information

EELE 482 Lab #3. Lab #3. Diffraction. 1. Pre-Lab Activity Introduction Diffraction Grating Measure the Width of Your Hair 5

EELE 482 Lab #3. Lab #3. Diffraction. 1. Pre-Lab Activity Introduction Diffraction Grating Measure the Width of Your Hair 5 Lab #3 Diffraction Contents: 1. Pre-Lab Activit 2 2. Introduction 2 3. Diffraction Grating 4 4. Measure the Width of Your Hair 5 5. Focusing with a lens 6 6. Fresnel Lens 7 Diffraction Page 1 (last changed

More information

Chapter 5 Names, Binding, Type Checking and Scopes

Chapter 5 Names, Binding, Type Checking and Scopes Chapter 5 Names, Binding, Type Checking and Scopes Names - We discuss all user-defined names here - Design issues for names: -Maximum length? - Are connector characters allowed? - Are names case sensitive?

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

LINEAR PROGRAMMING. Straight line graphs LESSON

LINEAR PROGRAMMING. Straight line graphs LESSON LINEAR PROGRAMMING Traditionall we appl our knowledge of Linear Programming to help us solve real world problems (which is referred to as modelling). Linear Programming is often linked to the field of

More information

Lecture 12 Date:

Lecture 12 Date: Information Technolog Delhi Lecture 2 Date: 3.09.204 The Signal Flow Graph Information Technolog Delhi Signal Flow Graph Q: Using individual device scattering parameters to analze a comple microwave network

More information

Module 3 Graphing and Optimization

Module 3 Graphing and Optimization Module 3 Graphing and Optimization One of the most important applications of calculus to real-world problems is in the area of optimization. We will utilize the knowledge gained in the previous chapter,

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

CHECK Your Understanding

CHECK Your Understanding CHECK Your Understanding. State the domain and range of each relation. Then determine whether the relation is a function, and justif our answer.. a) e) 5(, ), (, 9), (, 7), (, 5), (, ) 5 5 f) 55. State

More information

Chapter Goals: Evaluate limits. Evaluate one-sided limits. Understand the concepts of continuity and differentiability and their relationship.

Chapter Goals: Evaluate limits. Evaluate one-sided limits. Understand the concepts of continuity and differentiability and their relationship. MA123, Chapter 3: The idea of its (pp. 47-67) Date: Chapter Goals: Evaluate its. Evaluate one-sided its. Understand the concepts of continuit and differentiabilit and their relationship. Assignments: Assignment

More information

3x 4y 2. 3y 4. Math 65 Weekly Activity 1 (50 points) Name: Simplify the following expressions. Make sure to use the = symbol appropriately.

3x 4y 2. 3y 4. Math 65 Weekly Activity 1 (50 points) Name: Simplify the following expressions. Make sure to use the = symbol appropriately. Math 65 Weekl Activit 1 (50 points) Name: Simplif the following epressions. Make sure to use the = smbol appropriatel. Due (1) (a) - 4 (b) ( - ) 4 () 8 + 5 6 () 1 5 5 Evaluate the epressions when = - and

More information

Bias-Variance Decomposition Error Estimators

Bias-Variance Decomposition Error Estimators Bias-Variance Decomposition Error Estimators Cross-Validation Bias-Variance tradeoff Intuition Model too simple does not fit the data well a biased solution. Model too comple small changes to the data,

More information

Bias-Variance Decomposition Error Estimators Cross-Validation

Bias-Variance Decomposition Error Estimators Cross-Validation Bias-Variance Decomposition Error Estimators Cross-Validation Bias-Variance tradeoff Intuition Model too simple does not fit the data well a biased solution. Model too comple small changes to the data,

More information

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations Chapter Transformations of Functions TOPICS.5.. Shifting, reflecting, and stretching graphs Smmetr of functions and equations TOPIC Horizontal Shifting/ Translation Horizontal Shifting/ Translation Shifting,

More information

LESSON 3.1 INTRODUCTION TO GRAPHING

LESSON 3.1 INTRODUCTION TO GRAPHING LESSON 3.1 INTRODUCTION TO GRAPHING LESSON 3.1 INTRODUCTION TO GRAPHING 137 OVERVIEW Here s what ou ll learn in this lesson: Plotting Points a. The -plane b. The -ais and -ais c. The origin d. Ordered

More information

Data, memory. Pointers and Dynamic Variables. Example. Pointers Variables (or Pointers) Fall 2018, CS2

Data, memory. Pointers and Dynamic Variables. Example. Pointers Variables (or Pointers) Fall 2018, CS2 Data, memor Pointers and Dnamic Variables Fall 2018, CS2 memor address: ever bte is identified b a numeric address in the memor. a data value requiring multiple btes are stored consecutivel in memor cells

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

CO444H. Ben Livshits. Datalog Pointer analysis

CO444H. Ben Livshits. Datalog Pointer analysis CO444H Ben Livshits Datalog Pointer analysis 1 Call Graphs Class analysis: Given a reference variable x, what are the classes of the objects that x refers to at runtime? We saw CHA and RTA Deal with polymorphic/virtual

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

Wednesday, February 19, 2014

Wednesday, February 19, 2014 Wednesda, Februar 19, 2014 Topics for toda Solutions to HW #2 Topics for Eam #1 Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack Stack-relative addressing (,s) SP manipulation Stack

More information

Binary Trees. Binary Search Trees

Binary Trees. Binary Search Trees Binar Trees A binar tree is a rooted tree where ever node has at most two children. When a node has onl one child, we still distinguish whether this is the left child or the right child of the parent.

More information

Transformations of Functions. Shifting Graphs. Similarly, you can obtain the graph of. g x x 2 2 f x 2. Vertical and Horizontal Shifts

Transformations of Functions. Shifting Graphs. Similarly, you can obtain the graph of. g x x 2 2 f x 2. Vertical and Horizontal Shifts 0_007.qd /7/05 : AM Page 7 7 Chapter Functions and Their Graphs.7 Transormations o Functions What ou should learn Use vertical and horizontal shits to sketch graphs o unctions. Use relections to sketch

More information

An Introduction to Heap Analysis. Pietro Ferrara. Chair of Programming Methodology ETH Zurich, Switzerland

An Introduction to Heap Analysis. Pietro Ferrara. Chair of Programming Methodology ETH Zurich, Switzerland An Introduction to Heap Analysis Pietro Ferrara Chair of Programming Methodology ETH Zurich, Switzerland Analisi e Verifica di Programmi Universita Ca Foscari, Venice, Italy Outline 1. Recall of numerical

More information

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center . The Ellipse The net one of our conic sections we would like to discuss is the ellipse. We will start b looking at the ellipse centered at the origin and then move it awa from the origin. Standard Form

More information

x Check: p. C) 32 8k D) 3t 15

x Check: p. C) 32 8k D) 3t 15 Chapter Notes Alg H -A (Lesson -&) Solving Inequalities p. 0-0 A) n B) Check: n A) B) p When ou multipl or divide b a number, ou must the inequalit sign! A) r B) g 0 C) k D) t Points: Ch Notes Alg H -A

More information

EXAMPLE A {(1, 2), (2, 4), (3, 6), (4, 8)}

EXAMPLE A {(1, 2), (2, 4), (3, 6), (4, 8)} Name class date Understanding Relations and Functions A relation shows how one set of things is related to, or corresponds to, another set. For instance, the equation A 5 s shows how the area of a square

More information

Integrated Algebra A Notes/Homework Packet 9

Integrated Algebra A Notes/Homework Packet 9 Name Date Integrated Algebra A Notes/Homework Packet 9 Lesson Homework Graph Using the Calculator HW # Graph with Slope/Intercept Method HW # Graph with Slope/Intercept Method-Continued HW #3 Review Put

More information

1.1 Horizontal & Vertical Translations

1.1 Horizontal & Vertical Translations Unit II Transformations of Functions. Horizontal & Vertical Translations Goal: Demonstrate an understanding of the effects of horizontal and vertical translations on the graphs of functions and their related

More information

The code generator must statically assign a location in the AR for each temporary add $a0 $t1 $a0 ; $a0 = e 1 + e 2 addiu $sp $sp 4 ; adjust $sp (!

The code generator must statically assign a location in the AR for each temporary add $a0 $t1 $a0 ; $a0 = e 1 + e 2 addiu $sp $sp 4 ; adjust $sp (! Lecture Outline Code Generation (II) Adapted from Lectures b Profs. Ale Aiken and George Necula (UCB) Allocating temporaries in the Activation Record Let s optimie cgen a little Code generation for OO

More information

Modeling and Simulation Exam

Modeling and Simulation Exam Modeling and Simulation am Facult of Computers & Information Department: Computer Science Grade: Fourth Course code: CSC Total Mark: 75 Date: Time: hours Answer the following questions: - a Define the

More information

Week 27 Algebra 1 Assignment:

Week 27 Algebra 1 Assignment: Week 7 Algebra Assignment: Da : p. 494 #- odd, -, 8- Da : pp. 496-497 #-9 odd, -6 Da : pp. 0-0 #-9 odd, -, -9 Da 4: p. 09 #-4, 7- Da : pp. - #-9 odd Notes on Assignment: Page 494: General notes for this

More information

Typical Compiler. Ahead- of- time compiler. Compilers... that target interpreters. Interpreter 12/9/15. compile time. run time

Typical Compiler. Ahead- of- time compiler. Compilers... that target interpreters. Interpreter 12/9/15. compile time. run time Ahead- of- time Tpical Compiler compile time C source C 86 assembl 86 assembler 86 machine Source Leical Analzer Snta Analzer Semantic Analzer Analsis Intermediate Code Generator Snthesis run time 86 machine

More information

Introduction to C Language (M3-R )

Introduction to C Language (M3-R ) Introduction to C Language (M3-R4-01-18) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in OMR answer sheet supplied with the question paper, following

More information

Graph Linear Equations

Graph Linear Equations Lesson 4. Objectives Graph linear equations. Identif the slope and -intercept of linear equations. Graphing Linear Equations Suppose a baker s cookie recipe calls for a miture of nuts, raisins, and dried

More information

Introduction to Algorithms Massachusetts Institute of Technology Professors Erik D. Demaine and Charles E. Leiserson.

Introduction to Algorithms Massachusetts Institute of Technology Professors Erik D. Demaine and Charles E. Leiserson. Introduction to Algorithms Massachusetts Institute of Technolog Professors Erik D. Demaine and Charles E. Leiserson October 24, 2005 6.046J/18.410J Handout 16 Problem Set 5 MIT students: This problem set

More information

2-1. The Language of Functions. Vocabulary

2-1. The Language of Functions. Vocabulary Chapter Lesson -1 BIG IDEA A function is a special tpe of relation that can be described b ordered pairs, graphs, written rules or algebraic rules such as equations. On pages 78 and 79, nine ordered pairs

More information

Matrix Representations

Matrix Representations CONDENSED LESSON 6. Matri Representations In this lesson, ou Represent closed sstems with transition diagrams and transition matrices Use matrices to organize information Sandra works at a da-care center.

More information

Heap Arrays and Linked Lists. Steven R. Bagley

Heap Arrays and Linked Lists. Steven R. Bagley Heap Arrays and Linked Lists Steven R. Bagley Recap Data is stored in variables Can be accessed by the variable name Or in an array, accessed by name and index Variables and arrays have a type Create our

More information

Transformations of y = x 2

Transformations of y = x 2 Transformations of = Parent Parabola Lesson 11-1 Learning Targets: Describe translations of the parent function f() =. Given a translation of the function f() =, write the equation of the function. SUGGESTED

More information

6-1: Solving Systems by Graphing

6-1: Solving Systems by Graphing 6-1: Solving Sstems b Graphing Objective: To solve sstems of linear equations b graphing Warm Up: Graph each equation using - and -intercepts. 1. 1. 4 8. 6 9 18 4. 5 10 5 sstem of linear equations: two

More information

Recap. Recap. If-then-else expressions. If-then-else expressions. If-then-else expressions. If-then-else expressions

Recap. Recap. If-then-else expressions. If-then-else expressions. If-then-else expressions. If-then-else expressions Recap Epressions (Synta) Compile-time Static Eec-time Dynamic Types (Semantics) Recap Integers: +,-,* floats: +,-,* Booleans: =,

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

Section 4.2 Graphing Lines

Section 4.2 Graphing Lines Section. Graphing Lines Objectives In this section, ou will learn to: To successfull complete this section, ou need to understand: Identif collinear points. The order of operations (1.) Graph the line

More information

Polynomial and Rational Functions

Polynomial and Rational Functions Polnomial and Rational Functions Figure -mm film, once the standard for capturing photographic images, has been made largel obsolete b digital photograph. (credit film : modification of work b Horia Varlan;

More information

9. f(x) = x f(x) = x g(x) = 2x g(x) = 5 2x. 13. h(x) = 1 3x. 14. h(x) = 2x f(x) = x x. 16.

9. f(x) = x f(x) = x g(x) = 2x g(x) = 5 2x. 13. h(x) = 1 3x. 14. h(x) = 2x f(x) = x x. 16. Section 4.2 Absolute Value 367 4.2 Eercises For each of the functions in Eercises 1-8, as in Eamples 7 and 8 in the narrative, mark the critical value on a number line, then mark the sign of the epression

More information

Section 1.4: Graphing Calculators and Computers

Section 1.4: Graphing Calculators and Computers Section 1.4: Graphing Calculators and Computers In this section we shall show some of the was that calculators can help us in mathematics. 1. Calculator Warnings Before we even consider how a calculator

More information

Scene Graphs & Modeling Transformations COS 426

Scene Graphs & Modeling Transformations COS 426 Scene Graphs & Modeling Transformations COS 426 3D Object Representations Points Range image Point cloud Surfaces Polgonal mesh Subdivision Parametric Implicit Solids Voels BSP tree CSG Sweep High-level

More information

Project 1 Part II: Metaproduct Primes

Project 1 Part II: Metaproduct Primes Project Part II: Metaproduct Primes What ou know Basic BDD data structure and JAVA implementation A little bit about these things called metaproducts What ou don t know All the tricks with metaproducts

More information

3.5 Rational Functions

3.5 Rational Functions 0 Chapter Polnomial and Rational Functions Rational Functions For a rational function, find the domain and graph the function, identifing all of the asmptotes Solve applied problems involving rational

More information

Appendix A.6 Functions

Appendix A.6 Functions A. Functions 539 RELATIONS: DOMAIN AND RANGE Appendi A. Functions A relation is a set of ordered pairs. A relation can be a simple set of just a few ordered pairs, such as {(0, ), (1, 3), (, )}, or it

More information

Chap 7, 2009 Spring Yeong Gil Shin

Chap 7, 2009 Spring Yeong Gil Shin Three-Dimensional i Viewingi Chap 7, 29 Spring Yeong Gil Shin Viewing i Pipeline H d fi i d? How to define a window? How to project onto the window? Rendering "Create a picture (in a snthetic camera) Specification

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

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information