Static Analysis of Programs: A Heap-Centric View
|
|
- Victor Spencer
- 5 years ago
- Views:
Transcription
1 Static Analysis of Programs: A Heap-Centric View ( uday) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay 5 April 2008
2 Part 1 Introduction
3 ETAPS 08 Static Analysis: Introduction 1/140 Copyright A large part of these slides are based on the following material: 1., Amitabha Sanyal, and Amey Karkare. Heap Reference Analysis Using Access Graphs. ACM Transactions on Programming Languages and Systems, 30(1), Nov , Amitabha Sanyal, and Bageshri Karkare. Data Flow Analysis: Theory and Practice. CRC Press USA. (Under Publication) 3.. Data Flow Analysis. In The Compiler Design Handbook. Editors: Priti Shankar and Y. N. Srikant. CRC Press USA (2) is not yet published and the copyrights are reserved by the authors. The copyright for (1) is held by ACM and that for (3) is held by CRC Press USA. These slides may be used only for academic purposes.
4 ETAPS 08 Static Analysis: Introduction 2/140 Outline Motivation: The need of heap data flow analysis Formulating data flow analysis Mathematical foundations of data flow analysis The set of data flow values The set of flow functions Solutions of data flow analyses Algorithms for performing data flow analysis Complexity of data flow analysis Data flow analysis for heap references Conclusions
5 Part 2 Motivation
6 ETAPS 08 Static Analysis: Motivation 3/140 Motivation Heap memory allocation Limitations of garbage collection Optimization to improve garbage collection
7 ETAPS 08 Static Analysis: Motivation 4/140 Standard Memory Architecture of Programs Static Data Heap allocation provides the flexibility of Stack Variable Sizes. Data structures can grow or shrink as desired at runtime. (Not bound to the declarations in program.) Heap Code Variable Lifetimes. Data structures can be created and destroyed as desired at runtime. (Not bound to the activations of procedures.)
8 ETAPS 08 Static Analysis: Motivation 5/140 Managing Heap Memory Decision 1: When to Allocate? Explicit. Specified in the programs. (eg. Imperative/OO languages) Implicit. Decided by the language processors. (eg. Declarative Languages)
9 ETAPS 08 Static Analysis: Motivation 5/140 Managing Heap Memory Decision 1: When to Allocate? Explicit. Specified in the programs. (eg. Imperative/OO languages) Implicit. Decided by the language processors. (eg. Declarative Languages) Decision 2: When to Deallocate? Explicit. Manual Memory Management (eg. C/C++) Implicit. Automatic Memory Management aka Garbage Collection (eg. Java/Declarative languages)
10 ETAPS 08 Static Analysis: Motivation 6/140 State of Art in Manual Deallocation Memory leaks 10% to 20% of last development effort goes in plugging leaks Tool assisted manual plugging Purify, Electric Fence, RootCause, GlowCode, yaktest, Leak Tracer, BDW Garbage Collector, mtrace, memwatch, dmalloc etc. All leak detectors are dynamic (and hence specific to execution instances) generate massive reports to be perused by programmers usually do not locate last use but only allocation escaping a call At which program point should a leak be plugged?
11 ETAPS 08 Static Analysis: Motivation 7/140 Garbage Collection Automatic Deallocation Retain active data structure. Deallocate inactive data structure. What is an Active Data Structure?
12 ETAPS 08 Static Analysis: Motivation 7/140 Garbage Collection Automatic Deallocation Retain active data structure. Deallocate inactive data structure. What is an Active Data Structure? If an object does not have an access path, (i.e. it is unreachable) then its memory can be reclaimed.
13 ETAPS 08 Static Analysis: Motivation 7/140 Garbage Collection Automatic Deallocation Retain active data structure. Deallocate inactive data structure. What is an Active Data Structure? If an object does not have an access path, (i.e. it is unreachable) then its memory can be reclaimed. What if an object has an access path, but is not accessed after the given program point?
14 ETAPS 08 Static Analysis: Motivation 8/140 What is Garbage? Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data Garbage z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
15 ETAPS 08 Static Analysis: Motivation 8/140 What is Garbage? False Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data Garbage z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
16 ETAPS 08 Static Analysis: Motivation 8/140 What is Garbage? True Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data Garbage z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
17 ETAPS 08 Static Analysis: Motivation 8/140 What is Garbage? Garbage 1 w = x // x points to m a 2 if (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data Garbage z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o All white nodes are unused and should be considered garbage
18 ETAPS 08 Static Analysis: Motivation 9/140 Is Reachable Same as Live? From live (also known as alive, active) : Memory(2) or an object is live if the program will read from it in future. The term is often used more broadly to mean reachable. It is not possible, in general, for garbage collectors to determine exactly which objects are still live. Instead, they use some approximation to detect objects that are provably dead, such as those that are not reachable. Similar terms: reachable. Opposites: dead. See also: undead.
19 ETAPS 08 Static Analysis: Motivation 10/140 Is Reachable Same as Live? Not really. Most of us know that. Even with the state of art of garbage collection, 24% to 76% unused memory remains unclaimed Yet we have no way of distinguishing. Over a dozen reported approaches (since 1996), no real success.
20 ETAPS 08 Static Analysis: Motivation 11/140 Cedar Mesa Folk Wisdom Make the unused memory unreachable by setting references to NULL. (GC FAQ: z x w y p a q rptr lptr b i X lptr X lptr c f j m rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o Stack Heap
21 ETAPS 08 Static Analysis: Motivation 11/140 Cedar Mesa Folk Wisdom Make the unused memory unreachable by setting references to NULL. (GC FAQ: z x w y p a q rptr lptr b i lptr lptr c f j m rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o Stack Heap
22 ETAPS 08 Static Analysis: Motivation 12/140 Cedar Mesa Folk Wisdom Most promising, simplest to understand, yet the hardest to implement. Which references should be set to NULL? Most approaches rely on feedback from profiling. No systematic and clean solution.
23 ETAPS 08 Static Analysis: Motivation 13/140 Distinguishing Between Reachable and Live The state of art Eliminating objects reachable from root variables which are not live. Implemented in current Sun JVMs. Uses liveness data flow analysis of root variables (stack data). What about liveness of heap data?
24 ETAPS 08 Static Analysis: Motivation 14/140 Liveness of Stack Data 1 w = x // x points to m a 2 while (x.data < max) Heap 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr w x y z Stack 7 z.sum = x.data + y.data if changed to while
25 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) x = x.rptr y = x.lptr z = New class of z y = y.lptr z.sum = x.data + y.data No variable is used beyond this program point w x y z
26 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) x = x.rptr y = x.lptr z = New class of z Current values of x, y, and z are used beyond this program point y = y.lptr z.sum = x.data + y.data w x y z Live Dead
27 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) y = x.lptr x = x.rptr Current values of x, y, and z are used beyond this program point The value of y is different before and after the assignment to y z = New class of z w x y z y = y.lptr z.sum = x.data + y.data
28 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) y = x.lptr x = x.rptr The current values of x and y are used beyond this program point The current value of z is not used beyond this program point w x y z z = New class of z y = y.lptr z.sum = x.data + y.data
29 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) x = x.rptr y = x.lptr z = New class of z y = y.lptr w x y z The current values of x is used beyond this program point Current values of y and z are not used beyond this program point z.sum = x.data + y.data
30 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) x = x.rptr w x y z y = x.lptr z = New class of z y = y.lptr Nothing is known as of now Some information will be available in the next iteration point z.sum = x.data + y.data
31 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) y = x.lptr x = x.rptr z = New class of z w x y z Current value of x is used beyond this program point However its value is different before and after the assignment y = y.lptr z.sum = x.data + y.data
32 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) x = x.rptr y = x.lptr z = New class of z w x y z Current value of x is used beyond this program point There are two control flow paths beyond this program point y = y.lptr z.sum = x.data + y.data
33 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x while (x.data < max) w x y z x = x.rptr Current value of x is used beyond this program point y = x.lptr z = New class of z y = y.lptr z.sum = x.data + y.data
34 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x w x y z while (x.data < max) Current value of x is used beyond this program point x = x.rptr y = x.lptr z = New class of z y = y.lptr z.sum = x.data + y.data
35 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x w x y z w x y z while (x.data < max) x = x.rptr y = x.lptr z = New class of z y = y.lptr z.sum = x.data + y.data w x y z w x y z w x y z w x y z w x y z w x y z w x y z w x y z End of iteration #1 Live Dead
36 ETAPS 08 Static Analysis: Motivation 15/140 Liveness of Stack Data w = x w x y z w x y z while (x.data < max) x = x.rptr y = x.lptr z = New class of z y = y.lptr z.sum = x.data + y.data w x y z w x y z w x y z w x y z w x y z w x y z w x y z w x y z End of iteration #2 Live Dead
37 ETAPS 08 Static Analysis: Motivation 16/140 Applying Cedar Mesa Folk Wisdom to Heap Data Liveness Analysis of Heap Data If the while loop is not executed even once. 1 w = x // x points to m a 2 while (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data z x w y p a q rptr lptr b i rptr lptr rptr lptr c f j m rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o Stack Heap
38 ETAPS 08 Static Analysis: Motivation 16/140 Applying Cedar Mesa Folk Wisdom to Heap Data Liveness Analysis of Heap Data If the while loop is executed once. 1 w = x // x points to m a 2 while (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data z x w y p a q rptr lptr b i rptr lptr rptr lptr c f j m rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o Stack Heap
39 ETAPS 08 Static Analysis: Motivation 16/140 Applying Cedar Mesa Folk Wisdom to Heap Data Liveness Analysis of Heap Data If the while loop is executed twice. 1 w = x // x points to m a 2 while (x.data < max) 3 x = x.rptr 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data z x w y p a q rptr lptr b i rptr lptr rptr lptr c f j m rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o Stack Heap
40 ETAPS 08 Static Analysis: Motivation 17/140 The Moral of the Story Mappings between access expressions and l-values keep changing This is a rule for heap data For stack and static data, it is an exception! Static analysis of programs has made significant progress for stack and static data. What about heap data? Given two access expressions at a program point, do they have the same l-value? Given the same access expression at two program points, does it have the same l-value?
41 ETAPS 08 Static Analysis: Motivation 18/140 Our Solution 1 w = x 2 while (x.data < max) y = z = null w = null { x.lptr = null 3 x = x.rptr } 4 y = x.lptr 5 z = New class of z 6 y = y.lptr 7 z.sum = x.data + y.data x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null z.lptr = z.rptr = null y.lptr = y.rptr = null x = y = z = null
42 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
43 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
44 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
45 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
46 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q rptr lptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
47 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q rptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
48 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null While loop is not executed even once z x w y Stack p a q b i rptr lptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr d e g h k l n o
49 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null z x w y Stack While loop is executed once p a q rptr b i rptr lptr c f j m Heap rptr lptr lptr rptr lptr rptr lptr d e g h k l n o
50 ETAPS 08 Static Analysis: Motivation 19/140 Our Solution y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null z x w y Stack While loop is executed twice p a q rptr b i rptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr d e g h k l n o
51 ETAPS 08 Static Analysis: Motivation 20/140 Some Observations y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null Node i is live but link a i is nullified z x w y Stack p a q rptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
52 ETAPS 08 Static Analysis: Motivation 20/140 Some Observations y = z = null 1 w = x w = null 2 while (x.data < max) { x.lptr = null 3 x = x.rptr } x.rptr = x.lptr.rptr = null x.lptr.lptr.lptr = null x.lptr.lptr.rptr = null 4 y = x.lptr x.lptr = y.rptr = null y.lptr.lptr = y.lptr.rptr = null 5 z = New class of z z.lptr = z.rptr = null 6 y = y.lptr y.lptr = y.rptr = null 7 z.sum = x.data + y.data x = y = z = null New access expressions are created. Can they cause exceptions? z x w y Stack p a q rptr b i rptr lptr rptr lptr c f j m Heap rptr lptr rptr lptr rptr lptr rptr lptr d e g h k l n o
53 ETAPS 08 Static Analysis: Motivation 21/140 Goals of This Tutorial Main Goal: Explain how to get the modified program Side goals:
54 ETAPS 08 Static Analysis: Motivation 21/140 Goals of This Tutorial Main Goal: Explain how to get the modified program Side goals: Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms Explain the intuitions Relate them to mathematical rigour Highlight the frontiers
55 Part 3 Formulating Data Flow Analysis
56 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 22/140 Formulating Data Flow Analysis Live variables analysis and available expressions analysis Local and global data flow properties Common form of data flow equations
57 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 23/140 Live Variables Analysis A variable v is live at a program point p, if some path from p to program exit contains an r-value occurrence of v which is not preceded by an l-value occurrence of v. Entry Entry Entry v =a b p v =a b p p Exit a=v +2 Exit v =a+2 Exit v =v = v +2+ 2
58 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 23/140 Live Variables Analysis A variable v is live at a program point p, if some path from p to program exit contains an r-value occurrence of v which is not preceded by an l-value occurrence of v. v is live at p Entry Entry Entry v =a b p v =a b p p Exit a=v +2 Exit v =a+2 Exit v =v = v +2+ 2
59 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 23/140 Live Variables Analysis A variable v is live at a program point p, if some path from p to program exit contains an r-value occurrence of v which is not preceded by an l-value occurrence of v. v is live at p Entry v is not live at p Entry Entry v =a b p v =a b p p Exit a=v +2 Exit v =a+2 Exit v =v = v +2+ 2
60 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 23/140 Live Variables Analysis A variable v is live at a program point p, if some path from p to program exit contains an r-value occurrence of v which is not preceded by an l-value occurrence of v. v is live at p v is not live at p v is live at p Entry Entry Entry v =a b p v =a b p p Exit a=v +2 Exit v =a+2 Exit v =v = v +2+ 2
61 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 23/140 Live Variables Analysis A variable v is live at a program point p, if some path from p to program exit contains an r-value occurrence of v which is not preceded by an l-value occurrence of v. Path based specification v is live at p v is not live at p v is live at p Entry Entry Entry v =a b p v =a b p p Exit a=v +2 Exit v =a+2 Exit v =v = v +2+ 2
62 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 24/140 Defining Data Flow Analysis for Live Variables Analysis LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j
63 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 24/140 Defining Data Flow Analysis for Live Variables Analysis Basic Blocks Single statements or Maximal groups of sequentially executed statements LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j
64 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 24/140 Defining Data Flow Analysis for Live Variables Analysis Basic Blocks Single statements or Maximal groups of sequentially executed statements LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j Control Transfer
65 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 24/140 Defining Data Flow Analysis for Live Variables Analysis LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j
66 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 24/140 Defining Data Flow Analysis for Live Variables Analysis LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j Local Data Flow Properties
67 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 25/140 Local Data Flow Properties for Live Variables Analysis LGen b = { v variable v is used in basic block b and is not preceded by a definition of v } LKill b = { v basic block b contains a definition of v }
68 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 25/140 Local Data Flow Properties for Live Variables Analysis r-value occurrence Value is only read, e.g. x,y,z in x.sum = y.data + z.data LGen b = { v variable v is used in basic block b and is not preceded by a definition of v } LKill b = { v basic block b contains a definition of v }
69 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 25/140 Local Data Flow Properties for Live Variables Analysis l-value occurrence r-value occurrence Value is modified e.g. y in Value is only read, e.g. x,y,z in y = x.lptr x.sum = y.data + z.data LGen b = { v variable v is used in basic block b and is not preceded by a definition of v } LKill b = { v basic block b contains a definition of v }
70 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 25/140 Local Data Flow Properties for Live Variables Analysis l-value occurrence r-value occurrence Value is modified e.g. y in Value is only read, e.g. x,y,z in y = x.lptr x.sum = y.data + z.data LGen b = { v variable v is used in basic block b and is not preceded by a definition of v } LKill b = { v basic block b contains a definition of v } within b
71 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 25/140 Local Data Flow Properties for Live Variables Analysis l-value occurrence r-value occurrence Value is modified e.g. y in Value is only read, e.g. x,y,z in y = x.lptr x.sum = y.data + z.data LGen b = { v variable v is used in basic block b and is not preceded by a definition of v } LKill b = { v basic block b contains a definition of v } within b anywhere in b
72 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 26/140 Defining Data Flow Analysis for Live Variables Analysis LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j
73 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 26/140 Defining Data Flow Analysis for Live Variables Analysis Global Data Flow Properties LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j
74 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 26/140 Defining Data Flow Analysis for Live Variables Analysis Global Data Flow Properties Edge based specifications LIn k = LGen k (LOut k LKill k ) LGen k, LKill k LOut k = LIn i LIn j LIn i LGen i, LKill i LOut i LIn j LGen j, LKill j LOut j
75 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 27/140 Data Flow Equations For Live Variables Analysis LIn b = LGen b (LOut b LKill b ) LOut b = s succ(b) LIn s b is the exit node otherwise
76 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 27/140 Data Flow Equations For Live Variables Analysis LIn b = LGen b (LOut b LKill b ) LOut b = s succ(b) LIn s b is the exit node otherwise Alternatively, LIn b = f b (LOut b ), where f b (X) = LGen b (X LKill b )
77 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 27/140 Data Flow Equations For Live Variables Analysis LIn b = LGen b (LOut b LKill b ) LOut b = s succ(b) LIn s b is the exit node otherwise Alternatively, LIn b = f b (LOut b ), where f b (X) = LGen b (X LKill b ) LIn b and LOut b are sets of variables.
78 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) LGen={x}, LKill = {y} y = x.lptr LGen={x}, LKill = {x} x = x.rptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen ={x,y, z},lkill = z.sum = x.data + y.data
79 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) LGen={x}, LKill = {y} y = x.lptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen={x}, LKill = {x} x = x.rptr LGen and LKill need not be mutually exclusive LGen ={x,y, z},lkill = z.sum = x.data + y.data
80 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) LGen={x}, LKill = {y} y = x.lptr LGen={x}, LKill = {x} x = x.rptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen ={x,y, z},lkill = z.sum = x.data + y.data z is an r-value occurrence and not an l-value occurrence
81 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) LGen={x}, LKill = {y} y = x.lptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen ={x,y, z},lkill = z.sum = x.data + y.data LGen={x}, LKill = {x} x = x.rptr x,y, z are considered to be used based purely on local use even if the value of z is not use later. A different analysis called faint variables analysis improves on this.
82 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) LGen={x}, LKill = {y} y = x.lptr LGen={x}, LKill = {x} x = x.rptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen ={x,y, z},lkill = z.sum = x.data + y.data Initialization
83 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis {x} {x,y} {x,y} {x,y,z} {x,y,z} {x,y,z} {x,y,z} {x} {x} {x} {x} LGen={x}, LKill = {y} y = x.lptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen ={x,y, z},lkill = z.sum = x.data + y.data LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) {x} LGen={x}, LKill = {x} x = x.rptr Iteration #1 Traversal
84 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 28/140 Performing Live Variables Analysis {x} {x,y} {x,y} {x,y,z} {x,y,z} {x,y,z} {x,y,z} {x} {x} {x} {x} LGen={x}, LKill = {y} y = x.lptr LGen=, LKill = {z} z = New class of z LGen ={y}, LKill = {y} y = y.lptr LGen ={x,y, z},lkill = z.sum = x.data + y.data LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) {x} {x,y} {x,y} {x,y,z} {x,y,z} {x,y,z} {x,y,z} {x} {x} {x} {x} {x} LGen={x}, LKill = {x} x = x.rptr Iteration #1 #2 {x} {x} Traversal
85 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 29/140 Performing Live Variables Analysis LGen ={x}, LKill = {w} w = x LGen ={x}, LKill = while (x.data < max) LGen={x}, LKill = {y,z} y = x.lptr z = New class of z y = y.lptr z.sum = x.data + y.data LGen={x}, LKill = {x} x = x.rptr
86 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 30/140 Available Expressions Analysis An expression e is available at a program point p, if every path from program entry to p contains an evaluation of e which is not followed by a definition of any operand of e. Entry Entry Entry a b a b a b a b a b a b a = a b a b p p p Exit Exit Exit
87 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 30/140 Available Expressions Analysis An expression e is available at a program point p, if every path from program entry to p contains an evaluation of e which is not followed by a definition of any operand of e. a b is available at p Entry Entry Entry a b a b a b a b a b a b a = a b a b p p p Exit Exit Exit
88 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 30/140 Available Expressions Analysis An expression e is available at a program point p, if every path from program entry to p contains an evaluation of e which is not followed by a definition of any operand of e. a b is available at p Entry a b is not available at p Entry Entry a b a b a b a b a b a b a = a b a b p p p Exit Exit Exit
89 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 30/140 Available Expressions Analysis An expression e is available at a program point p, if every path from program entry to p contains an evaluation of e which is not followed by a definition of any operand of e. a b is available at p a b Entry a b a b is not available at p a b Entry a b a b is not available at p a b Entry a b a = a b a b p p p Exit Exit Exit
90 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 31/140 Local Data Flow Properties for Available Expressions Analysis AGen b = { e expression e is evaluated in basic block b and this evaluation is not followed by a definition of any operand of e} AKill b = { e basic block b contains a definition of an operand of e}
91 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 32/140 Data Flow Equations For Available Expressions Analysis AIn b = AOut p p pred(b) AOut b = AGen b (AIn b AKill b ) b is the entry node otherwise
92 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 32/140 Data Flow Equations For Available Expressions Analysis AIn b = AOut p p pred(b) AOut b = AGen b (AIn b AKill b ) b is the entry node otherwise Alternatively, AOut b = f b (AIn b ), where f b (X) = AGen b (X AKill b )
93 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 32/140 Data Flow Equations For Available Expressions Analysis AIn b = AOut p p pred(b) AOut b = AGen b (AIn b AKill b ) b is the entry node otherwise Alternatively, AOut b = f b (AIn b ), where f b (X) = AGen b (X AKill b ) AIn b and AOut b are sets of expressions.
94 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 33/140 An Example of Available Expressions Analysis 1 a b b c 1 Let e 1 a b, e 2 b c, e 3 c d, e 4 d e 2 c d 2 3 c = d = d e a b 5 Node Computed Killed Available Redund. 1 {e 1,e 2 } {e 3 } {e 1 } {e 2,e 3 } 0110 {e 1,e 3 } {e 3,e 4 } 0011 {e 1,e 3 } {e 1,e 4 } {e 1 } 1000 {e 1 } {e 4 } {e 1,e 4 } 1001 {e 4 } d e 6
95 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 33/140 An Example of Available Expressions Analysis Initialisation a b b c c d c = d = d e 5 a b d e Node Let e 1 a b, e 2 b c, e 3 c d, e 4 d e Computed Killed Available Redund. 1 {e 1,e 2 } {e 3 } {e 1 } {e 2,e 3 } 0110 {e 1,e 3 } {e 3,e 4 } 0011 {e 1,e 3 } {e 1,e 4 } {e 1 } 1000 {e 1 } {e 4 } {e 1,e 4 } 1001 {e 4 } 0001
96 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 33/140 An Example of Available Expressions Analysis Iteration # a b b c c d c = d = d e 5 a b d e Node Let e 1 a b, e 2 b c, e 3 c d, e 4 d e Computed Killed Available Redund. 1 {e 1,e 2 } {e 3 } {e 1 } {e 2,e 3 } 0110 {e 1,e 3 } {e 3,e 4 } 0011 {e 1,e 3 } {e 1,e 4 } {e 1 } 1000 {e 1 } {e 4 } {e 1,e 4 } 1001 {e 4 } 0001
97 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 33/140 An Example of Available Expressions Analysis Iteration # a b b c c d c = d = d e 5 a b d e Node Let e 1 a b, e 2 b c, e 3 c d, e 4 d e Computed Killed Available Redund. 1 {e 1,e 2 } {e 3 } {e 1 } {e 2,e 3 } 0110 {e 1,e 3 } {e 3,e 4 } 0011 {e 1,e 3 } {e 1,e 4 } {e 1 } 1000 {e 1 } {e 4 } {e 1,e 4 } 1001 {e 4 } 0001
98 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 33/140 An Example of Available Expressions Analysis Final Result a b b c c d c = d = d e 5 a b d e Node Let e 1 a b, e 2 b c, e 3 c d, e 4 d e Computed Killed Available Redund. 1 {e 1,e 2 } {e 3 } {e 1 } {e 2,e 3 } 0110 {e 1,e 3 } {e 3,e 4 } 0011 {e 1,e 3 } {e 1,e 4 } {e 1 } 1000 {e 1 } {e 4 } {e 1,e 4 } 1001 {e 4 } 0001
99 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination.
100 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination. If an expression is available at the entry of a block b and
101 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination. If an expression is available at the entry of a block b and a computation of the expression exists in b such that
102 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination. If an expression is available at the entry of a block b and a computation of the expression exists in b such that it is not preceded by a definition of any of its operands
103 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination. If an expression is available at the entry of a block b and a computation of the expression exists in b such that it is not preceded by a definition of any of its operands Then the expression is redundant.
104 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination. If an expression is available at the entry of a block b and a computation of the expression exists in b such that it is not preceded by a definition of any of its operands Then the expression is redundant. Expression must be upwards exposed or locally anticipable.
105 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 34/140 Using Data Flow Information Available Expressions Analysis. Used for common subsexpression elimination. If an expression is available at the entry of a block b and a computation of the expression exists in b such that it is not preceded by a definition of any of its operands Then the expression is redundant. Expression must be upwards exposed or locally anticipable. Expressions in Gen b are downwards exposed.
106 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 35/140 Using Data Flow Information Live Variables Analysis. Used for register allocation. If variable x is live in a basic block b, it is a potential candidate for register allocation.
107 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 35/140 Using Data Flow Information Live Variables Analysis. Used for register allocation. If variable x is live in a basic block b, it is a potential candidate for register allocation. Used for dead code elimination. If variable x is not live after an assignment x =..., then the assginment is redundant and can be deleted as dead code.
108 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 36/140 Reaching Definitions Analysis A definition d x : x = y reaches a program point u if it appears (without a refefinition of x) on some path from program entry to u Application : Copy Propagation A use of a variable x at a program point u can be replaced by y if d x : x = y is the only definition which reaches p and y is not modified between the point of d x and p.
109 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 37/140 Defining Data Flow Analysis for Reaching Definitions Analysis Let d v be a definition of variable v Gen b = { d v variable v is defined in basic block b and this definition is not followed (within b) by a definition of v} Kill b = { d v basic block b contains a definition of v}
110 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 38/140 Data Flow Equations for Reaching Definitions Analysis IN b = {} b is the entry node OUT p otherwise p pred(b) OUT b = Gen b (IN b Kill b ) IN b and OUT b are sets of definitions
111 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 39/140 Very Busy Expressions Analysis An expression e is very busy at a program point u, if every path from u to the program exit contains an evaluation of e which is not preceded by a redefinition of any operand of e. Application : Safety of Code Motion
112 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 40/140 Safety of Code Motion 1 if (b == 0) 1 False True 2 c = a/b 2 3 c = a/b 3 Expression a/b is not very busy at the exit of 1. Moving a/b to the exit of 1 is unsafe.
113 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 41/140 Defining Data Flow Analysis for Very Busy Expressions Analysis Gen b = { e expression e is evaluated in basic block b and this evaluation is not preceded (within b) by a definition of any operand of e} Kill b = { e basic block b contains a definition of an operand of e}
114 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 42/140 Data Flow Equations for Very Busy Expressions Analysis IN b = Gen b (OUT b Kill b ) {} b is the exit node OUT b = IN s otherwise a succ(b) IN b and OUT b are sets of expressions
115 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 43/140 Common Form of Data Flow Equations X i = f (Y i ) Y i = X j
116 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 43/140 Common Form of Data Flow Equations Data Flow Information So far we have seen sets (or bit vectors). Could be entities other than sets. X i = f (Y i ) Y i = X j
117 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 43/140 Common Form of Data Flow Equations Data Flow Information So far we have seen sets (or bit vectors). Could be entities other than sets. X i = f (Y i ) Flow Function Y i = X j
118 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 43/140 Common Form of Data Flow Equations Data Flow Information So far we have seen sets (or bit vectors). Could be entities other than sets. X i = f (Y i ) Flow Function Y i = X j Confluence So far we have seen and. Could be other operations.
119 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 44/140 A Taxonomy of Bit Vector Data Flow Frameworks Confluence Union Intersection Forward Reaching Definitions Available Expressions Backward Live Variables Anticipable Exressions Bidirectional Partial Redundancy Elimination (limited) (Original M-R Formulation)
120 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 44/140 A Taxonomy of Bit Vector Data Flow Frameworks Any Path Confluence Union Intersection Forward Reaching Definitions Available Expressions Backward Live Variables Anticipable Exressions Bidirectional Partial Redundancy Elimination (limited) (Original M-R Formulation)
121 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 44/140 A Taxonomy of Bit Vector Data Flow Frameworks Any Path All Paths Confluence Union Intersection Forward Reaching Definitions Available Expressions Backward Live Variables Anticipable Exressions Bidirectional Partial Redundancy Elimination (limited) (Original M-R Formulation)
122 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 44/140 A Taxonomy of Bit Vector Data Flow Frameworks Any Path All Paths Confluence Union Intersection Forward Reaching Definitions Available Expressions Backward Live Variables Anticipable Exressions Bidirectional Partial Redundancy Elimination (limited) (Original M-R Formulation)
123 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 44/140 A Taxonomy of Bit Vector Data Flow Frameworks Any Path All Paths Confluence Union Intersection Forward Reaching Definitions Available Expressions Backward Live Variables Anticipable Exressions Bidirectional Partial Redundancy Elimination (limited) (Original M-R Formulation)
124 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 44/140 A Taxonomy of Bit Vector Data Flow Frameworks Any Path All Paths Confluence Union Intersection Forward Reaching Definitions Available Expressions Backward Live Variables Anticipable Exressions Bidirectional Partial Redundancy Elimination (limited) (Original M-R Formulation)
125 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 n 2 c = a + b d = a b n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3
126 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN n 1 n 2 c = a + b d = a b n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3
127 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 n 2 c = a + b d = a b n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3
128 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 n 2 c = a + b d = a b n 2 1, 2, 3, 2 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3
129 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 1, 2, 3, 2 n 2 n 2 c = a + b d = a b n 2 2, 1, 3, 2 n 3 d = c 1 a = 2 n 3 b = 1 c = a + b n 3
130 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 1, 2, 3, 2 n 2 n 2 c = a + b d = a b n 2 2, 1, 3, 2 n 3 2, 1, 3, 2 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3
131 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 1, 2, 3, 2 n 2 n 2 c = a + b d = a b n 2 2, 1, 3, 2 n 3 2, 1, 3, 2 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 n 3
132 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 1, 2, 3, 2 n 2 n 2 c = a + b d = a b n 2 2, 1, 3, 2 n 3 2, 1, 3, 2 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2
133 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 1, 2, 3, 2 n 2 n 2 c = a + b d = a b n 2 2, 1, 3, 2 n 3 2, 1, 3, 2 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
134 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b Summary Values?,?,?,? n 1 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT n 1 1, 2, 3, 2 n 2 n 2 c = a + b d = a b n 2 2, 1, 3, 2 n 3 2, 1, 3, 2 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
135 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 2 c = a + b d = a b Summary Values?,?,?,? n 1 1, 2, 3,? n 2 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT 1, 2, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 1 n 2 n 3 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
136 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 2 c = a + b d = a b Summary Values?,?,?,? n 1 1, 2, 3,?,, 3, 2 n 2 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT 1, 2, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 1 n 2 n 3 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
137 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 2 c = a + b d = a b Summary Values?,?,?,? n 1 1, 2, 3,?,, 3, 2 n 2,, 3, 2 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT 1, 2, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 1 n 2 n 3 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
138 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 2 c = a + b d = a b Summary Values?,?,?,? n 1 1, 2, 3,?,, 3, 2 n 2,, 3, 2 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT 1, 2, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 1 n 2 n 3 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b,, 3, 2 n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
139 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 45/140 An Introduction to Constant Propagation n 1 a = 1 b = 2 c = a + b n 2 c = a + b d = a b Summary Values?,?,?,? n 1 1, 2, 3,?,, 3, 2 n 2,, 3, 2 a, b, c, d?,?,?,? Execution Sequence IN 1, 2, 3,? OUT 1, 2, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 1 n 2 n 3 n 2 d = c 1 a = 2 n 3 b = 1 c = a + b,, 3, 2 n 3 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 2, 1, 3, 2 n 3 n 2 n 3...
140 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 46/140 Issues Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms
141 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 46/140 Issues Representation Lattice Partial Order, Top, Bottom Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms
142 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 46/140 Issues Representation Lattice Partial Order, Top, Bottom Merge Commutativity, Associativity, Idempotence Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms
143 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 46/140 Issues Representation Lattice Partial Order, Top, Bottom Merge Commutativity, Associativity, Idempotence Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms Flow Functions Monotonicity, Distributivity, k-boundedness, Separability
144 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 46/140 Issues Representation Existence Lattice Partial Order, Top, Bottom Merge Commutativity, Associativity, Idempotence Data Flow Values Acceptable Operations Desired Solutions Practical Algorithms Safety Precision Flow Functions Monotonicity, Distributivity, k-boundedness, Separability
145 ETAPS 08 Static Analysis: Formulating Data Flow Analysis 46/140 Issues Representation Existence Lattice Partial Order, Top, Bottom Merge Commutativity, Associativity, Idempotence Data Flow Functions Flow Values Acceptable Operations Monotonicity, Distributivity, k-boundedness, Separability Desired Solutions Practical Algorithms Safety Initialisation Precision Complexity Convergence
146 Part 4 Data Flow Values
147 ETAPS 08 Static Analysis: Data Flow Values 47/140 The Set of Data Flow Values Properties of the data flow values The notion of approximations Combining data flow values
Heap Reference Analysis
Heap Referece Aalysis (www.cse.iitb.ac.i/ uday) Departmet of Computer Sciece ad Egieerig, Idia Istitute of Techology, Bombay Jauary 2008 SPATE 2008 Heap Referece Aalysis: Outlie 1/51 Outlie Motivatio Garbage
More informationCompiler Design. Data Flow Analysis. Hwansoo Han
Compiler Design Data Flow Analysis Hwansoo Han Control Flow Graph What is CFG? Represents program structure for internal use of compilers Used in various program analyses Generated from AST or a sequential
More informationDataflow Analysis. A sample program int fib10(void) { int n = 10; int older = 0; int old = 1; Simple Constant Propagation
-74 Lecture 2 Dataflow Analysis Basic Blocks Related Optimizations SSA Copyright Seth Copen Goldstein 200-8 Dataflow Analysis Last time we looked at code transformations Constant propagation Copy propagation
More informationTopic-I-C Dataflow Analysis
Topic-I-C Dataflow Analysis 2012/3/2 \course\cpeg421-08s\topic4-a.ppt 1 Global Dataflow Analysis Motivation We need to know variable def and use information between basic blocks for: constant folding dead-code
More informationLecture 10: Data Flow Analysis II
CS 515 Programming Language and Compilers I Lecture 10: Data Flow Analysis II (The lectures are based on the slides copyrighted by Keith Cooper and Linda Torczon from Rice University.) Zheng (Eddy) Zhang
More informationData Flow Analysis (I)
Compiler Design Data Flow Analysis (I) Hwansoo Han Control Flow Graph What is CFG? Represents program structure for internal use of compilers Used in various program analyses Generated from AST or a sequential
More informationIntra-procedural Data Flow Analysis Backwards analyses
Live variables Dead code elimination Very Busy Expressions Code hoisting Bitvector frameworks Monotone frameworks Intra-procedural Data Flow Analysis Backwards analyses Hanne Riis Nielson and Flemming
More informationData Flow Analysis. Lecture 6 ECS 240. ECS 240 Data Flow Analysis 1
Data Flow Analysis Lecture 6 ECS 240 ECS 240 Data Flow Analysis 1 The Plan Introduce a few example analyses Generalize to see the underlying theory Discuss some more advanced issues ECS 240 Data Flow Analysis
More informationDataflow Analysis Lecture 2. Simple Constant Propagation. A sample program int fib10(void) {
-4 Lecture Dataflow Analysis Basic Blocks Related Optimizations Copyright Seth Copen Goldstein 00 Dataflow Analysis Last time we looked at code transformations Constant propagation Copy propagation Common
More informationData flow analysis. DataFlow analysis
Data flow analysis DataFlow analysis compile time reasoning about the runtime flow of values in the program represent facts about runtime behavior represent effect of executing each basic block propagate
More informationGeneralizing Data-flow Analysis
Generalizing Data-flow Analysis Announcements PA1 grades have been posted Today Other types of data-flow analysis Reaching definitions, available expressions, reaching constants Abstracting data-flow analysis
More informationLecture 11: Data Flow Analysis III
CS 515 Programming Language and Compilers I Lecture 11: Data Flow Analysis III (The lectures are based on the slides copyrighted by Keith Cooper and Linda Torczon from Rice University.) Zheng (Eddy) Zhang
More informationStatic Program Analysis
Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem
More informationScalar Optimisation Part 2
Scalar Optimisation Part 2 Michael O Boyle January 2014 1 Course Structure L1 Introduction and Recap 4-5 lectures on classical optimisation 2 lectures on scalar optimisation Last lecture on redundant expressions
More informationDataflow analysis. Theory and Applications. cs6463 1
Dataflow analysis Theory and Applications cs6463 1 Control-flow graph Graphical representation of runtime control-flow paths Nodes of graph: basic blocks (straight-line computations) Edges of graph: flows
More informationWhat is SSA? each assignment to a variable is given a unique name all of the uses reached by that assignment are renamed
Another Form of Data-Flow Analysis Propagation of values for a variable reference, where is the value produced? for a variable definition, where is the value consumed? Possible answers reaching definitions,
More informationCSC D70: Compiler Optimization Dataflow-2 and Loops
CSC D70: Compiler Optimization Dataflow-2 and Loops Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip Gibbons
More informationDataflow Analysis. Chapter 9, Section 9.2, 9.3, 9.4
Dataflow Analysis Chapter 9, Section 9.2, 9.3, 9.4 2 Dataflow Analysis Dataflow analysis is a sub area of static program analysis Used in the compiler back end for optimizations of three address code and
More informationSoftware Verification
Software Verification Grégoire Sutre LaBRI, University of Bordeaux, CNRS, France Summer School on Verification Technology, Systems & Applications September 2008 Grégoire Sutre Software Verification VTSA
More informationCMSC 631 Program Analysis and Understanding. Spring Data Flow Analysis
CMSC 631 Program Analysis and Understanding Spring 2013 Data Flow Analysis Data Flow Analysis A framework for proving facts about programs Reasons about lots of little facts Little or no interaction between
More information3/11/18. Final Code Generation and Code Optimization
Final Code Generation and Code Optimization 1 2 3 for ( i=0; i < N; i++) { base = &a[0]; crt = *(base + i); } original code base = &a[0]; for ( i=0; i < N; i++) { crt = *(base + i); } optimized code e1
More informationLiveness based Garbage Collection
CS738: Advanced Compiler Optimizations Liveness based Garbage Collection Amey Karkare karkare@cse.iitk.ac.in http://www.cse.iitk.ac.in/~karkare/cs738 Department of CSE, IIT Kanpur Ideal Garbage Collection...
More informationDataflow Analysis. Dragon book, Chapter 9, Section 9.2, 9.3, 9.4
Dataflow Analysis Dragon book, Chapter 9, Section 9.2, 9.3, 9.4 2 Dataflow Analysis Dataflow analysis is a sub-area of static program analysis Used in the compiler back end for optimizations of three-address
More informationReading: Chapter 9.3. Carnegie Mellon
I II Lecture 3 Foundation of Data Flow Analysis Semi-lattice (set of values, meet operator) Transfer functions III Correctness, precision and convergence IV Meaning of Data Flow Solution Reading: Chapter
More informationWorst-Case Execution Time Analysis. LS 12, TU Dortmund
Worst-Case Execution Time Analysis Prof. Dr. Jian-Jia Chen LS 12, TU Dortmund 02, 03 May 2016 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 1 / 53 Most Essential Assumptions for Real-Time Systems Upper
More informationWe define a dataflow framework. A dataflow framework consists of:
So far been talking about various dataflow problems (e.g. reaching definitions, live variable analysis) in very informal terms. Now we will discuss a more fundamental approach to handle many of the dataflow
More informationProgram verification
Program verification Data-flow analyses, numerical domains Laure Gonnord and David Monniaux University of Lyon / LIP September 29, 2015 1 / 75 Context Program Verification / Code generation: Variables
More informationIterative Dataflow Analysis
Iterative Dataflow Analysis CS 352 9/24/07 Slides adapted from Nielson, Nielson, Hankin Principles of Program Analysis Key Ideas Need a mechanism to evaluate (statically) statements in a program Problem:
More informationLogic and Boolean algebra
Computer Mathematics Week 7 Logic and Boolean algebra College of Information Science and Engineering Ritsumeikan University last week coding theory channel coding information theory concept Hamming distance
More information(b). Identify all basic blocks in your three address code. B1: 1; B2: 2; B3: 3,4,5,6; B4: 7,8,9; B5: 10; B6: 11; B7: 12,13,14; B8: 15;
(a). Translate the program into three address code as defined in Section 6.2, dragon book. (1) i := 2 (2) if i > n goto (7) (3) a[i] := TRUE (4) t2 := i+1 (5) i := t2 (6) goto (2) (7) count := 0 (8) s
More informationDataflow Analysis - 2. Monotone Dataflow Frameworks
Dataflow Analysis - 2 Monotone dataflow frameworks Definition Convergence Safety Relation of MOP to MFP Constant propagation Categorization of dataflow problems DataflowAnalysis 2, Sp06 BGRyder 1 Monotone
More informationSearch and Lookahead. Bernhard Nebel, Julien Hué, and Stefan Wölfl. June 4/6, 2012
Search and Lookahead Bernhard Nebel, Julien Hué, and Stefan Wölfl Albert-Ludwigs-Universität Freiburg June 4/6, 2012 Search and Lookahead Enforcing consistency is one way of solving constraint networks:
More informationLecture 5 Introduction to Data Flow Analysis
Lecture 5 Introduction to Data Flow Analysis I. Structure of data flow analysis II. III. IV. Example 1: Reaching definition analysis Example 2: Liveness analysis Framework Phillip B. Gibbons 15-745: Intro
More informationMaterial Covered on the Final
Material Covered on the Final On the final exam, you are responsible for: Anything covered in class, except for stories about my good friend Ken Kennedy All lecture material after the midterm ( below the
More informationCSE P 501 Compilers. Value Numbering & Op;miza;ons Hal Perkins Winter UW CSE P 501 Winter 2016 S-1
CSE P 501 Compilers Value Numbering & Op;miza;ons Hal Perkins Winter 2016 UW CSE P 501 Winter 2016 S-1 Agenda Op;miza;on (Review) Goals Scope: local, superlocal, regional, global (intraprocedural), interprocedural
More informationCSC D70: Compiler Optimization Static Single Assignment (SSA)
CSC D70: Compiler Optimization Static Single Assignment (SSA) Prof. Gennady Pekhimenko University of Toronto Winter 08 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip
More informationIntroduction to data-flow analysis. Data-flow analysis. Control-flow graphs. Data-flow analysis. Example: liveness. Requirements
Data-flow analysis Michel Schinz based on material by Erik Stenman and Michael Schwartzbach Introduction to data-flow analysis Data-flow analysis Example: liveness Data-flow analysis is a global analysis
More informationMIT Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology
MIT 6.035 Foundations of Dataflow Analysis Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Dataflow Analysis Compile-Time Reasoning About Run-Time Values of Variables
More informationGraph-theoretic Problems
Graph-theoretic Problems Parallel algorithms for fundamental graph-theoretic problems: We already used a parallelization of dynamic programming to solve the all-pairs-shortest-path problem. Here we are
More informationGoal. Partially-ordered set. Game plan 2/2/2013. Solving fixpoint equations
Goal Solving fixpoint equations Many problems in programming languages can be formulated as the solution of a set of mutually recursive equations: D: set, f,g:dxd D x = f(x,y) y = g(x,y) Examples Parsing:
More informationThe algorithmic analysis of hybrid system
The algorithmic analysis of hybrid system Authors: R.Alur, C. Courcoubetis etc. Course teacher: Prof. Ugo Buy Xin Li, Huiyong Xiao Nov. 13, 2002 Summary What s a hybrid system? Definition of Hybrid Automaton
More informationPath Testing and Test Coverage. Chapter 9
Path Testing and Test Coverage Chapter 9 Structural Testing Also known as glass/white/open box testing Structural testing is based on using specific knowledge of the program source text to define test
More informationModel Checking: An Introduction
Model Checking: An Introduction Meeting 3, CSCI 5535, Spring 2013 Announcements Homework 0 ( Preliminaries ) out, due Friday Saturday This Week Dive into research motivating CSCI 5535 Next Week Begin foundations
More informationPath Testing and Test Coverage. Chapter 9
Path Testing and Test Coverage Chapter 9 Structural Testing Also known as glass/white/open box testing Structural testing is based on using specific knowledge of the program source text to define test
More informationClasses of data dependence. Dependence analysis. Flow dependence (True dependence)
Dependence analysis Classes of data dependence Pattern matching and replacement is all that is needed to apply many source-to-source transformations. For example, pattern matching can be used to determine
More informationDependence analysis. However, it is often necessary to gather additional information to determine the correctness of a particular transformation.
Dependence analysis Pattern matching and replacement is all that is needed to apply many source-to-source transformations. For example, pattern matching can be used to determine that the recursion removal
More informationFortran program + Partial data layout specifications Data Layout Assistant.. regular problems. dynamic remapping allowed Invoked only a few times Not part of the compiler Can use expensive techniques HPF
More informationConstruction of Static Single-Assignment Form
COMP 506 Rice University Spring 2018 Construction of Static Single-Assignment Form Part II source IR IR target code Front End Optimizer Back End code Copyright 2018, Keith D. Cooper & Linda Torczon, all
More informationPrinciples of Program Analysis: A Sampler of Approaches
Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag
More informationDeterministic PDA s. Deepak D Souza. 08 Nov Department of Computer Science and Automation Indian Institute of Science, Bangalore.
Deterministic PDA s Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 08 Nov 2016 Outline 1 Deterministic PDA s 2 Closure properties of DCFL s 3 Complementing
More informationLoop Scheduling and Software Pipelining \course\cpeg421-08s\topic-7.ppt 1
Loop Scheduling and Software Pipelining 2008-04-24 \course\cpeg421-08s\topic-7.ppt 1 Reading List Slides: Topic 7 and 7a Other papers as assigned in class or homework: 2008-04-24 \course\cpeg421-08s\topic-7.ppt
More informationParallelism and Machine Models
Parallelism and Machine Models Andrew D Smith University of New Brunswick, Fredericton Faculty of Computer Science Overview Part 1: The Parallel Computation Thesis Part 2: Parallelism of Arithmetic RAMs
More informationSpeculative Parallelism in Cilk++
Speculative Parallelism in Cilk++ Ruben Perez & Gregory Malecha MIT May 11, 2010 Ruben Perez & Gregory Malecha (MIT) Speculative Parallelism in Cilk++ May 11, 2010 1 / 33 Parallelizing Embarrassingly Parallel
More informationLogic and Computer Design Fundamentals. Chapter 8 Sequencing and Control
Logic and Computer Design Fundamentals Chapter 8 Sequencing and Control Datapath and Control Datapath - performs data transfer and processing operations Control Unit - Determines enabling and sequencing
More informationDO NOT COPY DO NOT COPY
Drill Problems 3 benches. Another practical book is VHDL for Programmable Logic, by Kevin Skahill of Cypress Semiconductor (Addison-esley, 1996). All of the ABEL and VHDL examples in this chapter and throughout
More informationMIT Loop Optimizations. Martin Rinard
MIT 6.035 Loop Optimizations Martin Rinard Loop Optimizations Important because lots of computation occurs in loops We will study two optimizations Loop-invariant code motion Induction variable elimination
More informationData-Flow Analysis. Compiler Design CSE 504. Preliminaries
Data-Flow Analysis Compiler Design CSE 504 1 Preliminaries 2 Live Variables 3 Data Flow Equations 4 Other Analyses Last modifled: Thu May 02 2013 at 09:01:11 EDT Version: 1.3 15:28:44 2015/01/25 Compiled
More informationScalar Optimisation Part 1
calar Optimisation Part 1 Michael O Boyle January, 2014 1 Course tructure L1 Introduction and Recap 4/5 lectures on classical optimisation 2 lectures on scalar optimisation Today example optimisations
More informationStatic Program Analysis using Abstract Interpretation
Static Program Analysis using Abstract Interpretation Introduction Static Program Analysis Static program analysis consists of automatically discovering properties of a program that hold for all possible
More informationComputing Static Single Assignment (SSA) Form
Computing Static Single Assignment (SSA) Form Overview What is SSA? Advantages of SSA over use-def chains Flavors of SSA Dominance frontiers revisited Inserting φ-nodes Renaming the variables Translating
More informationCS:4420 Artificial Intelligence
CS:4420 Artificial Intelligence Spring 2018 Propositional Logic Cesare Tinelli The University of Iowa Copyright 2004 18, Cesare Tinelli and Stuart Russell a a These notes were originally developed by Stuart
More informationSAT-Solving: From Davis- Putnam to Zchaff and Beyond Day 3: Recent Developments. Lintao Zhang
SAT-Solving: From Davis- Putnam to Zchaff and Beyond Day 3: Recent Developments Requirements for SAT solvers in the Real World Fast & Robust Given a problem instance, we want to solve it quickly Reliable
More informationTHEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET
THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages
More informationA. Incorrect! Replacing is not a method for solving systems of equations.
ACT Math and Science - Problem Drill 20: Systems of Equations No. 1 of 10 1. What methods were presented to solve systems of equations? (A) Graphing, replacing, and substitution. (B) Solving, replacing,
More information: Compiler Design. 9.5 Live variables 9.6 Available expressions. Thomas R. Gross. Computer Science Department ETH Zurich, Switzerland
252-210: Compiler Design 9.5 Live variables 9.6 Available expressions Thomas R. Gross Computer Science Department ETH Zurich, Switzerland Outline Warp up reaching definifons Live variables Available expressions
More informationModel Checking & Program Analysis
Model Checking & Program Analysis Markus Müller-Olm Dortmund University Overview Introduction Model Checking Flow Analysis Some Links between MC and FA Conclusion Apology for not giving proper credit to
More informationCS 453 Operating Systems. Lecture 7 : Deadlock
CS 453 Operating Systems Lecture 7 : Deadlock 1 What is Deadlock? Every New Yorker knows what a gridlock alert is - it s one of those days when there is so much traffic that nobody can move. Everything
More informationCombinational Logic Design Principles
Combinational Logic Design Principles Switching algebra Doru Todinca Department of Computers Politehnica University of Timisoara Outline Introduction Switching algebra Axioms of switching algebra Theorems
More informationFrom SAT To SMT: Part 1. Vijay Ganesh MIT
From SAT To SMT: Part 1 Vijay Ganesh MIT Software Engineering & SMT Solvers An Indispensable Tactic for Any Strategy Formal Methods Program Analysis SE Goal: Reliable/Secure Software Automatic Testing
More informationB-Spline Interpolation on Lattices
B-Spline Interpolation on Lattices David Eberly, Geometric Tools, Redmond WA 98052 https://www.geometrictools.com/ This work is licensed under the Creative Commons Attribution 4.0 International License.
More informationHow to deal with uncertainties and dynamicity?
How to deal with uncertainties and dynamicity? http://graal.ens-lyon.fr/ lmarchal/scheduling/ 19 novembre 2012 1/ 37 Outline 1 Sensitivity and Robustness 2 Analyzing the sensitivity : the case of Backfilling
More informationPrinciples of AI Planning
Principles of 5. Planning as search: progression and regression Malte Helmert and Bernhard Nebel Albert-Ludwigs-Universität Freiburg May 4th, 2010 Planning as (classical) search Introduction Classification
More informationA Theory for Comparing the Expressive Power of Access Control Models
A Theory for Comparing the Expressive Power of Access Control Models Mahesh V. Tripunitara Ninghui Li Department of Computer Sciences and CERIAS, Purdue University, West Lafayette, IN 47905. {tripunit,ninghui}@cerias.purdue.edu
More informationWorst-Case Execution Time Analysis. LS 12, TU Dortmund
Worst-Case Execution Time Analysis Prof. Dr. Jian-Jia Chen LS 12, TU Dortmund 09/10, Jan., 2018 Prof. Dr. Jian-Jia Chen (LS 12, TU Dortmund) 1 / 43 Most Essential Assumptions for Real-Time Systems Upper
More informationClock-driven scheduling
Clock-driven scheduling Also known as static or off-line scheduling Michal Sojka Czech Technical University in Prague, Faculty of Electrical Engineering, Department of Control Engineering November 8, 2017
More informationHeuristics for Efficient SAT Solving. As implemented in GRASP, Chaff and GSAT.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT. Formulation of famous problems as SAT: k-coloring (1/2) The K-Coloring problem: Given an undirected graph G(V,E) and a natural
More informationCourse Announcements. Bacon is due next Monday. Next lab is about drawing UIs. Today s lecture will help thinking about your DB interface.
Course Announcements Bacon is due next Monday. Today s lecture will help thinking about your DB interface. Next lab is about drawing UIs. John Jannotti (cs32) ORMs Mar 9, 2017 1 / 24 ORMs John Jannotti
More informationChapter 7 R&N ICS 271 Fall 2017 Kalev Kask
Set 6: Knowledge Representation: The Propositional Calculus Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask Outline Representing knowledge using logic Agent that reason logically A knowledge based agent Representing
More information3515ICT: Theory of Computation. Regular languages
3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,
More informationCOSE312: Compilers. Lecture 17 Intermediate Representation (2)
COSE312: Compilers Lecture 17 Intermediate Representation (2) Hakjoo Oh 2017 Spring Hakjoo Oh COSE312 2017 Spring, Lecture 17 May 31, 2017 1 / 19 Common Intermediate Representations Three-address code
More informationThe Meet-Over-All-Paths Solution to Data-Flow Problems
The Meet-Over-All-Paths Solution to Data-Flow Problems Consider a monotone dataflow framework (L,,F). Assume that the functions f B F represent the effect of a basic block on the sets conatining data for
More informationCausal Dataflow Analysis for Concurrent Programs
Causal Dataflow Analysis for Concurrent Programs Azadeh Farzan P. Madhusudan Department of Computer Science, University of Illinois at Urbana-Champaign. {afarzan,madhu}@cs.uiuc.edu Abstract. We define
More informationStatic Program Analysis
Static Program Analysis Lecture 16: Abstract Interpretation VI (Counterexample-Guided Abstraction Refinement) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de
More informationCompiling Techniques
Lecture 11: Introduction to 13 November 2015 Table of contents 1 Introduction Overview The Backend The Big Picture 2 Code Shape Overview Introduction Overview The Backend The Big Picture Source code FrontEnd
More informationFlow grammars a flow analysis methodology
Flow grammars a flow analysis methodology James S. Uhl and R. Nigel Horspool Dept. of Computer Science, University of Victoria P.O. Box 3055, Victoria, BC, Canada V8W 3P6 E-mail: juhl@csr.uvic.ca, nigelh@csr.uvic.ca
More informationMulticore Semantics and Programming
Multicore Semantics and Programming Peter Sewell Tim Harris University of Cambridge Oracle October November, 2015 p. 1 These Lectures Part 1: Multicore Semantics: the concurrency of multiprocessors and
More informationAbstract Interpretation and Static Analysis
/ 1 Abstract Interpretation and Static Analysis David Schmidt Kansas State University www.cis.ksu.edu/~schmidt Welcome! / 2 / 3 Four parts 1. Introduction to static analysis what it is and how to apply
More informationScheduling with AND/OR Precedence Constraints
Scheduling with AND/OR Precedence Constraints Seminar Mathematische Optimierung - SS 2007 23th April 2007 Synthesis synthesis: transfer from the behavioral domain (e. g. system specifications, algorithms)
More informationTemporal logics and explicit-state model checking. Pierre Wolper Université de Liège
Temporal logics and explicit-state model checking Pierre Wolper Université de Liège 1 Topics to be covered Introducing explicit-state model checking Finite automata on infinite words Temporal Logics and
More informationSAMPLE ANSWERS MARKER COPY
Page 1 of 12 School of Computer Science 60-265-01 Computer Architecture and Digital Design Fall 2012 Midterm Examination # 1 Tuesday, October 23, 2012 SAMPLE ANSWERS MARKER COPY Duration of examination:
More informationThe Trace Partitioning Abstract Domain
The Trace Partitioning Abstract Domain XAVIER RIVAL and LAURENT MAUBORGNE École Normale Supérieure In order to achieve better precision of abstract interpretation based static analysis, we introduce a
More informationComputer Science Introductory Course MSc - Introduction to Java
Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow
More informationAbstract parsing: static analysis of dynamically generated string output using LR-parsing technology
Abstract parsing: static analysis of dynamically generated string output using LR-parsing technology Kyung-Goo Doh 1, Hyunha Kim 1, David A. Schmidt 2 1. Hanyang University, Ansan, South Korea 2. Kansas
More informationSpace-aware data flow analysis
Space-aware data flow analysis C. Bernardeschi, G. Lettieri, L. Martini, P. Masci Dip. di Ingegneria dell Informazione, Università di Pisa, Via Diotisalvi 2, 56126 Pisa, Italy {cinzia,g.lettieri,luca.martini,paolo.masci}@iet.unipi.it
More informationA Self-Stabilizing Algorithm for Finding a Minimal Distance-2 Dominating Set in Distributed Systems
JOURNAL OF INFORMATION SCIENCE AND ENGINEERING 24, 1709-1718 (2008) A Self-Stabilizing Algorithm for Finding a Minimal Distance-2 Dominating Set in Distributed Systems JI-CHERNG LIN, TETZ C. HUANG, CHENG-PIN
More informationMonotone Data Flow Analysis Framework
Monotone Data Flow Analysis Framework Definition. A relation R on a set S is (a) reflexive iff ( x S)[xRx], (b) antisymmetric iff [xry yrx x=y] (c) transitive iff ( x,y,z S) [xry yrz xrz] Definition. A
More informationCS357: CTL Model Checking (two lectures worth) David Dill
CS357: CTL Model Checking (two lectures worth) David Dill 1 CTL CTL = Computation Tree Logic It is a propositional temporal logic temporal logic extended to properties of events over time. CTL is a branching
More informationAxioms of Kleene Algebra
Introduction to Kleene Algebra Lecture 2 CS786 Spring 2004 January 28, 2004 Axioms of Kleene Algebra In this lecture we give the formal definition of a Kleene algebra and derive some basic consequences.
More informationcontrol in out in out Figure 1. Binary switch: (a) opened or off; (b) closed or on.
Chapter 2 Digital Circuits Page 1 of 18 2. Digital Circuits Our world is an analog world. Measurements that we make of the physical objects around us are never in discrete units but rather in a continuous
More informationCS590U Access Control: Theory and Practice. Lecture 6 (January 27) The Harrison-Ruzzo-Ullman Model
CS590U Access Control: Theory and Practice Lecture 6 (January 27) The Harrison-Ruzzo-Ullman Model Papers That This Lecture is Based Upon M.A. Harrison, W.L. Ruzzo, and J.D. Ullman: Protection in Operating
More information