Approach starts with GEN and KILL sets

Size: px
Start display at page:

Download "Approach starts with GEN and KILL sets"

Transcription

1 b -Advanced-DFA Review of Data Flow Analysis State Propaga+on Computer Science 5-6 Fall Prof. L. J. Osterweil Material adapted from slides originally prepared by Prof. L. A. Clarke A technique for determining facts at loca+ons on a CFG Can formulate problems in terms of a data flow framework Start with facts that are local Use propaga+on rules to generate increasingly accurate globally true facts. Know that the problem terminates Know that the computa+onal cost is reasonable Usually O(n ) Can usually define the problem so that the results are conserva+ve E.g., No false nega+ves Unfortunately, oxen have false posi+ves Approach starts with GEN and KILL sets For each node i, associate sets GEN(i) items to be added (generated) as concerns KILL(i) - items to be red (killed) as concerns The defini+ons of GEN and KILL depend on the problem that is being solved (the nature of the concern ) OXen the GEN and KILL sets can be derived from the abstract syntax tree E.g., variables defined in a node, DEF(i) variables referenced in a node, REF(i) Essence of Approach is Propaga+on Ini+al concerns GENerated and KILLed locally at each node Global informa+on summarized by OUT sets, ini+ally { IN equa+on (for forward flow analysis) Propaga+on of global data to each node by equa+on of form: IN(n i ) := Merge ( n j that are predecessors, OUT(n j ) ) Merge opera+on Over the {predecessors of n i for a forward- flow problem Merge operator determined by whether it is an all- path or an any- path problem Global summary informa+on in OUT equa+on Usually: OUT := (IN \ KILL) U GEN Using a Worklist Algorithm Essen+ally Depth- First Search But loops are traversed mul+ple +mes Traversals stop when OUT sets don t change Called a fixed point Fixed point reached quickly If only a finite number of possible values can be associated with a node s OUT set E.g. for undefined ref, it is any subset of the set of all variables If the func+on that determines the values is monotonic E.g. the only changes are removal of an element from a set Then the data- flow algorithm eventually terminates Worst case: Every one of N nodes has V variables ini+ally To re one value from one node, all N have to be visited Upper bound is O(N V) Actually very loose bound Page

2 b -Advanced-DFA A More General Conceptualiza+on Variables around the flow graph in different states Start out in undefined state Can transi+on to defined Will the variable encounter a ref while in undefined state? THINK PACMAN? When Pacman is in the right color can it gobble up a token (e.g. an undefined- colored variable token gobbles up a reference)? A More General Conceptualiza+on Variables around the flow graph in different states Start out in undefined state Can transi+on to defined Will the variable encounter a ref while in undefined state? THINK PACMAN? When Pacman is in the right color can it gobble up a token (e.g. an undefined- colored variable token gobbles up a reference)? What about situa+ons where > states is possible? Cecil: Olender and Osterweil User- specified Number of states (depends on property of interest) Transi+ons (driven by specified events ) States that are of interest Represented as a Determinis+c Finite State Automaton (DFSA) Or as a Quan+fied Regular Expression (QRE) Namely a specifica+on of the language accepted by the DFSA QREs can be translated into DFSAs Non determinis+c FSAs can be translated into DFSAs Property: The elevator always s its doors before moving Events:,, Assumes the doors are originally d,, Property: The elevator always s its doors before moving Property: The elevator always s its doors before moving Ini+al state Events:,, Events:,, Assumes the doors are originally d,, Assumes the doors are originally d,, Page

3 b -Advanced-DFA Property: The elevator always s its doors before moving Property: The elevator always s its doors before moving Events:,, Events:,, Accep+ng final states Assumes the doors are originally d,, trap or error state Assumes the doors are originally d,, Iden+fying Where Events Occur in Programs Recognizable events Method calls Can reason about sequences of method calls E.g., Push must be called before Pop Thread interac+ons Join or Fork Opera+ons on variables Define, reference, undefine a+b Need to be able to treat events as indivisible ac+ons E.g., can treat pop and push as atomic as long as they do not contain any events of concern Annotate control flow graph with events Annotate control flow graph with events,, Ini+alizing, Propaga+ng State Informa+on Forward Flow, Any Path Problem IN and OUT are sets of FSA states IN(n) = OUT(m) m pred(n) OUT(n) = δ(s, n) s IN(n) δ is the FSA transi+on func+on Ini+alize OUT(i) =, for all i For the workist algorithm, ini+alize IN()=start state Result: Let f be the final node of the flow graph Define Accept(P) to be the set of accep+ng states of a property, P For an All property: want OUT(f) Accept(P) For a None property: want OUT(f) Accept(P) = In Out Page 3

4 b -Advanced-DFA The Elevator Controller Example void main() { : if (elevatorstopped) {... 3: Doors();... 5: if (elevatorstopped) {... 7: Doors(); 9: ToNextFloor(); 3: 7: : if 5: if 9: Worklist:, 3,5, 7,9 Elevator Controller <> 3: <> <,> 7: <> <> <> : if 5: if 9: <,> <,> Property <,> <,> Elevator Controller Property Worklist: 3, 5, 7,9 <> : if void main() { 3: : if (elevatorstopped) <> {... 3: Doors(); 5: if <,>... 5: if (elevatorstopped) {... 7: Doors(); 7: <> 9: ToNextFloor(); 9: <,> The elevator never s while the doors are This DFSA is a none property A None Example,, Using Quan+fied Regular Expressions State propaga+on Alphabet, quan+fica+on, regular expression For the events {,, show that for all paths (( v )*, ( +, )*)* *,, Data Flow Analysis Problem - > lance (P(S),, ) func+on space δ : P(S) P(S) facts at nodes are elements of P(S) Propagate states un+l convergence and check if terminal node in an accep+ng/non- accep+ng state of DFSA Page 4

5 b -Advanced-DFA Example Meet Semilance {! {! {! {! {,! {,!! {,! values= P({,,)! = {! T = {,,! Ordering =! Meet =! Using Data Flow Analysis to Verify Proper+es Many interes+ng and important proper+es can be represented as FSAs or QREs Can efficiently determine if the property can be violated If it can be violated,can see a trace through the program that causes the viola+on BUT, may not correspond to an executable path {,,! Desiderata Represen+ng proper+es Modeling programs Interpre+ng results Any/All interpreta+on Verifying OO system method invoca+ons For OO systems, can reason about legal sequences of method invoca+ons Example: Must always check before popping a stack For events {pop, push, not_empty show that for all paths ((push)*, (not_empty, (- pop)*, pop)* )* (not_empty, (- pop)*)* push pop -pop not_empty Verifying OO system method invoca+ons For OO systems, can reason about legal sequences of method invoca+ons Example: Must always check before popping a stack For events {pop, push, not_empty show that for all paths ((push)*, (not_empty, (- pop)*, pop)* )* (not_empty, (- pop)*)* Verifying OO system method invoca+ons For OO systems, can reason about legal sequences of method invoca+ons Example: Must always check before popping a stack For events {pop, push, not_empty show that for all paths ((push)*, (not_empty, (- pop)*, pop)* )* (not_empty, (- pop)*)* push pop -pop push pop -pop not_empty Very conserva+ve property. Desirable for safety cri+cal systems not_empty Note: Omised transi+ons go to trap state Page 5

6 b -Advanced-DFA Quan+ta+ve Proper+es Cause Problems Can not represent #Insert > #Delete N deletes, K inserts, N deletes, k inserts, etc. K + K + > N + N + But for fixed N, can show that #inserts #deletes Each delete is immediately preceded by at least one insert For events {insert, delete For all paths (insert*, (insert,delete)*)* delete insert insert insert insert insert insert insert 3 4 delete delete delete delete... delete N insert Interpre+ng Results: When the system can not verify a property Provides a counter example User must decide what is wrong There could be a path through the system that violates the property OR The path that violates the property is not executable OR The property is incorrect State Propaga+on: Any/All paths All paths or no paths determined by how the last node in the graph is treated, not by intersec+on or union States of the property are propagated through the CFG For each node of the CFG, indicate the states of the property that the program could be in at that point in the program An any path problem An all (none) property is proved if only accep+ng (non- accep+ng) states are contained in the final node of the CFG,, Dealing with methods Dealing with methods If is a method call and it contains a, then must inline the code for If is a method call and it contains a, then must inline the code for CFG for CFG for Page 6

7 b -Advanced-DFA event/node simplifies analysis, Can reduce the CFG before doing the analysis Can re a node from the graph if it does not have an event associated with it, AND does not affect the flow of events through the graph Interprocedural Analysis- in- line reduced CFG CFG for Inline methods with events A summarized representation of (and everything that it calls) CFG for If does not call or, do not need to inline its code Advantages of State Propaga+on Data Flow Analysis determines if the property is valid or not Efficient Always terminates Conserva+ve Only validates the property if it is true for all/no possible execu+ons When it can not validate the property, it provides a counter example trace Rela+vely easy to use Do not have to understand how the system works Rela+vely easy to write proper+es Compared to predicate calculus or temporal logic Disadvantages of State Propaga+on Infeasible paths Can not usually express proper+es about compound data values E.g., For all I, A[ I ] > A[I+] Can not express general ordering rela+onships # Insert > # Delete But, can ensure that every delete is preceded by at least one insert Or, can ensure # Insert > # Delete, for some specific n Page 7

8 b -Advanced-DFA Associated support Support for elimina+ng infeasible paths Some systems apply symbolic execu+on Some+mes combined with a theorem prover Support for visualizing counter example traces Support for represen+ng proper+es Summary: Using Data Flow Analysis to Verify Proper+es Many interes+ng and important proper+es can be represented as DFSA or regular expressions Can efficiently determine if the property can be violated If it can be violated,can see a trace through the program that causes the viola+on May not correspond to an executable path For OO systems, works well for reasoning about legal sequences of method invoca+ons Page 8

Page # 20b -Advanced-DFA. Reading assignment. State Propagation. GEN and KILL sets. Data Flow Analysis

Page # 20b -Advanced-DFA. Reading assignment. State Propagation. GEN and KILL sets. Data Flow Analysis b -Advanced-DFA Reading assignment J. L. Peterson, "Petri Nets," Computing Surveys, 9 (3), September 977, pp. 3-5. Sections -4 State Propagation For reference only M. Pezzè, R. N. Taylor and M. Young,

More information

20b -Advanced-DFA. J. L. Peterson, "Petri Nets," Computing Surveys, 9 (3), September 1977, pp

20b -Advanced-DFA. J. L. Peterson, Petri Nets, Computing Surveys, 9 (3), September 1977, pp State Propagation Reading assignment J. L. Peterson, "Petri Nets," Computing Surveys, 9 (3), September 1977, pp. 223-252. Sections 1-4 For reference only M. Pezzè, R. N. Taylor and M. Young, Graph Models

More information

Review for Final Exam

Review for Final Exam Review for Final Exam Some selected slides from the second half of the semester Move from Dynamic Analysis to Sta?c Analysis Dynamic analysis approaches are based on sampling the input space Infer behavior

More information

Data Flow Analysis. Suman Jana. Adopted From U Penn CIS 570: Modern Programming Language Implementa=on (Autumn 2006)

Data Flow Analysis. Suman Jana. Adopted From U Penn CIS 570: Modern Programming Language Implementa=on (Autumn 2006) Data Flow Analysis Suman Jana Adopted From U Penn CIS 570: Modern Programming Language Implementa=on (Autumn 2006) Data flow analysis Derives informa=on about the dynamic behavior of a program by only

More information

Vulnerability Analysis (III): Sta8c Analysis

Vulnerability Analysis (III): Sta8c Analysis Computer Security Course. Vulnerability Analysis (III): Sta8c Analysis Slide credit: Vijay D Silva 1 Efficiency of Symbolic Execu8on 2 A Sta8c Analysis Analogy 3 Syntac8c Analysis 4 Seman8cs- Based Analysis

More information

Static Analysis! Summary of Dynamic Testing! Some References for Testing! Prof. Leon J. Osterweil! CS 520/620! Spring 2013! DEVELOPMENT PHASES!

Static Analysis! Summary of Dynamic Testing! Some References for Testing! Prof. Leon J. Osterweil! CS 520/620! Spring 2013! DEVELOPMENT PHASES! Requirements Spec. Design Static Analysis Prof. Leon J. Osterweil CS 50/60 Spring 0 Characteristics of System to be built must match required characteristics Test Results must match required behavior Hi

More information

Static Analysis! Prof. Leon J. Osterweil! CS 520/620! Spring 2013! Characteristics of! System to be! built must! match required! characteristics!

Static Analysis! Prof. Leon J. Osterweil! CS 520/620! Spring 2013! Characteristics of! System to be! built must! match required! characteristics! Static Analysis! Prof. Leon J. Osterweil! CS 50/60! Spring 01! Requirements Spec.! Design! Test Results must! match required behavior! Characteristics of! System to be! built must! match required! characteristics!

More information

Static Analysis! Prof. Leon J. Osterweil! CS 520/620! Fall 2012! Characteristics of! System to be! built must! match required! characteristics!

Static Analysis! Prof. Leon J. Osterweil! CS 520/620! Fall 2012! Characteristics of! System to be! built must! match required! characteristics! Static Analysis! Prof. Leon J. Osterweil! CS 520/620! Fall 2012! Requirements Spec.! Design! Test Results must! match required behavior! Characteristics of! System to be! built must! match required! characteristics!

More information

Sta$c Single Assignment (SSA) Form

Sta$c Single Assignment (SSA) Form Sta$c Single Assignment (SSA) Form SSA form Sta$c single assignment form Intermediate representa$on of program in which every use of a variable is reached by exactly one defini$on Most programs do not

More information

21-Analysis Overview. Announcements. CMPSCI520/620 Analysis Overview. Rick Adrion 2004 (except where noted) 1

21-Analysis Overview. Announcements. CMPSCI520/620 Analysis Overview. Rick Adrion 2004 (except where noted) 1 Announcements Revised Project 2 (minor) and new Project 3 posted Note: each group (on-campus) needs to arrange a design review during the period 11/29-12/7 No class on 12/6 (can be used for design review)

More information

Sta$c Analysis Dataflow Analysis

Sta$c Analysis Dataflow Analysis Sta$c Analysis Dataflow Analysis Roadmap Overview. Four Analysis Examples. Analysis Framework Soot. Theore>cal Abstrac>on of Dataflow Analysis. Inter- procedure Analysis. Taint Analysis. Overview Sta>c

More information

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts

Compiler Structure. Data Flow Analysis. Control-Flow Graph. Available Expressions. Data Flow Facts Compiler Structure Source Code Abstract Syntax Tree Control Flow Graph Object Code CMSC 631 Program Analysis and Understanding Fall 2003 Data Flow Analysis Source code parsed to produce AST AST transformed

More information

Review. Asser%ons. Some Per%nent Ques%ons. Asser%ons. Page 1. Automated Tes%ng. Path- Based Tes%ng. But s%ll need to look at execu%on results

Review. Asser%ons. Some Per%nent Ques%ons. Asser%ons. Page 1. Automated Tes%ng. Path- Based Tes%ng. But s%ll need to look at execu%on results Review Asser%ons Computer Science 521-621 Fall 2011 Prof. L. J. Osterweil Material adapted from slides originally prepared by Prof. L. A. Clarke Dynamic Tes%ng Execute program on real data and compare

More information

CISC327 - So*ware Quality Assurance

CISC327 - So*ware Quality Assurance CISC327 - So*ware Quality Assurance Lecture 12 Black Box Tes?ng CISC327-2003 2017 J.R. Cordy, S. Grant, J.S. Bradbury, J. Dunfield Black Box Tes?ng Outline Last?me we con?nued with black box tes?ng and

More information

Compiler Design. Fall Control-Flow Analysis. Prof. Pedro C. Diniz

Compiler Design. Fall Control-Flow Analysis. Prof. Pedro C. Diniz Compiler Design Fall 2015 Control-Flow Analysis Sample Exercises and Solutions Prof. Pedro C. Diniz USC / Information Sciences Institute 4676 Admiralty Way, Suite 1001 Marina del Rey, California 90292

More information

Lecture 4 Introduction to Data Flow Analysis

Lecture 4 Introduction to Data Flow Analysis Lecture 4 Introduction to Data Flow Analysis I. Structure of data flow analysis II. Example 1: Reaching definition analysis III. Example 2: Liveness analysis IV. Generalization What is Data Flow Analysis?

More information

Solve the Data Flow Problem

Solve the Data Flow Problem Gaining Condence in Distributed Systems Gleb Naumovich, Lori A. Clarke, and Leon J. Osterweil University of Massachusetts, Amherst Computer Science Department University of Massachusetts Amherst, Massachusetts

More information

CISC327 - So*ware Quality Assurance

CISC327 - So*ware Quality Assurance CISC327 - So*ware Quality Assurance Lecture 12 Black Box Tes?ng CISC327-2003 2017 J.R. Cordy, S. Grant, J.S. Bradbury, J. Dunfield Black Box Tes?ng Outline Last?me we con?nued with black box tes?ng and

More information

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015 CS 188: Ar)ficial Intelligence Constraint Sa)sfac)on Problems Sep 14, 2015 What is Search For? Assump)ons about the world: a single agent, determinis)c ac)ons, fully observed state, discrete state space

More information

Program Static Analysis. Overview

Program Static Analysis. Overview Program Static Analysis Overview Program static analysis Abstract interpretation Data flow analysis Intra-procedural Inter-procedural 2 1 What is static analysis? The analysis to understand computer software

More information

Design Principles & Prac4ces

Design Principles & Prac4ces Design Principles & Prac4ces Robert France Robert B. France 1 Understanding complexity Accidental versus Essen4al complexity Essen%al complexity: Complexity that is inherent in the problem or the solu4on

More information

Compiler Design. Fall Data-Flow Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Fall Data-Flow Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz Compiler Design Fall 2015 Data-Flow Analysis Sample Exercises and Solutions Prof. Pedro C. Diniz USC / Information Sciences Institute 4676 Admiralty Way, Suite 1001 Marina del Rey, California 90292 pedro@isi.edu

More information

Proofs about Programs

Proofs about Programs Proofs about Programs Program Verification (Rosen, Sections 5.5) TOPICS Program Correctness Preconditions & Postconditions Program Verification Assignment Statements Conditional Statements Loops Composition

More information

CSc 120. Introduc/on to Computer Programming II. 02: Problem Decomposi1on and Program Development. Adapted from slides by Dr.

CSc 120. Introduc/on to Computer Programming II. 02: Problem Decomposi1on and Program Development. Adapted from slides by Dr. CSc 120 Introduc/on to Computer Programming II Adapted from slides by Dr. Saumya Debray 02: Problem Decomposi1on and Program Development A common student lament "I have this big programming assignment.

More information

Intelligent Systems Knowledge Representa6on

Intelligent Systems Knowledge Representa6on Intelligent Systems Knowledge Representa6on SCJ3553 Ar6ficial Intelligence Faculty of Computer Science and Informa6on Systems Universi6 Teknologi Malaysia Outline Introduc6on Seman6c Network Frame Conceptual

More information

4/24/18. Overview. Program Static Analysis. Has anyone done static analysis? What is static analysis? Why static analysis?

4/24/18. Overview. Program Static Analysis. Has anyone done static analysis? What is static analysis? Why static analysis? Overview Program Static Analysis Program static analysis Abstract interpretation Static analysis techniques 2 What is static analysis? The analysis to understand computer software without executing programs

More information

ques4ons? Midterm Projects, etc. Path- Based Sta4c Analysis Sta4c analysis we know Example 11/20/12

ques4ons? Midterm Projects, etc. Path- Based Sta4c Analysis Sta4c analysis we know Example 11/20/12 Midterm Grades and solu4ons are (and have been) on Moodle The midterm was hard[er than I thought] grades will be scaled I gave everyone a 10 bonus point (already included in your total) max: 98 mean: 71

More information

2/18/14. Uses for Discrete Math in Computer Science. What is discrete? Why Study Discrete Math? Sets and Functions (Rosen, Sections 2.1,2.2, 2.

2/18/14. Uses for Discrete Math in Computer Science. What is discrete? Why Study Discrete Math? Sets and Functions (Rosen, Sections 2.1,2.2, 2. Why Study Discrete Math? Sets and Functions (Rosen, Sections 2.1,2.2, 2.3) TOPICS Discrete math Set Definition Set Operations Tuples Digital computers are based on discrete units of data (bits). Therefore,

More information

Analysis! Some Examples of Relations!

Analysis! Some Examples of Relations! Analysis! Testing and Analysis! Verification and Validation (V&V)! Reasoning! Relations and Analysis! A software product consists of! A collection of (types of) artifacts! Related to each other by myriad

More information

Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications

Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwa retest/ Design Specifications A design specification

More information

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2)

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) Lecture 2 White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) White- box Tes2ng (aka. Glass- box or structural tes2ng) An error may exist at one (or more) loca2on(s) Line numbers

More information

Equa%onal Reasoning of x86 Assembly Code. Kevin Coogan and Saumya Debray University of Arizona, Tucson, AZ

Equa%onal Reasoning of x86 Assembly Code. Kevin Coogan and Saumya Debray University of Arizona, Tucson, AZ Equa%onal Reasoning of x86 Assembly Code Kevin Coogan and Saumya Debray University of Arizona, Tucson, AZ Assembly Code is Source Code Commercial libraries oeen do not come with source code, but there

More information

Lexical analysis. Concepts. Lexical analysis in perspec>ve

Lexical analysis. Concepts. Lexical analysis in perspec>ve 4a Lexical analysis Concepts Overview of syntax and seman3cs Step one: lexical analysis Lexical scanning Regular expressions DFAs and FSAs Lex CMSC 331, Some material 1998 by Addison Wesley Longman, Inc.

More information

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 4 Consensus, I Mads Dam Autumn/Winter 2011 Slides: Much material due to M. Herlihy and R Wa8enhofer Last Lecture Shared

More information

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Dependence and Data Flow Models (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Why Data Flow Models? Models from Chapter 5 emphasized control Control flow graph, call graph, finite state machines We

More information

10/27/11. Is The Queue Correct? Concurrent Computaton. Objects. A Concurrent FIFO Queue head. A Concurrent FIFO Queue head

10/27/11. Is The Queue Correct? Concurrent Computaton. Objects. A Concurrent FIFO Queue head. A Concurrent FIFO Queue head DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 2 Concurrent Objects memory Concurrent Computaton Mads Dam Autumn/Winter 2011 object object Art of Mul/processor 2 Objects

More information

Thread-unsafe code. Synchronized blocks

Thread-unsafe code. Synchronized blocks Thread-unsafe code How can the following class be broken by mul6ple threads? 1 public class Counter { 2 private int c = 0; 3 4 public void increment() { int old = c; 5 6 c = old + 1; // c++; 7 8 public

More information

Compiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7

Compiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7 Compiler Optimizations Chapter 8, Section 8.5 Chapter 9, Section 9.1.7 2 Local vs. Global Optimizations Local: inside a single basic block Simple forms of common subexpression elimination, dead code elimination,

More information

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of

More information

Dataflow analysis (ctd.)

Dataflow analysis (ctd.) Dataflow analysis (ctd.) Available expressions Determine which expressions have already been evaluated at each point. A expression x+y is available at point p if every path from the entry to p evaluates

More information

Flow Analysis for Verifying Properties of Concurrent Software Systems

Flow Analysis for Verifying Properties of Concurrent Software Systems Flow Analysis for Verifying Properties of Concurrent Software Systems Matthew B. Dwyer Lori A. Clarke Gleb Naumovich Jamieson M. Cobleigh Department of Computing Department of Computer Department of Computer

More information

CSE Compilers. Reminders/ Announcements. Lecture 15: Seman9c Analysis, Part III Michael Ringenburg Winter 2013

CSE Compilers. Reminders/ Announcements. Lecture 15: Seman9c Analysis, Part III Michael Ringenburg Winter 2013 CSE 401 - Compilers Lecture 15: Seman9c Analysis, Part III Michael Ringenburg Winter 2013 Winter 2013 UW CSE 401 (Michael Ringenburg) Reminders/ Announcements Project Part 2 due Wednesday Midterm Friday

More information

Compiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7

Compiler Optimizations. Chapter 8, Section 8.5 Chapter 9, Section 9.1.7 Compiler Optimizations Chapter 8, Section 8.5 Chapter 9, Section 9.1.7 2 Local vs. Global Optimizations Local: inside a single basic block Simple forms of common subexpression elimination, dead code elimination,

More information

CS 406/534 Compiler Construction Putting It All Together

CS 406/534 Compiler Construction Putting It All Together CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy

More information

Topic: SQAK: Doing More with Keywords. Speaker: YINGJING YAN

Topic: SQAK: Doing More with Keywords. Speaker: YINGJING YAN Topic: SQAK: Doing More with Keywords Speaker: YINGJING YAN Why SQAK? Today s enterprise databases are large and complex, o=en rela>ng hundreds of en>>es. Enabling ordinary users to query such databases

More information

L6: System design: behavior models

L6: System design: behavior models L6: System design: behavior models Limita6ons of func6onal decomposi6on Behavior models State diagrams Flow charts Data flow diagrams En6ty rela6onship diagrams Unified Modeling Language Capstone design

More information

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2)

Lecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) Lecture 2 White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) White- box Tes2ng (aka. Glass- box or structural tes2ng) An error may exist at one (or more) loca2on(s) Line numbers

More information

Sequen&al Consistency and Linearizability

Sequen&al Consistency and Linearizability Sequen&al Consistency and Linearizability (Or, Reasoning About Concurrent Objects) Acknowledgement: Slides par&ally adopted from the companion slides for the book "The Art of Mul&processor Programming"

More information

Understanding Opera.onal Rou.ng (part II) Geoffrey Xie Naval Postgraduate School

Understanding Opera.onal Rou.ng (part II) Geoffrey Xie Naval Postgraduate School Understanding Opera.onal Rou.ng (part II) Geoffrey Xie Naval Postgraduate School July 6, 2011 Route Aggrega.on Child Route Unallocated Child Prefix: e.g., 10.1.33.0/24 19.1.1.2 Aggregate Route 10.1.1.0/24

More information

Modules and Representa/on Invariants

Modules and Representa/on Invariants Modules and Representa/on Invariants COS 326 David Walker Princeton University slides copyright 2017 David Walker permission granted to reuse these slides for non-commercial educa/onal purposes LAST TIME

More information

Related Course Objec6ves

Related Course Objec6ves Syntax 9/18/17 1 Related Course Objec6ves Develop grammars and parsers of programming languages 9/18/17 2 Syntax And Seman6cs Programming language syntax: how programs look, their form and structure Syntax

More information

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 2 Concurrent Objects Mads Dam Autumn/Winter 2011 Concurrent Computaton memory object object Art of Mul*processor 2 Objects

More information

Flow Analysis. Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM

Flow Analysis. Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM Flow Analysis Data-flow analysis, Control-flow analysis, Abstract interpretation, AAM Helpful Reading: Sections 1.1-1.5, 2.1 Data-flow analysis (DFA) A framework for statically proving facts about program

More information

CS: Formal Methods in Software Engineering

CS: Formal Methods in Software Engineering CS:5810 Formal Methods in So7ware Engineering Sets and Rela

More information

Virtual Memory B: Objec5ves

Virtual Memory B: Objec5ves Virtual Memory B: Objec5ves Benefits of a virtual memory system" Demand paging, page-replacement algorithms, and allocation of page frames" The working-set model" Relationship between shared memory and

More information

Overview. A mathema5cal proof technique Proves statements about natural numbers 0,1,2,... (or more generally, induc+vely defined objects) Merge Sort

Overview. A mathema5cal proof technique Proves statements about natural numbers 0,1,2,... (or more generally, induc+vely defined objects) Merge Sort Goals for Today Induc+on Lecture 22 Spring 2011 Be able to state the principle of induc+on Iden+fy its rela+onship to recursion State how it is different from recursion Be able to understand induc+ve proofs

More information

Bottom-Up Parsing. Lecture 11-12

Bottom-Up Parsing. Lecture 11-12 Bottom-Up Parsing Lecture 11-12 (From slides by G. Necula & R. Bodik) 9/22/06 Prof. Hilfinger CS164 Lecture 11 1 Bottom-Up Parsing Bottom-up parsing is more general than topdown parsing And just as efficient

More information

Control Flow Analysis

Control Flow Analysis Control Flow Analysis Last time Undergraduate compilers in a day Today Assignment 0 due Control-flow analysis Building basic blocks Building control-flow graphs Loops January 28, 2015 Control Flow Analysis

More information

Software Model Checking with Abstraction Refinement

Software Model Checking with Abstraction Refinement Software Model Checking with Abstraction Refinement Computer Science and Artificial Intelligence Laboratory MIT Armando Solar-Lezama With slides from Thomas Henzinger, Ranjit Jhala and Rupak Majumdar.

More information

CS370 Opera;ng Systems Midterm Review. Yashwant K Malaiya Spring 2018

CS370 Opera;ng Systems Midterm Review. Yashwant K Malaiya Spring 2018 CS370 Opera;ng Systems Midterm Review Yashwant K Malaiya Spring 2018 1 1 Computer System Structures Computer System Opera2on Stack for calling func2ons (subrou2nes) I/O Structure: polling, interrupts,

More information

CS370 OperaBng Systems

CS370 OperaBng Systems CS370 OperaBng Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 14 Deadlock Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ What happens if only one program

More information

CS101: Fundamentals of Computer Programming. Dr. Tejada www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++

CS101: Fundamentals of Computer Programming. Dr. Tejada www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++ CS101: Fundamentals of Computer Programming Dr. Tejada stejada@usc.edu www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++ 10 Stacks of Coins You have 10 stacks with 10 coins each that look and feel

More information

We can express this in dataflow equations using gen and kill sets, where the sets are now sets of expressions.

We can express this in dataflow equations using gen and kill sets, where the sets are now sets of expressions. Available expressions Suppose we want to do common-subexpression elimination; that is, given a program that computes x y more than once, can we eliminate one of the duplicate computations? To find places

More information

Why Data Flow Models? Dependence and Data Flow Models. Learning objectives. Def-Use Pairs (1) Models from Chapter 5 emphasized control

Why Data Flow Models? Dependence and Data Flow Models. Learning objectives. Def-Use Pairs (1) Models from Chapter 5 emphasized control Why Data Flow Models? Dependence and Data Flow Models Models from Chapter 5 emphasized control Control flow graph, call graph, finite state machines We also need to reason about dependence Where does this

More information

Compila(on /15a Lecture 6. Seman(c Analysis Noam Rinetzky

Compila(on /15a Lecture 6. Seman(c Analysis Noam Rinetzky Compila(on 0368-3133 2014/15a Lecture 6 Seman(c Analysis Noam Rinetzky 1 You are here Source text txt Process text input characters Lexical Analysis tokens Annotated AST Syntax Analysis AST Seman(c Analysis

More information

Review; questions Basic Analyses (2) Assign (see Schedule for links)

Review; questions Basic Analyses (2) Assign (see Schedule for links) Class 2 Review; questions Basic Analyses (2) Assign (see Schedule for links) Representation and Analysis of Software (Sections -5) Additional reading: depth-first presentation, data-flow analysis, etc.

More information

Data Flow Analysis. CSCE Lecture 9-02/15/2018

Data Flow Analysis. CSCE Lecture 9-02/15/2018 Data Flow Analysis CSCE 747 - Lecture 9-02/15/2018 Data Flow Another view - program statements compute and transform data So, look at how that data is passed through the program. Reason about data dependence

More information

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms

DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms DD2451 Parallel and Distributed Computing --- FDD3008 Distributed Algorithms Lecture 8 Leader Election Mads Dam Autumn/Winter 2011 Previously... Consensus for message passing concurrency Crash failures,

More information

Implementation of Lexical Analysis. Lecture 4

Implementation of Lexical Analysis. Lecture 4 Implementation of Lexical Analysis Lecture 4 1 Tips on Building Large Systems KISS (Keep It Simple, Stupid!) Don t optimize prematurely Design systems that can be tested It is easier to modify a working

More information

CSE Opera*ng System Principles

CSE Opera*ng System Principles CSE 30341 Opera*ng System Principles Overview/Introduc7on Syllabus Instructor: Chris*an Poellabauer (cpoellab@nd.edu) Course Mee*ngs TR 9:30 10:45 DeBartolo 101 TAs: Jian Yang, Josh Siva, Qiyu Zhi, Louis

More information

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,, CMPSCI 601: Recall From Last Time Lecture 5 Definition: A context-free grammar (CFG) is a 4- tuple, variables = nonterminals, terminals, rules = productions,,, are all finite. 1 ( ) $ Pumping Lemma for

More information

Automating Construction of Lexers

Automating Construction of Lexers Automating Construction of Lexers Regular Expression to Programs Not all regular expressions are simple. How can we write a lexer for (a*b aaa)? Tokenizing aaaab Vs aaaaaa Regular Expression Finite state

More information

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis CS 1622 Lecture 2 Lexical Analysis CS 1622 Lecture 2 1 Lecture 2 Review of last lecture and finish up overview The first compiler phase: lexical analysis Reading: Chapter 2 in text (by 1/18) CS 1622 Lecture

More information

A Compiler and Run- 1me System for Network Programming Languages

A Compiler and Run- 1me System for Network Programming Languages A Compiler and Run- 1me System for Network Programming Languages Christopher Monsanto, Princeton Nate Foster, Cornell Rob Harrison, West Point David Walker, Princeton 1 SoFware- Defined Networks Controller

More information

Func+on applica+ons (calls, invoca+ons)

Func+on applica+ons (calls, invoca+ons) Func%ons in Racket Racket Functions: most important building block in Racket (and 25) Functions/procedures/methods/subroutines abstract over computations Like Java methods, Python functions have arguments

More information

Compiler Optimization and Code Generation

Compiler Optimization and Code Generation Compiler Optimization and Code Generation Professor: Sc.D., Professor Vazgen Melikyan 1 Course Overview Introduction: Overview of Optimizations 1 lecture Intermediate-Code Generation 2 lectures Machine-Independent

More information

{HEADSHOT} In this lesson, we will look at the process that enables to leverage this source of real- world tes;ng data.

{HEADSHOT} In this lesson, we will look at the process that enables to leverage this source of real- world tes;ng data. {HEADSHOT} Despite our best efforts, even a9er extensive tes;ng, we as so9ware developers rarely put out bug- free code. In this lesson, we will look at a type of debugging technique used throughout the

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages h"p://www.di.unipi.it/~andrea/dida2ca/plp- 14/ Prof. Andrea Corradini Department of Computer Science, Pisa Lesson 11! Syntax- Directed Transla>on The Structure of the

More information

Volume Rendering, pt 1. Hank Childs, University of Oregon

Volume Rendering, pt 1. Hank Childs, University of Oregon Volume Rendering, pt 1 Hank Childs, University of Oregon Announcements No class Friday Grad students: No project 8G s8ll need to do short presenta8ons Come to OH and let s chat Plo$ng Techniques X- rays

More information

Writing a Fraction Class

Writing a Fraction Class Writing a Fraction Class So far we have worked with floa0ng-point numbers but computers store binary values, so not all real numbers can be represented precisely In applica0ons where the precision of real

More information

4 (c) parsing. Parsing. Top down vs. bo5om up parsing

4 (c) parsing. Parsing. Top down vs. bo5om up parsing 4 (c) parsing Parsing A grammar describes syntac2cally legal strings in a language A recogniser simply accepts or rejects strings A generator produces strings A parser constructs a parse tree for a string

More information

CSE Opera,ng System Principles

CSE Opera,ng System Principles CSE 30341 Opera,ng System Principles Lecture 5 Processes / Threads Recap Processes What is a process? What is in a process control bloc? Contrast stac, heap, data, text. What are process states? Which

More information

(Func&onal (Programming (in (Scheme)))) Jianguo Lu

(Func&onal (Programming (in (Scheme)))) Jianguo Lu (Func&onal (Programming (in (Scheme)))) Jianguo Lu 1 Programming paradigms Func&onal No assignment statement No side effect Use recursion Logic OOP AOP 2 What is func&onal programming It is NOT what you

More information

Remedial Java - Excep0ons 3/09/17. (remedial) Java. Jars. Anastasia Bezerianos 1

Remedial Java - Excep0ons 3/09/17. (remedial) Java. Jars. Anastasia Bezerianos 1 (remedial) Java anastasia.bezerianos@lri.fr Jars Anastasia Bezerianos 1 Disk organiza0on of Packages! Packages are just directories! For example! class3.inheritancerpg is located in! \remedialjava\src\class3\inheritencerpg!

More information

UNIT V: CENTRAL PROCESSING UNIT

UNIT V: CENTRAL PROCESSING UNIT UNIT V: CENTRAL PROCESSING UNIT Agenda Basic Instruc1on Cycle & Sets Addressing Instruc1on Format Processor Organiza1on Register Organiza1on Pipeline Processors Instruc1on Pipelining Co-Processors RISC

More information

- Ar$ficial Neural Network- ADALINE and MADALINE

- Ar$ficial Neural Network- ADALINE and MADALINE - Ar$ficial Neural Network- ADALINE and MADALINE ADALINE ADALINE (Adap$ve Linear Neuron) is a network model proposed by Bernard Widrow in 1959. X 1 X 2 single processing element... X 3 2 Training Rule

More information

BBM 101 Introduc/on to Programming I Fall 2013, Lecture 6-7

BBM 101 Introduc/on to Programming I Fall 2013, Lecture 6-7 BBM 101 Introduc/on to Programming I Fall 2013, Lecture 6-7 Instructors: Aykut Erdem, Erkut Erdem, Fuat Akal TAs: Yasin Sahin, Ahmet Selman Bozkir, Gultekin Isik, Oguzhan Guclu 1 Today Func/ons Defini@ons

More information

Compila(on Lecture 2: Lexical Analysis Syntax Analysis (1): CFLs, CFGs, PDAs. Noam Rinetzky

Compila(on Lecture 2: Lexical Analysis Syntax Analysis (1): CFLs, CFGs, PDAs. Noam Rinetzky Compila(on 0368-3133 Lecture 2: Lexical Analysis Syntax Analysis (1): CFLs, CFGs, PDAs Noam Rinetzky 1 2 3 What is a Compiler? source language target language Source text txt Executale code exe Compiler

More information

Bioinforma)cs Resources - NoSQL -

Bioinforma)cs Resources - NoSQL - Bioinforma)cs Resources - NoSQL - Lecture & Exercises Prof. B. Rost, Dr. L. Richter, J. Reeb Ins)tut für Informa)k I12 Short SQL Recap schema typed data tables defined layout space consump)on is computable

More information

Sec$on 6: Mutual Exclusion. Michelle Ku5el

Sec$on 6: Mutual Exclusion. Michelle Ku5el Sec$on 6: Mutual Exclusion Michelle Ku5el mku5el@cs.uct.ac.za Toward sharing resources (memory) Have been studying parallel algorithms using fork- join Lower span via parallel tasks Algorithms all had

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

Interprocedural Analysis. CS252r Fall 2015

Interprocedural Analysis. CS252r Fall 2015 Interprocedural Analysis CS252r Fall 2015 Procedures So far looked at intraprocedural analysis: analyzing a single procedure Interprocedural analysis uses calling relationships among procedures Enables

More information

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1

Dependence and Data Flow Models. (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Dependence and Data Flow Models (c) 2007 Mauro Pezzè & Michal Young Ch 6, slide 1 Why Data Flow Models? Models from Chapter 5 emphasized control Control flow graph, call graph, finite state machines We

More information

Formal Languages. Formal Languages

Formal Languages. Formal Languages Regular expressions Formal Languages Finite state automata Deterministic Non-deterministic Review of BNF Introduction to Grammars Regular grammars Formal Languages, CS34 Fall2 BGRyder Formal Languages

More information

Using Classical Planners for Tasks with Con5nuous Ac5ons in Robo5cs

Using Classical Planners for Tasks with Con5nuous Ac5ons in Robo5cs Using Classical Planners for Tasks with Con5nuous Ac5ons in Robo5cs Stuart Russell Joint work with Siddharth Srivastava, Lorenzo Riano, Pieter Abbeel Using Classical Planners for Tasks with Con5nuous Ac5ons

More information

We can express this in dataflow equations using gen and kill sets, where the sets are now sets of expressions.

We can express this in dataflow equations using gen and kill sets, where the sets are now sets of expressions. Available expressions Suppose we want to do common-subexpression elimination; that is, given a program that computes x y more than once, can we eliminate one of the duplicate computations? To find places

More information

Introduction to Machine-Independent Optimizations - 4

Introduction to Machine-Independent Optimizations - 4 Introduction to Machine-Independent Optimizations - 4 Department of Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Principles of Compiler Design Outline of

More information

Formal Verification! Prof. Leon Osterweil! Computer Science 520/620! Spring 2012!

Formal Verification! Prof. Leon Osterweil! Computer Science 520/620! Spring 2012! Formal Verification Prof. Leon Osterweil Computer Science 520/620 Spring 2012 Relations and Analysis A software product consists of A collection of (types of) artifacts Related to each other by myriad

More information

CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution

CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution Exam Facts Format Wednesday, July 20 th from 11:00 a.m. 1:00 p.m. in Gates B01 The exam is designed to take roughly 90

More information

Founda'ons of So,ware Engineering. Sta$c analysis (1/2) Claire Le Goues

Founda'ons of So,ware Engineering. Sta$c analysis (1/2) Claire Le Goues Founda'ons of So,ware Engineering Sta$c analysis (1/2) Claire Le Goues 1 Two fundamental concepts Abstrac'on. Elide details of a specific implementa$on. Capture seman$cally relevant details; ignore the

More information