lecture-12 Interprocedural Analysis (continued)

lecture-12 Interprocedural Analysis (continued) - Approach...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 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; } } main f g f() { g(); if (. ..) { main(); } } main() { g(); f(); lock; unlock; } Example again g() { if(isLocked()) { unlock; } else { lock; } } main f g 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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Approach #2 to context-sensitivity 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; } } f() { g(); if (. ..) { main(); } } main() { g(); f(); lock; unlock; } main
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/19/2008 for the course CSE 231 taught by Professor Lerner during the Fall '06 term at UCSD.

Page1 / 5

lecture-12 Interprocedural Analysis (continued) - Approach...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online