Screaming Fast Declarative Pointer Analysis

Size: px
Start display at page:

Download "Screaming Fast Declarative Pointer Analysis"

Transcription

1 Screaming Fast Declarative Pointer Analysis Martin Bravenboer and Yannis Smaragdakis University of Massachusetts Amherst University of Oregon NEPLS March 5, 2008

2 overview 1 what do we do?

3 overview 1 what do we do? fully declarative pointer analysis fast, really fast

4 overview 1 what do we do? fully declarative pointer analysis fast, really fast how do we do it? novel, aggressive optimization exposition of indexes

5 overview 1 what do we do? fully declarative pointer analysis fast, really fast how do we do it? novel, aggressive optimization exposition of indexes why do you care? fast sophisticated, simple different

6 overview 1 what do we do? fully declarative pointer analysis fast, really fast how do we do it? novel, aggressive optimization exposition of indexes why do you care? fast sophisticated, simple different why is it relevant? optimization understanding, find bugs

7 program analysis: run faster 2

8 program analysis: software understanding 3

9 program analysis: find bugs 4

10 pointer analysis 5 what objects can a variable point to? program void foo() { a = new A1(); b = id(a); } void bar() { a = new A2(); b = id(a); } A id(a a) { return a; }

11 pointer analysis 5 ˆ ˆ what objects can a variable point to? program points-to void foo() { foo.a new A1() a = new A1(); b = id(a); bar.a new A2() } void bar() { a = new A2(); b = id(a); } A id(a a) { return a; }

12 pointer analysis 5 ˆ ˆ what objects can a variable point to? program points-to void foo() { foo.a new A1() a = new A1(); bar.a new A2() b = id(a); } id.a new A1(), new A2() void bar() { a = new A2(); b = id(a); } ˆ A id(a a) { return a; }

13 pointer analysis 5 ˆ ˆ ˆ what objects can a variable point to? program points-to void foo() { foo.a new A1() a = new A1(); bar.a new A2() } b = id(a); id.a new A1(), new A2() foo.b new A1(), new A2() void bar() { bar.b new A1(), new A2() a = new A2(); b = id(a); } A id(a a) { return a; }

14 pointer analysis 5 what objects can a variable point to? program void foo() { a = new A1(); b = id(a); } void bar() { a = new A2(); b = id(a); } A id(a a) { return a; } points-to foo.a bar.a id.a foo.b bar.b new A1() new A2() new A1(), new A2() new A1(), new A2() new A1(), new A2() context-sensitive points-to foo.a bar.a id.a (foo) id.a (bar) foo.b bar.b new A1() new A2() new A1() new A2() new A1() new A2()

15 pointer analysis: a complex domain 6 inclusion-based subset-based unification-based equality-based flow-sensitive context-sensitive k-cfa field-based field-sensitive heap cloning context-sensitive heap abstraction

16 algorithms in a 10-page pointer analysis paper 7

17 algorithms in a 10-page pointer analysis paper 7

18 algorithms in a 10-page pointer analysis paper 7

19 algorithms in a 10-page pointer analysis paper 7

20 algorithms in a 10-page pointer analysis paper 7

21 algorithms in a 10-page pointer analysis paper 7

22 algorithms in a 10-page pointer analysis paper 7

23 algorithms in a 10-page pointer analysis paper 7

24 algorithms in a 10-page pointer analysis paper 7 variation points unclear every variant new algorithm correctness unclear insights, specifics? incomparable in precision incomparable in performance

25 program analysis: a domain of mutual recursion 8 var points-to

26 program analysis: a domain of mutual recursion 8 x = y var points-to

27 program analysis: a domain of mutual recursion 8 x = y var points-to

28 program analysis: a domain of mutual recursion 8 x = f() var points-to call graph

29 program analysis: a domain of mutual recursion 8 x = f() var points-to call graph

30 program analysis: a domain of mutual recursion 8 x = y.f() var points-to call graph

31 program analysis: a domain of mutual recursion 8 x = new A() var points-to call graph reachable methods

32 program analysis: a domain of mutual recursion 8 x = new A() var points-to call graph reachable methods

33 program analysis: a domain of mutual recursion 8 x.f = y var points-to call graph field points-to reachable methods

34 program analysis: a domain of mutual recursion 8 x.f = y var points-to call graph field points-to reachable methods

35 program analysis: a domain of mutual recursion 8 x = f.y var points-to call graph field points-to reachable methods

36 program analysis: a domain of mutual recursion 8 throw e var points-to call graph exceptions field points-to reachable methods

37 program analysis: a domain of mutual recursion 8 throw e var points-to call graph exceptions field points-to reachable methods

38 program analysis: a domain of mutual recursion 8 catch(e e) var points-to call graph exceptions field points-to reachable methods

39 program analysis: a domain of mutual recursion 8 g() var points-to call graph exceptions field points-to reachable methods

40 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b;

41 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c

42 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

43 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

44 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo a new A() b new B() c new C() ˆ VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

45 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo a new A() b new B() c new C() VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

46 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo a new A() b new B() c new C() VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). ˆ VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

47 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo a new A() b new B() c new C() a new B() VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). ˆ VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

48 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo a new A() b new B() c new C() a new B() b new A() c new B() VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

49 datalog: declarative mutual recursion 9 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignHeapAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo a new A() b new B() c new C() a new B() b new A() c new B() c new A() VarPointsTo(?var,?heap) <- AssignHeapAllocation(?var,?heap). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap).

50 datalog: properties 10 limited logic programming sql with recursion prolog without complex terms (constructors) guaranteed termination captures PTIME complexity class purely declarative as opposed to prolog - conjunction commutative - clauses commutative enables different execution strategies enables more aggressive optimization writing datalog is less programming, more specification

51 datalog: naive evaluation 11 datalog VarPointsTo(?var,?heap) <- AssignHeapAllocation(?heap,?var). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap). naive evaluation (relational algebra) VarPointsTo := AssignHeapAllocation repeat tmp := π to var,heap (VarPointsTo from=var VarPointsTo := VarPointsTo tmp until fixpoint Assign)

52 datalog: naive evaluation 11 datalog VarPointsTo(?var,?heap) <- AssignHeapAllocation(?heap,?var). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap). naive evaluation (relational algebra) VarPointsTo := AssignHeapAllocation repeat tmp := π to var,heap (VarPointsTo from=var Assign) VarPointsTo := VarPointsTo tmp until fixpoint VarPointsTo(var, heap) Assign(from, to)

53 datalog: naive evaluation 11 datalog VarPointsTo(?var,?heap) <- AssignHeapAllocation(?heap,?var). VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap). naive evaluation (relational algebra) VarPointsTo := AssignHeapAllocation repeat DO loops are so 1950s! tmp := π to var,heap (VarPointsTo from=var Assign) VarPointsTo := VarPointsTo tmp until fixpoint VarPointsTo(var, heap) Assign(from, to)

54 datalog: semi-naive evaluation 12 VarPointsTo Assign

55 datalog: semi-naive evaluation 12 VarPointsTo Assign

56 datalog: semi-naive evaluation 12 VarPointsTo Assign

57 datalog: semi-naive evaluation 12 VarPointsTo Assign

58 datalog: semi-naive evaluation 12 VarPointsTo Assign

59 datalog: semi-naive evaluation 13 InstanceFieldPointsTo(?baseheap,?signature,?heap) <- StoreInstanceField(?from,?base,?signature), VarPointsTo(?base,?baseheap), VarPointsTo(?from,?heap). StoreInstanceField(?from,?base,?signature)?base.?signature =?from InstanceFieldPointsTo(?baseheap,?signature,?heap) field?signature of object?baseheap may point to object?heap

60 datalog: semi-naive evaluation 13 InstanceFieldPointsTo(?baseheap,?signature,?heap) <- StoreInstanceField(?from,?base,?signature), VarPointsTo(?base,?baseheap), VarPointsTo(?from,?heap). i InstanceFieldPointsTo(?heap,?signature,?baseheap) <- StoreInstanceField(?from,?signature,?base), i 1 VarPointsTo(?base,?baseheap), VarPointsTo(?from,?heap).

61 datalog: semi-naive evaluation 13 InstanceFieldPointsTo(?baseheap,?signature,?heap) <- StoreInstanceField(?from,?base,?signature), VarPointsTo(?base,?baseheap), VarPointsTo(?from,?heap). i InstanceFieldPointsTo(?heap,?signature,?baseheap) <- StoreInstanceField(?from,?signature,?base), i 1 VarPointsTo(?base,?baseheap), VarPointsTo(?from,?heap). i InstanceFieldPointsTo(?heap,?signature,?baseheap) <- StoreInstanceField(?from,?signature,?base), VarPointsTo(?base,?baseheap), i 1 VarPointsTo(?from,?heap).

62 pointer analysis: implementation approaches 14 context-sensitive pointer analysis implementations paddle implemented in java + relational algebra + bdd wala implemented in java, conventional constraint-based bddbddb implemented in datalog + bdd (+ java)

63 pointer analysis: implementation approaches 14 context-sensitive pointer analysis implementations paddle implemented in java + relational algebra + bdd wala implemented in java, conventional constraint-based bddbddb implemented in datalog + bdd (+ java) not a single fully declarative specification

64 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog

65 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog Lhotak: [E]ncoding all the details of a complicated program analysis problem (such as the interrelated analyses [on-the-fly call graph construction, handling of Java features]) purely in terms of subset constraints may be difficult or impossible.

66 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory

67 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory Naik: All publicly available implementations of k-object sensitive alias analysis ran out of memory on most of our benchmarks for k=1

68 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory Naik: All publicly available implementations of k-object sensitive alias analysis ran out of memory on most of our benchmarks for k=1 Lhotak: Efficiently implementing a 1H-object-sensitive analysis without BDDs will require new improvements in the data structures and algorithms used to implement points-to analyses

69 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory Naik: All publicly available implementations of k-object sensitive alias analysis ran out of memory on most of our benchmarks for k=1 Lhotak: Efficiently implementing a 1H-object-sensitive analysis without BDDs will require new improvements in the data structures and algorithms used to implement points-to analyses Whaley: Owing to the power of the BDD data structure, bddbddb can even solve analysis problems that were previously intractable

70 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory Naik: All publicly available implementations of k-object sensitive alias analysis ran out of memory on most of our benchmarks for k=1 Lhotak: Efficiently implementing a 1H-object-sensitive analysis without BDDs will require new improvements in the data structures and algorithms used to implement points-to analyses Whaley: Owing to the power of the BDD data structure, bddbddb can even solve analysis problems that were previously intractable Lhotak: I ve never managed to get Paddle to run in available memory with these settings [2-cfa context-heap], at least not on real benchmarks complete with the standard library.

71 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results

72 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results Whaley: By using BDDs to represent relations, bddbddb can operate on entire relations at once, instead of iterating over individual tuples.

73 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results

74 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results

75 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results

76 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results

77 unconventional theses 15 sophisticated pointer analysis fully expressible in datalog explicit representation fits in memory semi-naive evaluation: performance size of results

78 benchmark: 1-call-site-sensitive+heap doop paddle analysis time (seconds) antlr bloat chart eclipse hsqldb jython luindex lusearch pmd xalan

79 benchmark: 1-call-site-sensitive+heap full order of magnitude faster! doop paddle 5000 analysis time (seconds) comparable: demonstrated equivalence of results! antlr bloat chart eclipse hsqldb jython luindex lusearch pmd xalan

80 where is the magic? 17 fully declarative everything is incremental efficient architecture for datalog engine but, not a magic tool! novel optimizations targeting recursive logic yet, relatively easy!

81 datalog engine architecture 18 interning "<java.lang.thread: void <clinit>()>" 32-bit int tuple compression call-graph edge: invocation method 64-bit int relations are indexes (b-trees) index-organized tables efficient representation of sparse relations alternative datastructures for (partially) dense relations indexes exposed in the language reverse argument order is index VarPointsTo(?var,?heap)

82 optimization principles 19 always use index efficiently Assign(?from,?to), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?from,?heap)

83 optimization principles 19 always use index efficiently Assign(?from,?to), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?from,?heap) never iterate over full views Assign(?to,?from), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?heap,?from)

84 optimization principles 19 always use index efficiently Assign(?from,?to), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?from,?heap) never iterate over full views Assign(?to,?from), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?heap,?from) never iterate over big input relations StoreInstanceField(?from,?signature,?base), VarPointsTo(?baseheap,?base), VarPointsTo(?heap,?from) we ll get back to that...

85 optimization principles 19 always use index efficiently Assign(?from,?to), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?from,?heap) never iterate over full views Assign(?to,?from), VarPointsTo(?from,?heap) Assign(?to,?from), VarPointsTo(?heap,?from) never iterate over big input relations StoreInstanceField(?from,?signature,?base), VarPointsTo(?baseheap,?base), iterate over delta VarPointsTo(?heap,?from) access big relations with we ll get back to that... index

86 optimization: variable ordering 20 unoptimized VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap). constraints Assign VarPointsTo 1. Assign 2. VarPointsTo -?from 1. VarPointsTo 2. Assign?from - optimized VarPointsTo(?heap,?to) <- Assign(?to,?from), VarPointsTo(?heap,?from).

87 optimization: variable ordering 20 unoptimized VarPointsTo(?to,?heap) <- Assign(?from,?to), VarPointsTo(?from,?heap). constraints Assign VarPointsTo 1. Assign 2. VarPointsTo -?from 1. VarPointsTo 2. Assign?from - optimized VarPointsTo(?heap,?to) <- Assign(?to,?from), VarPointsTo(?heap,?from). other join orderings not interesting: pruned immediately

88 optimization: folding 21 InstanceFieldPointsTo(?baseheap,?signature,?heap) <- StoreInstanceField(?from,?base,?signature), VarPointsTo 1 (?baseheap,?base), VarPointsTo 2 (?heap,?from). Store VarPointsTo 1 VarPointsTo 2 1. VarPointsTo 1 2. StoreInstanceField 3. VarPointsTo 2?base -?from 1. VarPointsTo 2 2. StoreInstanceField?from?base - 3. VarPointsTo 1

89 optimization: folding 21 InstanceFieldPointsTo(?baseheap,?signature,?heap) <- StoreInstanceField(?from,?base,?signature), VarPointsTo 1 (?baseheap,?base), VarPointsTo 2 (?heap,?from). Store VarPointsTo 1 VarPointsTo 2 1. VarPointsTo 1 2. StoreInstanceField 3. VarPointsTo 2?base -?from 1. VarPointsTo 2 2. StoreInstanceField 3. VarPointsTo 1?from?base - conflicting constraints! there is no efficient index.

90 optimization: folding 21 InstanceFieldPointsTo(?baseheap,?signature,?heap) <- StoreInstanceField(?from,?base,?signature), VarPointsTo 1 (?baseheap,?base), VarPointsTo 2 (?heap,?from). fold StoreInstanceField and VarPointsTo 1 to create an index: InstanceFieldPointsTo(?heap,?signature,?baseheap) <- StoreHeapInstanceField(?baseheap,?signature,?from), VarPointsTo(?heap,?from). StoreHeapInstanceField(?baseheap,?signature,?from) <- StoreInstanceField(?from,?signature,?base), VarPointsTo(?baseheap,?base). we have just introduced a materialized view!

91 precise exception analysis 22 method invocations: propagated exceptions ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

92 precise exception analysis 22 method invocations: propagated exceptions ˆ ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

93 precise exception analysis 22 method invocations: propagated exceptions ˆ ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

94 precise exception analysis 22 method invocations: propagated exceptions ˆ ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

95 precise exception analysis 22 method invocations: propagated exceptions ˆ ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

96 precise exception analysis 22 method invocations: propagated exceptions ˆ ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

97 precise exception analysis 22 method invocations: propagated exceptions ˆ ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

98 precise exception analysis 22 method invocations: propagated exceptions ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions ˆ VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

99 precise exception analysis 22 method invocations: propagated exceptions ThrowPointsTo(?heap,?callerMethod) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, not exists ExceptionHandler[?heaptype,?invocation], Instruction:Method[?invocation] =?callermethod. method invocations: caught exceptions ˆ VarPointsTo(?heap,?param) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?heap,?tomethod), HeapAllocation:Type[?heap] =?heaptype, ExceptionHandler[?heaptype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

100 declarative program analysis is paying off 23 declarativeness precise exception analysis sophisticated reflection analysis java references, finalization, threading, etc. high-level optimization hand-optimization not difficult potential automation automatic incrementalization naive evaluation would be horrible automatic memory management out-of-core analyses automatic parallelization very promising for program analysis

101 questions? 24

Software Challenges: Abstraction and Analysis

Software Challenges: Abstraction and Analysis Software Challenges: Abstraction and Analysis Martin Bravenboer University of Massachusetts Amherst University of Oregon April 2, 2009 University of Waterloo my research 1 the design and implementation

More information

Strictly Declarative Specification of Sophisticated Points-to Analyses

Strictly Declarative Specification of Sophisticated Points-to Analyses Strictly Declarative Specification of Sophisticated Points-to Analyses Martin Bravenboer Yannis Smaragdakis Department of Computer Science University of Massachusetts, Amherst Amherst, MA 13, USA martin.bravenboer@acm.org

More information

Less programming, more specification

Less programming, more specification Datalog: Properties Limited logic programming SQL with recursion Prolog without complex terms (constructors) Captures PTIME complexity class Strictly declarative as opposed dto Prolog conjunction commutative

More information

Hybrid Context-Sensitivity for Points-To Analysis

Hybrid Context-Sensitivity for Points-To Analysis Hybrid Context-Sensitivity for Points-To Analysis George Kastrinis Yannis Smaragdakis Department of Informatics University of Athens {gkastrinis,smaragd}@di.uoa.gr Abstract Context-sensitive points-to

More information

CO444H. Ben Livshits. Datalog Pointer analysis

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

More information

Cloning-Based Context-Sensitive Pointer Alias Analysis using BDDs

Cloning-Based Context-Sensitive Pointer Alias Analysis using BDDs More Pointer Analysis Last time Flow-Insensitive Pointer Analysis Inclusion-based analysis (Andersen) Today Class projects Context-Sensitive analysis March 3, 2014 Flow-Insensitive Pointer Analysis 1 John

More information

Averroes: Letting go of the library!

Averroes: Letting go of the library! Workshop on WALA - PLDI 15 June 13th, 2015 public class HelloWorld { public static void main(string[] args) { System.out.println("Hello, World!"); 2 public class HelloWorld { public static void main(string[]

More information

R O O T S Interprocedural Analysis

R O O T S Interprocedural Analysis R O O T S Interprocedural Analysis Aleksandra Biresev s6albire@cs.uni-bonn.de Interprocedural Analysis An interprocedural analysis operates across an entire program, flowing information from call sites

More information

}Optimization Formalisms for recursive queries. Module 11: Optimization of Recursive Queries. Module Outline Datalog

}Optimization Formalisms for recursive queries. Module 11: Optimization of Recursive Queries. Module Outline Datalog Module 11: Optimization of Recursive Queries 11.1 Formalisms for recursive queries Examples for problems requiring recursion: Module Outline 11.1 Formalisms for recursive queries 11.2 Computing recursive

More information

}Optimization. Module 11: Optimization of Recursive Queries. Module Outline

}Optimization. Module 11: Optimization of Recursive Queries. Module Outline Module 11: Optimization of Recursive Queries Module Outline 11.1 Formalisms for recursive queries 11.2 Computing recursive queries 11.3 Partial transitive closures User Query Transformation & Optimization

More information

Porting Doop to Soufflé: A Tale of Inter-Engine Portability for Datalog-Based Analyses

Porting Doop to Soufflé: A Tale of Inter-Engine Portability for Datalog-Based Analyses Porting Doop to Soufflé: A Tale of Inter-Engine Portability for Datalog-Based Analyses Tony Antoniadis Konstantinos Triantafyllou Yannis Smaragdakis Department of Informatics University of Athens, 15784,

More information

A Dynamic Evaluation of the Precision of Static Heap Abstractions

A Dynamic Evaluation of the Precision of Static Heap Abstractions A Dynamic Evaluation of the Precision of Static Heap Abstractions OOSPLA - Reno, NV October 20, 2010 Percy Liang Omer Tripp Mayur Naik Mooly Sagiv UC Berkeley Tel-Aviv Univ. Intel Labs Berkeley Tel-Aviv

More information

Introspective Analysis: Context-Sensitivity, Across the Board

Introspective Analysis: Context-Sensitivity, Across the Board Introspective Analysis: Context-Sensitivity, Across the Board Yannis Smaragdakis George Kastrinis George Balatsouras Department of Informatics University of Athens {smaragd,gkastrinis,gbalats}@di.uoa.gr

More information

A Simple SQL Injection Pattern

A Simple SQL Injection Pattern Lecture 12 Pointer Analysis 1. Motivation: security analysis 2. Datalog 3. Context-insensitive, flow-insensitive pointer analysis 4. Context sensitivity Readings: Chapter 12 A Simple SQL Injection Pattern

More information

Lecture Notes: Pointer Analysis

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

More information

Probabilistic Calling Context

Probabilistic Calling Context Probabilistic Calling Context Michael D. Bond Kathryn S. McKinley University of Texas at Austin Why Context Sensitivity? Static program location not enough at com.mckoi.db.jdbcserver.jdbcinterface.execquery():213

More information

Program Calling Context. Motivation

Program Calling Context. Motivation Program alling ontext Motivation alling context enhances program understanding and dynamic analyses by providing a rich representation of program location ollecting calling context can be expensive The

More information

Context-sensitive points-to analysis: is it worth it?

Context-sensitive points-to analysis: is it worth it? McGill University School of Computer Science Sable Research Group Context-sensitive points-to analysis: is it worth it? Sable Technical Report No. 2005-2 Ondřej Lhoták Laurie Hendren October 21, 2005 w

More information

Lu Fang, University of California, Irvine Liang Dou, East China Normal University Harry Xu, University of California, Irvine

Lu Fang, University of California, Irvine Liang Dou, East China Normal University Harry Xu, University of California, Irvine Lu Fang, University of California, Irvine Liang Dou, East China Normal University Harry Xu, University of California, Irvine 2015-07-09 Inefficient code regions [G. Jin et al. PLDI 2012] Inefficient code

More information

Scaling Abstraction Refinement via Pruning. PLDI - San Jose, CA June 8, 2011

Scaling Abstraction Refinement via Pruning. PLDI - San Jose, CA June 8, 2011 Scaling Abstraction Refinement via Pruning PLDI - San Jose, CA June 8, 2011 Percy Liang UC Berkeley Mayur Naik Intel Labs Berkeley The Big Picture Program 2 The Big Picture Program Static Analysis 2 The

More information

HYBRID CONTEXT-SENSITIVITY

HYBRID CONTEXT-SENSITIVITY HYBRID CONTEXT-SENSITIVITY FOR POINTS-TO ANALYSIS George Kastrinis Summer Intern @ Yannis Smaragdakis University of Athens EXECUTIVE SUMMARY Hybrid: Combine Call-Site & Object sensitivity Naively keeping

More information

Pointer Analysis. Yannis Smaragdakis University of Athens George Balatsouras University of Athens

Pointer Analysis. Yannis Smaragdakis University of Athens George Balatsouras University of Athens Foundations and Trends R in Programming Languages Vol. 2, No. 1 (2015) 1 69 c 2015 Y. Smaragdakis and G. Balatsouras DOI: 10.1561/2500000014 Pointer Analysis Yannis Smaragdakis University of Athens smaragd@di.uoa.gr

More information

On Abstraction Refinement for Program Analyses in Datalog

On Abstraction Refinement for Program Analyses in Datalog On Abstraction Refinement for Program Analyses in Datalog Xin Zhang Ravi Mangal Radu Grigore Mayur Naik Hongseok Yang Georgia Institute of Technology Oxford University Abstract A central task for a program

More information

Pointer Analysis. Lecture 40 (adapted from notes by R. Bodik) 5/2/2008 Prof. P. N. Hilfinger CS164 Lecture 40 1

Pointer Analysis. Lecture 40 (adapted from notes by R. Bodik) 5/2/2008 Prof. P. N. Hilfinger CS164 Lecture 40 1 Pointer Analysis Lecture 40 (adapted from notes by R. Bodik) 5/2/2008 Prof. P. N. Hilfinger CS164 Lecture 40 1 2 Today Points-to analysis an instance of static analysis for understanding pointers Andersen

More information

Context-sensitive points-to analysis: is it worth it?

Context-sensitive points-to analysis: is it worth it? Context-sensitive points-to analysis: is it worth it? Ondřej Lhoták 1,2 and Laurie Hendren 2 olhotak@uwaterloo.ca hendren@sable.mcgill.ca 1 School of Computer Science, University of Waterloo, Waterloo,

More information

Pick Your Contexts Well: Understanding Object-Sensitivity

Pick Your Contexts Well: Understanding Object-Sensitivity Pick Your Contexts Well: Understanding Object-Sensitivity The Making of a Precise and Scalable Pointer Analysis Yannis Smaragdakis Department of Computer Science, University of Massachusetts, Amherst,

More information

Flow-sensitive Alias Analysis

Flow-sensitive Alias Analysis Flow-sensitive Alias Analysis Last time Client-Driven pointer analysis Today Demand DFA paper Scalable flow-sensitive alias analysis March 30, 2015 Flow-Sensitive Alias Analysis 1 Recall Previous Flow-Sensitive

More information

Effective Static Race Detection for Java. Part I. Chord. Chord. Chord. Chord - Overview. Problems addressed

Effective Static Race Detection for Java. Part I. Chord. Chord. Chord. Chord - Overview. Problems addressed Eective Static Race Detection or Java Mayer Naik, Alex Aiken, John Whaley Part I Introduction to Chord and Preliminaries presented by Matt McGill Chord Chord Chord is a static (data) race detection tool

More information

Alias Analysis. Last time Interprocedural analysis. Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1

Alias Analysis. Last time Interprocedural analysis. Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1 Alias Analysis Last time Interprocedural analysis Today Intro to alias analysis (pointer analysis) CS553 Lecture Alias Analysis I 1 Aliasing What is aliasing? When two expressions denote the same mutable

More information

Compiler Construction 2009/2010 SSA Static Single Assignment Form

Compiler Construction 2009/2010 SSA Static Single Assignment Form Compiler Construction 2009/2010 SSA Static Single Assignment Form Peter Thiemann March 15, 2010 Outline 1 Static Single-Assignment Form 2 Converting to SSA Form 3 Optimization Algorithms Using SSA 4 Dependencies

More information

Making Context-sensitive Points-to Analysis with Heap Cloning Practical For The Real World

Making Context-sensitive Points-to Analysis with Heap Cloning Practical For The Real World Making Context-sensitive Points-to Analysis with Heap Cloning Practical For The Real World Chris Lattner Apple Andrew Lenharth UIUC Vikram Adve UIUC What is Heap Cloning? Distinguish objects by acyclic

More information

Encyclopedia of Database Systems, Editors-in-chief: Özsu, M. Tamer; Liu, Ling, Springer, MAINTENANCE OF RECURSIVE VIEWS. Suzanne W.

Encyclopedia of Database Systems, Editors-in-chief: Özsu, M. Tamer; Liu, Ling, Springer, MAINTENANCE OF RECURSIVE VIEWS. Suzanne W. Encyclopedia of Database Systems, Editors-in-chief: Özsu, M. Tamer; Liu, Ling, Springer, 2009. MAINTENANCE OF RECURSIVE VIEWS Suzanne W. Dietrich Arizona State University http://www.public.asu.edu/~dietrich

More information

Configurable Software Model Checking

Configurable Software Model Checking Configurable Software Model Checking CPAchecker Dirk Beyer Dirk Beyer 1 / 26 Software Verification C Program int main() { int a = foo(); int b = bar(a); } assert(a == b); Verification Tool TRUE i.e., specification

More information

CS 3 Introduction to Software Engineering. 3: Exceptions

CS 3 Introduction to Software Engineering. 3: Exceptions CS 3 Introduction to Software Engineering 3: Exceptions Questions? 2 Objectives Last Time: Procedural Abstraction This Time: Procedural Abstraction II Focus on Exceptions. Starting Next Time: Data Abstraction

More information

µz An Efficient Engine for Fixed Points with Constraints

µz An Efficient Engine for Fixed Points with Constraints µz An Efficient Engine for Fixed Points with Constraints Kryštof Hoder, Nikolaj Bjørner, and Leonardo de Moura Manchester University and Microsoft Research Abstract. The µz tool is a scalable, efficient

More information

Chronicler: Lightweight Recording to Reproduce Field Failures

Chronicler: Lightweight Recording to Reproduce Field Failures Chronicler: Lightweight Recording to Reproduce Field Failures Jonathan Bell, Nikhil Sarda and Gail Kaiser Columbia University, New York, NY USA What happens when software crashes? Stack Traces Aren

More information

Elfen Scheduling. Fine-Grain Principled Borrowing from Latency-Critical Workloads using Simultaneous Multithreading (SMT) Xi Yang

Elfen Scheduling. Fine-Grain Principled Borrowing from Latency-Critical Workloads using Simultaneous Multithreading (SMT) Xi Yang Elfen Scheduling Fine-Grain Principled Borrowing from Latency-Critical Workloads using Simultaneous Multithreading (SMT) Xi Yang Australian National University Stephen M Blackburn Australian National University

More information

Refinement-Based Context-Sensitive Points-To Analysis for Java

Refinement-Based Context-Sensitive Points-To Analysis for Java Refinement-Based Context-Sensitive Points-To Analysis for Java Manu Sridharan, Rastislav Bodík UC Berkeley PLDI 2006 1 What Does Refinement Buy You? Increased scalability: enable new clients Memory: orders

More information

Strong Update for Object-Oriented Flow-Sensitive Points-To Analysis

Strong Update for Object-Oriented Flow-Sensitive Points-To Analysis Strong Update for Object-Oriented Flow-Sensitive Points-To Analysis The Harvard community has made this article openly available. Please share how this access benefits you. Your story matters Citation

More information

Field Analysis. Last time Exploit encapsulation to improve memory system performance

Field Analysis. Last time Exploit encapsulation to improve memory system performance Field Analysis Last time Exploit encapsulation to improve memory system performance This time Exploit encapsulation to simplify analysis Two uses of field analysis Escape analysis Object inlining April

More information

An Efficient Storeless Heap Abstraction Using SSA Form

An Efficient Storeless Heap Abstraction Using SSA Form An Efficient Storeless Heap Abstraction Using SSA Form Nomair A. Naeem Ondřej Lhoták D. R. Cheriton School of Computer Science University of Waterloo, Canada {nanaeem,olhotak}@uwaterloo.ca Abstract Precise,

More information

Trace-based JIT Compilation

Trace-based JIT Compilation Trace-based JIT Compilation Hiroshi Inoue, IBM Research - Tokyo 1 Trace JIT vs. Method JIT https://twitter.com/yukihiro_matz/status/533775624486133762 2 Background: Trace-based Compilation Using a Trace,

More information

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University

Static Program Analysis Part 9 pointer analysis. Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Static Program Analysis Part 9 pointer analysis Anders Møller & Michael I. Schwartzbach Computer Science, Aarhus University Agenda Introduction to points-to analysis Andersen s analysis Steensgaards s

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages CMSC330 Fall 2017 OCaml Data Types CMSC330 Fall 2017 1 OCaml Data So far, we ve seen the following kinds of data Basic types (int, float, char, string) Lists

More information

New Algorithms for Static Analysis via Dyck Reachability

New Algorithms for Static Analysis via Dyck Reachability New Algorithms for Static Analysis via Dyck Reachability Andreas Pavlogiannis 4th Inria/EPFL Workshop February 15, 2018 A. Pavlogiannis New Algorithms for Static Analysis via Dyck Reachability 2 A. Pavlogiannis

More information

Interprocedural Analysis with Data-Dependent Calls. Circularity dilemma. A solution: optimistic iterative analysis. Example

Interprocedural Analysis with Data-Dependent Calls. Circularity dilemma. A solution: optimistic iterative analysis. Example Interprocedural Analysis with Data-Dependent Calls Circularity dilemma In languages with function pointers, first-class functions, or dynamically dispatched messages, callee(s) at call site depend on data

More information

Lecture 26: Pointer Analysis

Lecture 26: Pointer Analysis [Based on slides from R. Bodik] Lecture 26: Pointer Analysis Administrivia HKN survey next Thursday. Worth 5 points (but you must show up!). Today Points-to analysis: an instance of static analysis for

More information

Lecture 26: Pointer Analysis. General Goals of Static Analysis. Client 1: Example. Client 1: Optimizing virtual calls in Java

Lecture 26: Pointer Analysis. General Goals of Static Analysis. Client 1: Example. Client 1: Optimizing virtual calls in Java [Based on slides from R. Bodik] Administrivia Lecture 26: Pointer Analysis HKN survey next Thursday. Worth 5 points (but you must show up!). Today Points-to analysis: an instance of static analysis for

More information

Lecture 14 Pointer Analysis

Lecture 14 Pointer Analysis Lecture 14 Pointer Analysis Basics Design Options Pointer Analysis Algorithms Pointer Analysis Using BDDs Probabilistic Pointer Analysis [ALSU 12.4, 12.6-12.7] Phillip B. Gibbons 15-745: Pointer Analysis

More information

One of Mike s early tests cases involved the following code, which produced the error message about something being really wrong:

One of Mike s early tests cases involved the following code, which produced the error message about something being really wrong: Problem 1 (3 points) While working on his solution to project 2, Mike Clancy encountered an interesting bug. His program includes a LineNumber class that supplies, among other methods, a constructor that

More information

CSE 501 Midterm Exam: Sketch of Some Plausible Solutions Winter 1997

CSE 501 Midterm Exam: Sketch of Some Plausible Solutions Winter 1997 1) [10 pts] On homework 1, I asked about dead assignment elimination and gave the following sample solution: 8. Give an algorithm for dead assignment elimination that exploits def/use chains to work faster

More information

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler Hiroshi Inoue, Hiroshige Hayashizaki, Peng Wu and Toshio Nakatani IBM Research Tokyo IBM Research T.J. Watson Research Center April

More information

Cloning-Based Context-Sensitive Pointer Alias Analysis Using Binary Decision Diagrams

Cloning-Based Context-Sensitive Pointer Alias Analysis Using Binary Decision Diagrams Cloning-Based Context-Sensitive Pointer Alias Analysis Using Binary Decision Diagrams John Whaley Monica S. Lam Computer Science Department Stanford University Stanford, CA 94305 {jwhaley, lam}@stanford.edu

More information

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology

Interprocedural Analysis. Dealing with Procedures. Course so far: Terminology Interprocedural Analysis Course so far: Control Flow Representation Dataflow Representation SSA form Classic DefUse and UseDef Chains Optimizations Scheduling Register Allocation Just-In-Time Compilation

More information

Calvin Lin The University of Texas at Austin

Calvin Lin The University of Texas at Austin Interprocedural Analysis Last time Introduction to alias analysis Today Interprocedural analysis March 4, 2015 Interprocedural Analysis 1 Motivation Procedural abstraction Cornerstone of programming Introduces

More information

Modern and Lucid C++ Advanced for Professional Programmers. Part 3 Move Semantics. Department I - C Plus Plus Advanced

Modern and Lucid C++ Advanced for Professional Programmers. Part 3 Move Semantics. Department I - C Plus Plus Advanced Department I - C Plus Plus Advanced Modern and Lucid C++ Advanced for Professional Programmers Part 3 Move Semantics Thomas Corbat / Prof. Peter Sommerlad Rapperswil, 09.03.2018 HS2018 Move Semantics 2

More information

Deductive Databases. Motivation. Datalog. Chapter 25

Deductive Databases. Motivation. Datalog. Chapter 25 Deductive Databases Chapter 25 1 Motivation SQL-92 cannot express some queries: Are we running low on any parts needed to build a ZX600 sports car? What is the total component and assembly cost to build

More information

Foundations of Databases

Foundations of Databases Foundations of Databases Free University of Bozen Bolzano, 2004 2005 Thomas Eiter Institut für Informationssysteme Arbeitsbereich Wissensbasierte Systeme (184/3) Technische Universität Wien http://www.kr.tuwien.ac.at/staff/eiter

More information

Taming the Wildcards

Taming the Wildcards Taming the Wildcards Combining Definition- and Use-Site Variance John Altidor 1, Shan Shan Huang 2, and Yannis Smaragdakis 1,3 University of Massachusetts Amherst 1 LogicBlox Inc. 2 University of Athens,

More information

Combining the Logical and the Probabilistic in Program Analysis. Xin Zhang Xujie Si Mayur Naik University of Pennsylvania

Combining the Logical and the Probabilistic in Program Analysis. Xin Zhang Xujie Si Mayur Naik University of Pennsylvania Combining the Logical and the Probabilistic in Program Analysis Xin Zhang Xujie Si Mayur Naik University of Pennsylvania What is Program Analysis? int f(int i) {... } Program Analysis x may be null!...

More information

On Fast Large-Scale Program Analysis in Datalog

On Fast Large-Scale Program Analysis in Datalog On Fast Large-Scale Program Analysis in Datalog Bernhard Scholz Oracle Labs, Australia bernhard.scholz@sydney.edu.au Herbert Jordan Oracle Labs, Australia herbert@dps.uibk.ac.at Pavle Subotić University

More information

Programming Languages

Programming Languages Programming Languages Tevfik Koşar Lecture - XVIII March 23 rd, 2006 1 Roadmap Arrays Pointers Lists Files and I/O 2 1 Arrays Two layout strategies for arrays Contiguous elements Row pointers Row pointers

More information

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers

Interprocedural Analysis. Motivation. Interprocedural Analysis. Function Calls and Pointers Interprocedural Analysis Motivation Last time Introduction to alias analysis Today Interprocedural analysis Procedural abstraction Cornerstone of programming Introduces barriers to analysis Example x =

More information

SociaLite: A Datalog-based Language for

SociaLite: A Datalog-based Language for SociaLite: A Datalog-based Language for Large-Scale Graph Analysis Jiwon Seo M OBIS OCIAL RESEARCH GROUP Overview Overview! SociaLite: language for large-scale graph analysis! Extensions to Datalog! Compiler

More information

Software Design and Analysis for Engineers

Software Design and Analysis for Engineers Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 9 Date:

More information

Research Statement. 1 My Approach to Research. John Whaley January 2005

Research Statement. 1 My Approach to Research. John Whaley January 2005 Research Statement John Whaley January 2005 1 My Approach to Research As a child, I was always interested in building things. When I was six years old, I taught myself programming by typing in programs

More information

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8 Subroutines and Control Abstraction Textbook, Chapter 8 1 Subroutines and Control Abstraction Mechanisms for process abstraction Single entry (except FORTRAN, PL/I) Caller is suspended Control returns

More information

Siloed Reference Analysis

Siloed Reference Analysis Siloed Reference Analysis Xing Zhou 1. Objectives: Traditional compiler optimizations must be conservative for multithreaded programs in order to ensure correctness, since the global variables or memory

More information

Pointer Analysis in the Presence of Dynamic Class Loading. Hind Presented by Brian Russell

Pointer Analysis in the Presence of Dynamic Class Loading. Hind Presented by Brian Russell Pointer Analysis in the Presence of Dynamic Class Loading Martin Hirzel, Amer Diwan and Michael Hind Presented by Brian Russell Claim: First nontrivial pointer analysis dealing with all Java language features

More information

Program Analysis in Datalog

Program Analysis in Datalog CS 510/08 Program Analysis in Datalog Majority of the slides compiled from John Whaley s Outline Challenges Essential Background Using the Tools Developing Advanced Analyses Challenges Most DF analyses

More information

Le L c e t c ur u e e 5 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Exception Handling

Le L c e t c ur u e e 5 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Exception Handling Course Name: Advanced Java Lecture 5 Topics to be covered Exception Handling Exception HandlingHandlingIntroduction An exception is an abnormal condition that arises in a code sequence at run time A Java

More information

redis-lua Documentation

redis-lua Documentation redis-lua Documentation Release 2.0.8 Julien Kauffmann October 12, 2016 Contents 1 Quick start 3 1.1 Step-by-step analysis........................................... 3 2 What s the magic at play here?

More information

Pointer Analysis for C/C++ with cclyzer. George Balatsouras University of Athens

Pointer Analysis for C/C++ with cclyzer. George Balatsouras University of Athens Pointer Analysis for C/C++ with cclyzer George Balatsouras University of Athens Analyzes C/C++ programs translated to LLVM Bitcode Declarative framework Analyzes written in Datalog

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC 330 - Spring 2013 1 Memory Attributes! Memory to store data in programming languages has the following lifecycle

More information

Constructing Control Flow Graph for Java by Decoupling Exception Flow from Normal Flow

Constructing Control Flow Graph for Java by Decoupling Exception Flow from Normal Flow Constructing Control Flow Graph for Java by Decoupling Exception Flow from Normal Flow Jang-Wu Jo 1 and Byeong-Mo Chang 2 1 Department of Computer Engineering Pusan University of Foreign Studies Pusan

More information

Alias Analysis with bddbddb

Alias Analysis with bddbddb Alias Analysis with bddbddb Kevin Bierhoff kevin.bierhoff [at] cs.cmu.edu Star Project Report 17-754 Analysis of Software Artifacts Spring 2005 Abstract Context-sensitive inclusion-based alias analysis

More information

Control in Sequential Languages

Control in Sequential Languages CS 242 2012 Control in Sequential Languages Reading: Chapter 8, Sections 8.1 8.3 (only) Section 7.3 of The Haskell 98 Report, Exception Handling in the I/O Monad, http://www.haskell.org/onlinelibrary/io-13.html

More information

Compilers. 8. Run-time Support. Laszlo Böszörmenyi Compilers Run-time - 1

Compilers. 8. Run-time Support. Laszlo Böszörmenyi Compilers Run-time - 1 Compilers 8. Run-time Support Laszlo Böszörmenyi Compilers Run-time - 1 Run-Time Environment A compiler needs an abstract model of the runtime environment of the compiled code It must generate code for

More information

Adaptive Multi-Level Compilation in a Trace-based Java JIT Compiler

Adaptive Multi-Level Compilation in a Trace-based Java JIT Compiler Adaptive Multi-Level Compilation in a Trace-based Java JIT Compiler Hiroshi Inoue, Hiroshige Hayashizaki, Peng Wu and Toshio Nakatani IBM Research Tokyo IBM Research T.J. Watson Research Center October

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4020 July 5, 2007 14.00-15.30 This exam (8 pages) consists of 60 True/False

More information

Advanced Systems Programming

Advanced Systems Programming Advanced Systems Programming Introduction to C++ Martin Küttler September 19, 2017 1 / 18 About this presentation This presentation is not about learning programming or every C++ feature. It is a short

More information

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection CMSC 330: Organization of Programming Languages Memory Management and Garbage Collection CMSC330 Fall 2018 1 Memory Attributes Memory to store data in programming languages has the following lifecycle

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

CS153: Compilers Lecture 15: Local Optimization

CS153: Compilers Lecture 15: Local Optimization CS153: Compilers Lecture 15: Local Optimization Stephen Chong https://www.seas.harvard.edu/courses/cs153 Announcements Project 4 out Due Thursday Oct 25 (2 days) Project 5 out Due Tuesday Nov 13 (21 days)

More information

Optimizer. Defining and preserving the meaning of the program

Optimizer. Defining and preserving the meaning of the program Where are we? Well understood Engineering Source Code Front End IR Optimizer IR Back End Machine code Errors The latter half of a compiler contains more open problems, more challenges, and more gray areas

More information

arxiv: v1 [cs.pl] 23 Apr 2013

arxiv: v1 [cs.pl] 23 Apr 2013 Interprocedural Data Flow Analysis in Soot using Value Contexts Rohan Padhye Indian Institute of Technology Bombay rohanpadhye@iitb.ac.in Uday P. Khedker Indian Institute of Technology Bombay uday@cse.iitb.ac.in

More information

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst

Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Operating Systems CMPSCI 377, Lec 2 Intro to C/C++ Prashant Shenoy University of Massachusetts Amherst Department of Computer Science Why C? Low-level Direct access to memory WYSIWYG (more or less) Effectively

More information

Bottom-up Context-Sensitive Pointer Analysis for Java

Bottom-up Context-Sensitive Pointer Analysis for Java Bottom-up Context-Sensitive Pointer Analysis for Java Yu Feng, Xinyu Wang, Isil Dillig and Thomas Dillig UT Austin 1 What is this talk about? Pointer analysis Given a program variable v, what are the heap

More information

String Deduplication for Java-based Middleware in Virtualized Environments

String Deduplication for Java-based Middleware in Virtualized Environments String Deduplication for Java-based Middleware in Virtualized Environments Michihiro Horie, Kazunori Ogata, Kiyokuni Kawachiya, Tamiya Onodera IBM Research - Tokyo Duplicated strings found on Web Application

More information

Towards Parallel, Scalable VM Services

Towards Parallel, Scalable VM Services Towards Parallel, Scalable VM Services Kathryn S McKinley The University of Texas at Austin Kathryn McKinley Towards Parallel, Scalable VM Services 1 20 th Century Simplistic Hardware View Faster Processors

More information

Project Compiler. CS031 TA Help Session November 28, 2011

Project Compiler. CS031 TA Help Session November 28, 2011 Project Compiler CS031 TA Help Session November 28, 2011 Motivation Generally, it s easier to program in higher-level languages than in assembly. Our goal is to automate the conversion from a higher-level

More information

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam Compilers Type checking Yannis Smaragdakis, U. Athens (original slides by Sam Guyer@Tufts) Summary of parsing Parsing A solid foundation: context-free grammars A simple parser: LL(1) A more powerful parser:

More information

Evaluating Design Tradeoffs in Numeric Static Analysis for Java

Evaluating Design Tradeoffs in Numeric Static Analysis for Java Evaluating Design Tradeoffs in Numeric Static Analysis for Java Shiyi Wei 1(B), Piotr Mardziel 2, Andrew Ruef 3,JeffreyS.Foster 3, and Michael Hicks 3 1 The University of Texas at Dallas, Richardson, USA

More information

CS107 Handout 43 Spring 2007 June 8 th, 2007 CS107 Final Exam

CS107 Handout 43 Spring 2007 June 8 th, 2007 CS107 Final Exam CS107 Handout 43 Spring 2007 June 8 th, 2007 CS107 Final Exam This is an open-note exam. You can refer to any course handouts, handwritten lecture notes, and printouts of any code relevant to a CS107 assignment.

More information

CS553 Lecture Dynamic Optimizations 2

CS553 Lecture Dynamic Optimizations 2 Dynamic Optimizations Last time Predication and speculation Today Dynamic compilation CS553 Lecture Dynamic Optimizations 2 Motivation Limitations of static analysis Programs can have values and invariants

More information

Compact and Efficient Strings for Java

Compact and Efficient Strings for Java Compact and Efficient Strings for Java Christian Häubl, Christian Wimmer, Hanspeter Mössenböck Institute for System Software, Christian Doppler Laboratory for Automated Software Engineering, Johannes Kepler

More information

Chapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved.

Chapter 9. Exception Handling. Copyright 2016 Pearson Inc. All rights reserved. Chapter 9 Exception Handling Copyright 2016 Pearson Inc. All rights reserved. Last modified 2015-10-02 by C Hoang 9-2 Introduction to Exception Handling Sometimes the best outcome can be when nothing unusual

More information

SCIRun Developer Guide

SCIRun Developer Guide SCIRun Developer Guide SCIRun 4.7 Documentation Center for Integrative Biomedical Computing Scientific Computing & Imaging Institute University of Utah SCIRun software download: http://software.sci.utah.edu

More information

Using Datalog with Binary Decision Diagrams for Program Analysis

Using Datalog with Binary Decision Diagrams for Program Analysis Using Datalog with Binary Decision Diagrams for Program Analysis John Whaley, Dzintars Avots, Michael Carbin, and Monica S. Lam Computer Science Department Stanford University Stanford, CA 94305, USA {jwhaley,

More information

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides

Acknowledgements These slides are based on Kathryn McKinley s slides on garbage collection as well as E Christopher Lewis s slides Garbage Collection Last time Compiling Object-Oriented Languages Today Motivation behind garbage collection Garbage collection basics Garbage collection performance Specific example of using GC in C++

More information