Another lock protocol example g() { if(isLocked()) { unlock; } else { lock; } } mainfg ;;;;; u ” ”””” ” ””” ” ” ”” ” ” ” ”””” u l l ” ””” ” ” ” ” ” {u,l}

Slides:



Advertisements
Similar presentations
Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Advertisements

CS252: Systems Programming Ninghui Li Program Interview Questions.
Bebop: A Symbolic Model Checker for Boolean Programs Thomas Ball Sriram K. Rajamani
Prime Factorization How can a number be broken down into smaller parts?
Divide and Conquer Chapter 6. Divide and Conquer Paradigm Divide the problem into sub-problems of smaller sizes Conquer by recursively doing the same.
CPSC 320: Intermediate Algorithm Design & Analysis Divide & Conquer and Recurrences Steve Wolfman 1.
Interprocedural analyses and optimizations. Costs of procedure calls Up until now, we treated calls conservatively: –make the flow function for call nodes.
Approach #1 to context-sensitivity Keep information for different call sites separate In this case: context is the call site from which the procedure is.
Inlining pros and cons (discussion). Inlining pros and cons Pros –eliminate overhead of call/return sequence –eliminate overhead of passing args & returning.
Interprocedural pointer analysis for C We’ll look at Wilson & Lam PLDI 95, and focus on two problems solved by this paper: –how to represent pointer information.
From last time: reaching definitions For each use of a variable, determine what assignments could have set the value being read from the variable Information.
KQS More exercises/practice What about research frontier? Reading material Meetings for project Post notes more promptly.
Another example p := &x; *p := 5 y := x + 1;. Another example p := &x; *p := 5 y := x + 1; x := 5; *p := 3 y := x + 1; ???
Range Analysis. Intraprocedural Points-to Analysis Want to compute may-points-to information Lattice:
Intraprocedural Points-to Analysis Flow functions:
Recap from last time g() { lock; } h() { unlock; } f() { h(); if (...) { main(); } } main() { g(); f(); lock; unlock; } mainfgh ;;;;;;; u u ” ”””” ” ”
ESP [Das et al PLDI 2002] Interface usage rules in documentation –Order of operations, data access –Resource management –Incomplete, wordy, not checked.
A simple approach Given call graph and CFGs of procedures, create a single CFG (control flow super-graph) by: –connecting call sites to entry nodes of.
Approach #1 to context-sensitivity Keep information for different call sites separate In this case: context is the call site from which the procedure is.
From last time: Inlining pros and cons Pros –eliminate overhead of call/return sequence –eliminate overhead of passing args & returning results –can optimize.
Projects. Dataflow analysis Dataflow analysis: what is it? A common framework for expressing algorithms that compute information about a program Why.
Comparison Caller precisionCallee precisionCode bloat Inlining context-insensitive interproc Context sensitive interproc Specialization.
Course project presentations Midterm project presentation Originally scheduled for Tuesday Nov 4 th Can move to Th Nov 6 th or Th Nov 13 th.
Reps Horwitz and Sagiv 95 (RHS) Another approach to context-sensitive interprocedural analysis Express the problem as a graph reachability query Works.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
Transfer functions Our pairs of summaries look like functions from input information to output information We call these transfer functions Complete transfer.
Examples of summaries. Issues with summaries Level of “context” sensitivity: –For example, one summary that summarizes the entire procedure for all call.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
Symbolic Path Simulation in Path-Sensitive Dataflow Analysis Hari Hampapuram Jason Yue Yang Manuvir Das Center for Software Excellence (CSE) Microsoft.
Chap. 2 Hierarchical Modeling Concepts. 2 Hierarchical Modeling Concepts Design Methodologies 4-bit Ripple Carry Counter Modules Instances Components.
Chapter 2.1 Program Design and Documentation. Summary System/Program specifications System/Program design –Top-down & Bottom-up design –Object Oriented.
Impact Analysis of Database Schema Changes Andy Maule, Wolfgang Emmerich and David S. Rosenblum London Software Systems Dept. of Computer Science, University.
PRESTO Research Group, Ohio State University Interprocedural Dataflow Analysis in the Presence of Large Libraries Atanas (Nasko) Rountev Scott Kagan Ohio.
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
1 Week 4 Questions / Concerns Comments about Lab1 What’s due: Lab1 check off this week (see schedule) Homework #3 due Wednesday (Define grammar for your.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Dynamic Dropdown Lists 1. Objectives You will be able to Use Dropdown Lists to solicit multiple choice user input in an ASPX web page. Populate a Dropdown.
Dynamic Programming Louis Siu What is Dynamic Programming (DP)? Not a single algorithm A technique for speeding up algorithms (making use of.
Recursion Review: A recursive function calls itself, but with a smaller problem – at least one of the parameters must decrease. The function uses the results.
Math – What is a Function? 1. 2 input output function.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Principles of Programming - NI Simple Recursion Recursion is where a function calls itself. Concept of recursive function: A recursive function is.
Pointer Analysis – Part I CS Pointer Analysis Answers which pointers can point to which memory locations at run-time Central to many program optimization.
Interprocedural analyses and optimizations. Costs of procedure calls Up until now, we treated calls conservatively: –make the flow function for call nodes.
Write a function rule for a graph EXAMPLE 3 Write a rule for the function represented by the graph. Identify the domain and the range of the function.
©2007 by S – Squared, Inc. All Rights Reserved. Description:  b is the base  b > 0 (positive number)  b ≠ 1  a ≠ 0  x is the exponent  x is the.
Interprocedural analyses and optimizations. Costs of procedure calls Up until now, we treated calls conservatively: –make the flow function for call nodes.
chap10 Chapter 10 Recursion chap10 2 Recursive Function recursive function The recursive function is a kind of function that calls.
Pointer Analysis CS Alias Analysis  Aliases: two expressions that denote the same memory location.  Aliases are introduced by:  pointers  call-by-reference.
May 5, 2004Slide 2 OmnAuto TMS Solution May 5, 2004Slide 3 OmnAuto TMS Dataflow.
Function Recursion to understand recursion you must understand recursion.
Inter-procedural analysis
Dataflow analysis.
Ravi Mangal Mayur Naik Hongseok Yang
EXAMPLE 1 Represent relations
to understand recursion you must understand recursion
Symbolism in Literature (What could a lock symbolize
Recursion Output Input
إستراتيجيات ونماذج التقويم
Another example: constant prop
Dataflow analysis.
L.8.5 Demonstrate understanding of figurative language, word relationships, and nuances in word meanings. Symbolism in Literature (What could a lock.
Function Rules and Tables.
Pointer analysis.
Interprocedural analyses and optimizations
Unit 2 Lesson 1 Function Definitions.
RELATIONS & FUNCTIONS CHAPTER 4.
Symbolism in Literature (What could a lock symbolize
Dependent Axis Y Answer Output Range f (x) Function Notation
Review of the Web Site on IT Practices
Presentation transcript:

Another lock protocol example g() { if(isLocked()) { unlock; } else { lock; } } mainfg ;;;;; u ” ”””” ” ””” ” ” ”” ” ” ” ”””” u l l ” ””” ” ” ” ” ” {u,l} f() { g(); if (...) { main(); } } main() { g(); f(); lock; unlock; } {u,l} ”” ” ” {u,e}

What went wrong?

We merged info from two call sites of g() Solution: summaries that keep different contexts separate What is a context?

Approach #1 to context-sensitivity Keep information for different call sites separate In this case: context is the call site from which the procedure is called

Example again g() { if(isLocked()) { unlock; } else { lock; } } mainfg f() { g(); if (...) { main(); } } main() { g(); f(); lock; unlock; }

Example again g() { if(isLocked()) { unlock; } else { lock; } } mainfg f() { g(); if (...) { main(); } } main() { g(); f(); lock; unlock; }

How should we change the example? How should we change our example to break our context sensitivity strategy? g() { if(isLocked()) { unlock; } else { lock; } f() { g(); if (...) { main(); } main() { g(); f(); lock; unlock; }

Answer h() { g() } g() { if(isLocked()) { unlock; } else { lock; } f() { h(); if (...) { main(); } main() { h(); f(); lock; unlock; }

In general Our first attempt was to make the context be the immediate call site Previous example shows that we may need 2 levels of the stack –the context for an analysis of function f is: call site L 1 where f was called from AND call site L 2 where f’s caller was called from Can generalize to k levels –k-length call strings approach of Sharir and Pnueli –Shiver’s k-CFA

Approach #2 to context-sensitivity

Use dataflow information at call site as the context, not the call site itself

Using dataflow info as context g() { if(isLocked()) { unlock; } else { lock; } } mainfg f() { g(); if (...) { main(); } } main() { g(); f(); lock; unlock; }

Transfer functions Our pairs of summaries look like functions from input information to output information We call these transfer functions Complete transfer functions –contain entries for all possible incoming dataflow information Partial transfer functions –contain only some entries, and continually refine during analysis

Top-down vs. bottom-up We’ve always run our interproc analysis top down: from main, down into procs For data-based context sensitivity, can also run the analysis bottom-up –analyze a proc in all possibly contexts –if domain is distributive, only need to analyze singleton sets

Bottom-up example g() { if(isLocked()) { unlock; } else { lock; } } f() { g(); if (...) { main(); } } main() { g(); f(); lock; unlock; } mainfg ??? u ! l l ! u u ! l l ! u u ! u l ! e ”” ” ” ” ” u ! {l,e} l ! u ”” u ! u l ! e