Software Challenges: Abstraction and Analysis

Size: px
Start display at page:

Download "Software Challenges: Abstraction and Analysis"

Transcription

1 Software Challenges: Abstraction and Analysis Martin Bravenboer University of Massachusetts Amherst University of Oregon April 2, 2009 University of Waterloo

2 my research 1 the design and implementation of programming language features and software engineering tools for solving software development problems

3 my research 2 extensible and domain-specific languages brief overview program transformation no time : ( program analysis latest work, rest of the talk

4 examples of poor abstraction and language integration

5 example 1: embedding in string literals 3 String username = getparam("username"); String password = getparam("password"); String query = "SELECT id FROM users " + "WHERE name = " + username + " " + "AND password = " + password + " "; if (executequery(query).size() == 0) throw new Exception("bad user/password");

6 example 1: embedding in string literals 3 String username = getparam("username"); String password = getparam("password"); String query = "SELECT id FROM users " + "WHERE name = " + username + " " + "AND password = " + password + " "; if (executequery(query).size() == 0) throw new Exception("bad user/password"); password ilovewaterloo SELECT id FROM users WHERE name = martin AND password = ilovewaterloo

7 example 1: embedding in string literals 3 String username = getparam("username"); String password = getparam("password"); String query = "SELECT id FROM users " + "WHERE name = " + username + " " + "AND password = " + password + " "; if (executequery(query).size() == 0) throw new Exception("bad user/password"); password OR x = x SELECT id FROM users WHERE name = dr.evil AND password = OR x = x

8 example 2: implement a graphical user-interface 4

9 example 2: implement a graphical user-interface 4 north center south

10 example 2: implement a graphical user-interface 4 north center south east

11 example 2: implement a graphical user-interface 5 public class HelloWorld { public static void main(string[] ps) { JTextArea text = new JTextArea(20,40); JPanel panel = new JPanel(new BorderLayout(12,12)); panel.add(borderlayout.north, new JLabel("Hello World")); panel.add(borderlayout.center, new JScrollPane(text)); JPanel south = new JPanel(new BorderLayout(12,12)); JPanel buttons = new JPanel(new GridLayout(1, 2, 12, 12)); buttons.add(new JButton("Ok")); buttons.add(new JButton("Cancel")); south.add(borderlayout.east, buttons); panel.add(borderlayout.south, south);...

12 example 2: implement a graphical user-interface 5 public class HelloWorld { public static void main(string[] ps) { JTextArea text = new JTextArea(20,40); JPanel panel = new JPanel(new BorderLayout(12,12)); panel.add(borderlayout.north, new JLabel("Hello World")); panel.add(borderlayout.center, new JScrollPane(text)); JPanel south = new JPanel(new BorderLayout(12,12)); JPanel buttons = new JPanel(new GridLayout(1, 2, 12, 12)); buttons.add(new JButton("Ok")); buttons.add(new JButton("Cancel")); south.add(borderlayout.east, buttons); panel.add(borderlayout.south, south);...

13 example 2: implement a graphical user-interface 5 public class HelloWorld { public static void main(string[] ps) { JTextArea text = new JTextArea(20,40); JPanel panel = new JPanel(new BorderLayout(12,12)); panel.add(borderlayout.north, new JLabel("Hello World")); panel.add(borderlayout.center, new JScrollPane(text)); JPanel south = new JPanel(new BorderLayout(12,12)); JPanel buttons = new JPanel(new GridLayout(1, 2, 12, 12)); buttons.add(new JButton("Ok")); buttons.add(new JButton("Cancel")); south.add(borderlayout.east, buttons); Does not correspond to panel.add(borderlayout.south, south);... hierarchical structure of the user-interface.

14 example 2: implement a graphical user-interface 5 public class HelloWorld { General-purpose languages do not give public static void main(string[] you the means ps) { to write coherent sentences over the vocabulary of an API JTextArea text = new JTextArea(20,40); JPanel panel = new JPanel(new BorderLayout(12,12)); panel.add(borderlayout.north, new JLabel("Hello World")); panel.add(borderlayout.center, new JScrollPane(text)); JPanel south = new JPanel(new BorderLayout(12,12)); JPanel buttons = new JPanel(new GridLayout(1, 2, 12, 12)); buttons.add(new JButton("Ok")); buttons.add(new JButton("Cancel")); south.add(borderlayout.east, buttons); Does not correspond to panel.add(borderlayout.south, south);... hierarchical structure of the user-interface.

15 example 3: libraries as half-baked languages 6 public void testbuyswhenpriceequalsthreshold() { mainframe.expects(once()).method("buy").with(eq(quantity)).will(returnvalue(ticket)); auditing.expects(once()).method("bought").with(same(ticket)); agent.onpricechange(threshold); }

16 example 3: libraries as half-baked languages 6 public void testbuyswhenpriceequalsthreshold() { mainframe.expects(once()).method("buy").with(eq(quantity)).will(returnvalue(ticket)); auditing.expects(once()).method("bought").with(same(ticket)); } agent.onpricechange(threshold); general-purpose languages are not designed for writing coherent sentences in a domain-specific language

17 example 4: failed effort for specific combinations 7 class Foo { pointcut foo() : call(boolean *.if*()); }

18 example 4: failed effort for specific combinations 7 class Foo { pointcut foo() : call(boolean *.if*()); } $ajc Foo.java Foo.java:2 [error] Syntax error on token "if", invalid allowable token in pointcut or type pattern

19 example 4: failed effort for specific combinations 7 class Foo { pointcut foo() : call(boolean *.if*()); } $ajc Foo.java Foo.java:2 [error] Syntax error on token "if", invalid allowable token in pointcut or type pattern class Foo { pointcut foo() : } call(void *0.Ef());

20 example 4: failed effort for specific combinations 7 class Foo { pointcut foo() : call(boolean *.if*()); } $ajc Foo.java Foo.java:2 [error] Syntax error on token "if", invalid allowable token in pointcut or type pattern class Foo { pointcut foo() : } call(void *0.Ef()); $ajc Foo.java Foo.java:2 [error] Invalid float literal number pointcut foo() : call(void *0.Ef()); ^

21 improved abstraction with embedded domain-specific languages

22 example 1: preventing injection attacks 8 java and sql String q = "SELECT id FROM users " + "WHERE name = " + username + " " + "AND password = " + password + " "; if (executequery(q.tostring()).size() == 0)... SQL q = < SELECT id FROM users WHERE name = ${username} AND password = ${password} >; if (executequery(q.tostring()).size() == 0)...

23 example 1: preventing injection attacks 9 php and shell commands $command = "svn cat \"file name\" -r". $rev; system($command); $command = < svn cat "file name" -r${$rev} >; system($command->tostring()); java and ldap String q = "(cn=" + name + ")"; LDAP q = ( (cn=$(name)) );

24 example 2: implement a graphical user-interface 10

25 example 2: implement a graphical user-interface 10 north center south east

26 example 2: implement a graphical user-interface 11 public static void main(string[] ps) { JPanel panel = panel of border layout { north = label "Hello World" center = scrollpane of textarea { rows = 20 columns = 40 } south = panel of border layout { east = panel of grid layout { row = { button "Ok" button "Cancel" } } } };...

27 example 2: implement a graphical user-interface 11 public static void main(string[] ps) { JPanel panel = panel of border layout { north = label "Hello World" center = scrollpane of textarea { rows = 20 columns = 40 } south = panel of border layout { east = panel of grid layout { row = { button "Ok" button "Cancel" } } } };... Syntax reflects the hierarchical structure of the user-interface The interaction between the domain-specific and generalpurpose code is seamless

28 we need to fundamentally change the way we develop grammars

29 technical challenge: grammar composition 12 java grm sql grm

30 technical challenge: grammar composition 12 java grm sql grm developer java+sql grammar

31 technical challenge: grammar composition 12 java grm sql grm developer java+sql grammar generate java+sql parser

32 technical challenge: grammar composition 12 java grm sql grm developer generate java+sql grammar java+sql parser scanners do not compose complex stateful scanners and/or bugs lr grammars do not compose rewrite grammar to resolve conflicts

33 technical challenge: grammar composition 12 java grm sql grm java grm sql grm developer compose java+sql grammar java+sql grammar generate java+sql parser

34 technical challenge: grammar composition 12 java grm sql grm java grm sql grm developer compose java+sql grammar java+sql grammar generate generate java+sql parser java+sql parser

35 technical challenge: grammar composition 12 java grm sql grm java grm sql grm developer compose java+sql grammar java+sql grammar generate generate java+sql parser java+sql parser scanners do not compose scannerless parser lr grammars do not compose cfg, generalized lr

36 technical challenge: parse table composition 13 java grm sql grm

37 technical challenge: parse table composition 13 java grm sql grm compose java+sql grammar

38 technical challenge: parse table composition 13 java grm sql grm compose java+sql grammar generate java+sql parser

39 technical challenge: parse table composition 13 java grm sql grm java grm sql grm compose generate java+sql grammar java tbl sql tbl generate java+sql parser

40 technical challenge: parse table composition 13 java grm sql grm java grm sql grm compose generate java+sql grammar java tbl sql tbl generate compose java+sql parser java+sql parser

41 technical challenge: parse table composition 13 java grm sql grm java grm sql grm compose generate java+sql grammar java tbl sql tbl generate compose java+sql parser java+sql parser from source-level extensibility to binary extensibility algorithm: minimize DFA reconstruction

42 my research 14 extensible and domain-specific languages program transformation program analysis

43 my research 14 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] >100 citations best paper program transformation program analysis

44 my research 14 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] preventing injection attacks [GPCE 2007, SCP 2009] program transformation program analysis

45 my research 14 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] preventing injection attacks [GPCE 2007, SCP 2009] parse table composition [SLE 2008] program transformation program analysis

46 my research 14 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] preventing injection attacks [GPCE 2007, SCP 2009] parse table composition [SLE 2008] program transformation stratego/xt transformation system [PEPM 2006, FI 2006, SCP 2008] program analysis

47 my research 14 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] preventing injection attacks [GPCE 2007, SCP 2009] parse table composition [SLE 2008] program transformation stratego/xt transformation system [PEPM 2006, FI 2006, SCP 2008] grammar engineering [LDTA 2007] program analysis

48 my research 14 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] preventing injection attacks [GPCE 2007, SCP 2009] parse table composition [SLE 2008] program transformation stratego/xt transformation system [PEPM 2006, FI 2006, SCP 2008] grammar engineering [LDTA 2007] program analysis scalable declarative pointer analysis [ISSTA 2009] latest and greatest work, rest of the talk

49 overview 15 what do we do? fully declarative pointer analysis fast, really fast

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

51 overview 15 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

52 overview 15 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

53 program analysis: run faster 16

54 program analysis: software understanding 17

55 program analysis: find bugs 18

56 pointer analysis 19 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; }

57 pointer analysis 19 ˆ ˆ 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 new A1() new A2() objects represented by allocation sites

58 pointer analysis 19 ˆ ˆ 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; }

59 pointer analysis 19 ˆ ˆ ˆ 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; }

60 pointer analysis 19 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()

61 pointer analysis 19 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() necessarily an approximation full precision too expensive

62 pointer analysis: a complex domain 20

63 pointer analysis: a complex domain 20 flow-sensitive

64 pointer analysis: a complex domain 20 flow-sensitive field-sensitive

65 pointer analysis: a complex domain 20 flow-sensitive context-sensitive field-sensitive

66 pointer analysis: a complex domain 20 flow-sensitive context-sensitive field-sensitive binary decision diagrams

67 pointer analysis: a complex domain 20 inclusion-based unification-based flow-sensitive on-the-fly call graph context-sensitive k-cfa object sensitive field-based field-sensitive heap cloning binary decision diagrams demand-driven

68 algorithms in a 10-page pointer analysis paper 21

69 algorithms in a 10-page pointer analysis paper 21

70 algorithms in a 10-page pointer analysis paper 21

71 algorithms in a 10-page pointer analysis paper 21

72 algorithms in a 10-page pointer analysis paper 21

73 algorithms in a 10-page pointer analysis paper 21

74 algorithms in a 10-page pointer analysis paper 21

75 algorithms in a 10-page pointer analysis paper 21

76 algorithms in a 10-page pointer analysis paper 21 variation points unclear every variant new algorithm correctness unclear incomparable in precision incomparable in performance

77 from algorithms to specification and back 22 algorithm algorithm algorithm algorithm

78 from algorithms to specification and back 22 algorithm policy algorithm policy algorithm policy algorithm policy analysis

79 from algorithms to specification and back 22 algorithm policy algorithm policy algorithm policy specification algorithm policy analysis

80 from algorithms to specification and back 22 algorithm policy algorithm algorithm algorithm policy algorithm algorithm policy specification algorithm algorithm algorithm algorithm policy algorithm analysis synthesis

81 from algorithms to specification

82 what does it mean to be declarative? 23 denoting high-level programming languages which can be used to solve problems without requiring the programmer to specify an exact procedure to be followed. high-level what, not how no control-flow no side-effects specifications, not programs, not algorithms

83 our pointer analysis framework 24 datalog-based pointer analysis framework for java

84 our pointer analysis framework 24 datalog-based pointer analysis framework for java declarative: what, not how

85 our pointer analysis framework 24 datalog-based pointer analysis framework for java declarative: what, not how easier to express sophisticated analyses correctness more clear clear variation points eases exploration of approximations enables aggressive optimization

86 our pointer analysis framework 24 datalog-based pointer analysis framework for java declarative: what, not how easier to express sophisticated analyses correctness more clear clear variation points eases exploration of approximations enables aggressive optimization sophisticated subset-based analysis, fully on-the-fly call graph discovery, field-sensitivity, contextsensitivity, call-site sensitive, object sensitive, thread sensitive, context-sensitive heap abstraction, type filtering, precise exception analysis

87 our pointer analysis framework 24 datalog-based pointer analysis framework for java declarative: what, not how easier to express sophisticated analyses correctness more clear clear variation points eases exploration of approximations enables aggressive optimization sophisticated subset-based analysis, fully on-the-fly call graph discovery, field-sensitivity, contextsensitivity, call-site sensitive, object sensitive, thread sensitive, context-sensitive heap abstraction, type filtering, precise exception analysis support for full semantic complexity of java jvm initialization, reflection analysis, threads, reference queues, native methods, class initialization, finalization, cast checking, assignment compatibility

88 our pointer analysis framework 24 datalog-based pointer analysis framework for java declarative: what, not how easier to express sophisticated analyses correctness more clear clear variation points eases exploration of approximations enables aggressive optimization sophisticated subset-based analysis, fully on-the-fly call graph discovery, field-sensitivity, contextsensitivity, call-site sensitive, object sensitive, thread sensitive, context-sensitive heap abstraction, type filtering, precise exception analysis support for full semantic complexity of java jvm initialization, reflection analysis, threads, reference queues, native methods, class initialization, finalization, cast checking, assignment compatibility enables precision and performance comparison

89 key contributions 25 expressed pointer analysis in full sophistication in datalog - core specification: 250 lines of logic - full specification: 2500 lines of logic

90 key contributions 25 expressed pointer analysis in full sophistication in datalog - core specification: 250 lines of logic - full specification: 2500 lines of logic synthesized efficient algorithms from specification - order of magnitude performance improvement - support all analyses considered interesting

91 key contributions 25 expressed pointer analysis in full sophistication in datalog - core specification: 250 lines of logic - full specification: 2500 lines of logic synthesized efficient algorithms from specification - order of magnitude performance improvement - support all analyses considered interesting approach: heuristics for searching algorithm space - targeted at recursive problem domains

92 key contributions 25 expressed pointer analysis in full sophistication in datalog - core specification: 250 lines of logic - full specification: 2500 lines of logic synthesized efficient algorithms from specification - order of magnitude performance improvement - support all analyses considered interesting approach: heuristics for searching algorithm space - targeted at recursive problem domains demonstrated scalability with explicit representation

93 from algorithms to specification pointer analysis and datalog background

94 program analysis: a domain of mutual recursion 26 var points-to

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

110 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c

111 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

112 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

113 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

114 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

115 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

116 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

117 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

118 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation a new A() b new B() c new C() Assign b a a b b c VarPointsTo VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

119 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation 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,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

120 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation 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,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

121 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation 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,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

122 datalog: declarative mutual recursion 27 source a = new A(); b = new B(); c = new C(); a = b; b = a; c = b; AssignObjectAllocation 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,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

123 datalog: properties 28 limited logic programming sql with recursion prolog without complex terms (constructors) captures PTIME complexity class strictly declarative as opposed to prolog - conjunction commutative - rules commutative increases algorithm space - enables different execution strategies - enables more aggressive optimization writing datalog is less programming, more specification

124 from algorithms to specification declarative pointer analysis specification

125 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).

126 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj).?base.?field =?from

127 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). ˆ VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). FieldPointsTo(?baseobj,?field,?obj) <-?base.?field =?from

128 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). ˆ VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). FieldPointsTo(?baseobj,?field,?obj) <- field?field of object?baseobj may point to object?obj?base.?field =?from

129 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). field?field of object?baseobj may point to object?obj FieldPointsTo(?baseobj,?field,?obj) <- ˆ StoreField(?from,?base,?field),?base.?field =?from

130 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), ˆ VarPointsTo(?from,?obj).?base.?field =?from?baseobj?obj field?field of object?baseobj may point to object?obj

131 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), VarPointsTo(?from,?obj).?to =?base.?field

132 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), VarPointsTo(?from,?obj). ˆ VarPointsTo(?to,?obj) <-?to =?base.?field

133 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), VarPointsTo(?from,?obj). VarPointsTo(?to,?obj) <- LoadField(?base,?field,?to),?to =?base.?field

134 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), VarPointsTo(?from,?obj). VarPointsTo(?to,?obj) <- LoadField(?base,?field,?to), VarPointsTo(?base,?baseobj),?baseobj?to =?base.?field

135 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), VarPointsTo(?from,?obj).?to =?base.?field VarPointsTo(?to,?obj) <- LoadField(?base,?field,?to), VarPointsTo(?base,?baseobj), FieldPointsTo(?baseobj,?field,?obj).?baseobj

136 example 1: introducing fields 29 VarPointsTo(?var,?obj) <- AssignObjectAllocation(?var,?obj). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). modularity: introducing new mutually recursive dependencies does not change existing rules FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?base,?baseobj), VarPointsTo(?from,?obj). VarPointsTo(?to,?obj) <- LoadField(?base,?field,?to), VarPointsTo(?base,?baseobj), FieldPointsTo(?baseobj,?field,?obj).

137 example 2: precise exception analysis 30 method invocations: propagated exceptions void f() { --g(); } method invocations: caught exceptions void f() { --try { ----g(); --} catch(e e) {..} }

138 example 2: precise exception analysis 30 method invocations: propagated exceptions ˆ ThrowPointsTo(?caller,?obj) <- void f() { --g(); } ˆ method invocations: caught exceptions VarPointsTo(?param,?obj) <- void f() { --try { ----g(); --} catch(e e) {..} }

139 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), void f() { --g(); } method invocations: caught exceptions VarPointsTo(?param,?obj) <- void f() { --try { ----g(); --} catch(e e) {..} }

140 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), void f() { --g(); } method invocations: caught exceptions VarPointsTo(?param,?obj) <- void f() { --try { ----g(); --} catch(e e) {..} }

141 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, void f() { --g(); } method invocations: caught exceptions VarPointsTo(?param,?obj) <- void f() { --try { ----g(); --} catch(e e) {..} }

142 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, not exists ExceptionHandler[?objtype,?invocation], void f() { --g(); } method invocations: caught exceptions VarPointsTo(?param,?obj) <- void f() { --try { ----g(); --} catch(e e) {..} }

143 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions void f() { ThrowPointsTo(?caller,?obj) <- --g(); CallGraphEdge(?invocation,?tomethod), } ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, not exists ExceptionHandler[?objtype,?invocation], Method[?invocation] =?caller. method invocations: caught exceptions VarPointsTo(?param,?obj) <- void f() { --try { ----g(); --} catch(e e) {..} }

144 example 2: precise exception analysis 30 ˆ ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, not exists ExceptionHandler[?objtype,?invocation], Method[?invocation] =?caller. method invocations: caught exceptions VarPointsTo(?param,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, void f() { --g(); } void f() { --try { ----g(); --} catch(e e) {..} }

145 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, not exists ExceptionHandler[?objtype,?invocation], Method[?invocation] =?caller. method invocations: caught exceptions VarPointsTo(?param,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, ExceptionHandler[?objtype,?invocation] =?handler, void f() { --g(); } void f() { --try { ----g(); --} catch(e e) {..} }

146 example 2: precise exception analysis 30 ˆ method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, not exists ExceptionHandler[?objtype,?invocation], Method[?invocation] =?caller. void f() { --g(); } method invocations: caught exceptions void f() { --try { VarPointsTo(?param,?obj) <- ----g(); CallGraphEdge(?invocation,?tomethod), --} catch(e e) {..} ThrowPointsTo(?tomethod,?obj), } Type[?obj] =?objtype, ExceptionHandler[?objtype,?invocation] =?handler, ExceptionHandler:FormalParam[?handler] =?param.

147 example 2: precise exception analysis 30 method invocations: propagated exceptions ThrowPointsTo(?caller,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, not exists ExceptionHandler[?objtype,?invocation], Method[?invocation] =?caller. method invocations: caught exceptions VarPointsTo(?param,?obj) <- CallGraphEdge(?invocation,?tomethod), ThrowPointsTo(?tomethod,?obj), Type[?obj] =?objtype, again, ExceptionHandler[?objtype, new mutually?invocation] =?handler, recursive ExceptionHandler:FormalParam[?handler] dependencies do =?param. not change existing rules void f() { --g(); } void f() { --try { ----g(); --} catch(e e) {..} }

148 from algorithms to specification and back 31 algorithm policy algorithm policy algorithm policy specification algorithm policy analysis

149 from algorithms to specification and back 31 algorithm policy algorithm algorithm algorithm policy algorithm algorithm policy specification algorithm algorithm algorithm algorithm policy algorithm analysis synthesis

150 from specification to algorithms

151 from specification to algorithms benchmark

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

153 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

154 where is the magic? 33 strictly declarative - no coupling of specification and algorithm efficient architecture for datalog engine - but, not a magic tool novel heuristics for searching the algorithm space - targeting recursive logic

155 from specification to algorithms datalog evaluation background

156 datalog: naive evaluation 34 datalog VarPointsTo(?var,?obj) <- AssignObjectAllocation(?obj,?var). VarPointsTo(?to,?obj) <- Assign(?from,?to), VarPointsTo(?from,?obj). naive evaluation (relational algebra) VarPointsTo := AssignObjectAllocation repeat tmp := π to var,heap (VarPointsTo from=var VarPointsTo := VarPointsTo tmp until fixpoint Assign)

157 datalog: naive evaluation 35 VarPointsTo Assign

158 datalog: naive evaluation 35 VarPointsTo Assign

159 datalog: semi-naive evaluation 36 VarPointsTo Assign

160 datalog: semi-naive evaluation 36 VarPointsTo Assign no repeated iteration over computed results

161 datalog: semi-naive evaluation 36 VarPointsTo Assign no repeated iteration over computed results

162 from specification to algorithms datalog engine architecture

163 datalog engine architecture 37 efficient low-level representation "<java.lang.thread: void <clinit>()>" 32-bit int call-graph edge: invocation method 64-bit int relations are multidimensional indexes (b-trees) index-organized tables efficient representation of sparse relations alternative data structures for (partially) dense relations indexes exposed in the language argument order determines index enables us to stay in datalog

164 relations as multidimensional indexes 38 VarPointsTo a new A() b new B() c new C() a new B() b new A() c new B() c new A()

165 relations as multidimensional indexes 38 VarPointsTo a new A() b new B() c new C() a new B() b new A() c new B() c new A() index organized by reverse argument order VarPointsTo(?var,?obj)

166 relations as multidimensional indexes 38 VarPointsTo a new A() b new B() c new C() a new B() b new A() c new B() c new A() index organized by reverse argument order VarPointsTo(?var,?obj) new A(), b new B(), a new A(), a new A(), c new B(), b new B(), c new C(), c

167 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

168 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

169 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

170 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

171 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

172 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

173 relations as multidimensional indexes 38 VarPointsTo new A() a new B() b new C() c new B() a new A() b new B() c new A() c index organized by reverse argument order VarPointsTo(?var,?obj) VarPointsTo(?obj,?var) a, new B() b, new B() a, new A() b, new A() c, new A() c, new B() c, new C()

174 from specification to algorithms heuristics for searching the algorithm space

175 optimization approach: heuristics 39 datalog specification datalog engine inefficient? traditional design of single algorithm major human effort!

176 heuristics for searching algorithm space 40 always use index efficiently

177 heuristics for searching algorithm space 40 always use index efficiently VarPointsTo(?from,?obj) Assign(?from,?to)

178 heuristics for searching algorithm space 40 always use index efficiently VarPointsTo(?from,?obj) Assign(?from,?to) VarPointsTo(?from,?obj) Assign(?to,?from)

179 heuristics for searching algorithm space 40 always use index efficiently never iterate over full views

180 heuristics for searching algorithm space 40 always use index efficiently never iterate over full views Assign(?to,?from) VarPointsTo(?from,?obj)

181 heuristics for searching algorithm space 40 always use index efficiently never iterate over full views Assign(?to,?from) VarPointsTo(?from,?obj) VarPointsTo(?from,?obj) Assign(?to,?from)

182 heuristics for searching algorithm space 40 always use index efficiently never iterate over full views Assign(?to,?from) VarPointsTo(?from,?obj) VarPointsTo(?from,?obj) Assign(?to,?from) Assign(?to,?from) VarPointsTo(?obj,?from)

183 heuristics for searching algorithm space 40 always use index efficiently never iterate over full views never iterate over big input relations

184 heuristics for searching algorithm space 40 always use index efficiently never iterate over full views never iterate over big input relations StoreField(?from,?field,?base) VarPointsTo(?obj,?from) VarPointsTo(?baseobj,?base)

185 from specification to algorithms folding transformation example

186 folding transformation: example 41 specification ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from).

187 folding transformation: example 41 specification ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). semi-naive executions ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from).

188 folding transformation: example 42 specification FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). join orderings VarPointsTo(?baseobj,?base) StoreField(?from,?base,?field) VarPointsTo(?obj,?from) VarPointsTo(?obj,?from) StoreField(?from,?base,?field) VarPointsTo(?baseobj,?base)

189 folding transformation: example 42 specification FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). there is no efficient variable ordering! join orderings ˆ VarPointsTo(?baseobj,?base) StoreField(?from,?base,?field) VarPointsTo(?obj,?from) ˆ VarPointsTo(?obj,?from) StoreField(?from,?base,?field) VarPointsTo(?baseobj,?base)

190 folding transformation: example 42 specification FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). there is no efficient variable ordering! join orderings VarPointsTo(?baseobj,?base) StoreField(?from,?base,?field) VarPointsTo(?obj,?from) VarPointsTo(?obj,?from) StoreField(?from,?base,?field) VarPointsTo(?baseobj,?base)

191 folding transformation: example 42 specification FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). there is no efficient variable ordering! join orderings VarPointsTo(?baseobj,?base) StoreField(?from,?base,?field) VarPointsTo(?obj,?from) VarPointsTo(?obj,?from) StoreField(?from,?base,?field) VarPointsTo(?baseobj,?base)

192 folding transformation: example 43 specification ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from).

193 folding transformation: example 43 specification ˆ FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). optimized rules FieldPointsTo(?obj,?field,?baseobj) <- VarPointsTo(?obj,?from). ˆ StoreObjectField(?baseobj,?field,?from) <- StoreField(?from,?field,?base), VarPointsTo(?baseobj,?base).

194 folding transformation: example 43 specification FieldPointsTo(?baseobj,?field,?obj) <- StoreField(?from,?base,?field), VarPointsTo(?baseobj,?base), VarPointsTo(?obj,?from). optimized rules ˆ FieldPointsTo(?obj,?field,?baseobj) <- StoreObjectField(?baseobj,?field,?from), VarPointsTo(?obj,?from). ˆ StoreObjectField(?baseobj,?field,?from) <- StoreField(?from,?field,?base), VarPointsTo(?baseobj,?base).

195 algorithm space is gigantic 44 inclusion-based unification-based flow-sensitive on-the-fly call graph context-sensitive k-cfa object sensitive field-based field-sensitive heap cloning binary decision diagrams demand-driven

196 algorithm space is gigantic 44 inclusion-based unification-based flow-sensitive on-the-fly call graph database community: index selection materialized view selection context-sensitive k-cfa object sensitive field-based field-sensitive heap cloning binary decision diagrams demand-driven

197 from algorithms to specification from specification to algorithms

198 fundamental new approach to pointer analysis 45 distilled domain of pointer analysis to its essence declarative specification fully captured the domain: no loss of sophistication - even improved: exception, reflection analysis - declarativiness is a major benefit here developed techniques for deriving efficient algorithms effective heuristics for searching the algorithm space outperforms current hand-written implementations evidence that this is an effective method!

199 future work 46 pointer analysis - new context abstractions - selective context-sensitivity - on-demand analysis - improve evaluation methods

200 future work 46 pointer analysis - new context abstractions - selective context-sensitivity - on-demand analysis - improve evaluation methods program analysis and applications - mixed language analysis - declarative dynamic program analysis - applications: client analyses

201 future work 46 pointer analysis - new context abstractions - selective context-sensitivity - on-demand analysis - improve evaluation methods program analysis and applications - mixed language analysis - declarative dynamic program analysis - applications: client analyses transformation systems, parsing, extensible languages - too much to list here!

202 my research 47 extensible and domain-specific languages embedding domain-specific languages [OOPSLA 2004, GPCE 2005, OOPSLA 2006, OOPSLA 2008, ATEM 2007] preventing injection attacks [GPCE 2007, SCP 2009] parse table composition [SLE 2008] program transformation systems stratego/xt transformation system [PEPM 2006, FI 2006, SCP 2008] grammar engineering [LDTA 2007] program analysis scalable declarative pointer analysis [ISSTA 2009]

Screaming Fast Declarative Pointer Analysis

Screaming Fast Declarative Pointer Analysis Screaming Fast Declarative Pointer Analysis http://doop.program-analysis.org Martin Bravenboer and Yannis Smaragdakis University of Massachusetts Amherst University of Oregon NEPLS March 5, 2008 overview

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

Concrete Syntax for Objects

Concrete Syntax for Objects Realizing Domain-Specific Language Embedding and Assimilation without Restrictions Martin Bravenboer Eelco Visser Institute of Information & Computing Sciences Utrecht University, The Netherlands June

More information

Exercises in Free Syntax

Exercises in Free Syntax Exercises in Free Syntax Syntax Definition, Parsing, and Assimilation of Language Conglomerates Exercities in vrije syntax Syntax definitie, ontleding, en assimilatie van taalagglomeraten (met een samenvatting

More information

LECTURE 3. Compiler Phases

LECTURE 3. Compiler Phases LECTURE 3 Compiler Phases COMPILER PHASES Compilation of a program proceeds through a fixed series of phases. Each phase uses an (intermediate) form of the program produced by an earlier phase. Subsequent

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

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

Spoofax: A Development Environment for Software Transformations. Karl Trygve Kalleberg University of Bergen

Spoofax: A Development Environment for Software Transformations. Karl Trygve Kalleberg University of Bergen Spoofax: A Development Environment for Software Transformations Karl Trygve Kalleberg University of Bergen Prerequisites Rudimentary programming skills Some familiarity with non-linear storytelling Basic

More information

Stratego/XT in a Nutshell. Karl Trygve Kalleberg

Stratego/XT in a Nutshell. Karl Trygve Kalleberg Stratego/XT in a Nutshell An introduction to the Stratego/XT Transformation System Karl Trygve Kalleberg Institutt for Informatikk Universitetet i Bergen University of Waterloo Feb 23, 2006 Outline 1 Motivation

More information

Time : 1 Hour Max Marks : 30

Time : 1 Hour Max Marks : 30 Total No. of Questions : 6 P4890 B.E/ Insem.- 74 B.E ( Computer Engg) PRINCIPLES OF MODERN COMPILER DESIGN (2012 Pattern) (Semester I) Time : 1 Hour Max Marks : 30 Q.1 a) Explain need of symbol table with

More information

CSCI Compiler Design

CSCI Compiler Design CSCI 565 - Compiler Design Spring 2015 Midterm Exam March 04, 2015 at 8:00 AM in class (RTH 217) Duration: 2h 30 min. Please label all pages you turn in with your name and student number. Name: Number:

More information

Concrete Syntax for Objects

Concrete Syntax for Objects Concrete Syntax for Objects Domain-Specific Language Embedding and Assimilation without Restrictions Martin Bravenboer Institute of Information and Computing Sciences Universiteit Utrecht, P.O. Box 80089

More information

CSSE 220 Day 19. Object-Oriented Design Files & Exceptions. Check out FilesAndExceptions from SVN

CSSE 220 Day 19. Object-Oriented Design Files & Exceptions. Check out FilesAndExceptions from SVN CSSE 220 Day 19 Object-Oriented Design Files & Exceptions Check out FilesAndExceptions from SVN A practical technique OBJECT-ORIENTED DESIGN Object-Oriented Design We won t use full-scale, formal methodologies

More information

CJT^jL rafting Cm ompiler

CJT^jL rafting Cm ompiler CJT^jL rafting Cm ompiler ij CHARLES N. FISCHER Computer Sciences University of Wisconsin Madison RON K. CYTRON Computer Science and Engineering Washington University RICHARD J. LeBLANC, Jr. Computer Science

More information

CSSE 220 Day 19. Object-Oriented Design Files & Exceptions. Check out FilesAndExceptions from SVN

CSSE 220 Day 19. Object-Oriented Design Files & Exceptions. Check out FilesAndExceptions from SVN CSSE 220 Day 19 Object-Oriented Design Files & Exceptions Check out FilesAndExceptions from SVN A practical technique OBJECT-ORIENTED DESIGN Object-Oriented Design We won t use full-scale, formal methodologies

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

Better Extensibility through Modular Syntax. Robert Grimm New York University

Better Extensibility through Modular Syntax. Robert Grimm New York University Better Extensibility through Modular Syntax Robert Grimm New York University Syntax Matters More complex syntactic specifications Extensions to existing programming languages Transactions, event-based

More information

5. Semantic Analysis!

5. Semantic Analysis! 5. Semantic Analysis! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/! http://www.cs.purdue.edu/homes/hosking/!

More information

ECE251 Midterm practice questions, Fall 2010

ECE251 Midterm practice questions, Fall 2010 ECE251 Midterm practice questions, Fall 2010 Patrick Lam October 20, 2010 Bootstrapping In particular, say you have a compiler from C to Pascal which runs on x86, and you want to write a self-hosting Java

More information

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer. The Compiler So Far CSC 4181 Compiler Construction Scanner - Lexical analysis Detects inputs with illegal tokens e.g.: main 5 (); Parser - Syntactic analysis Detects inputs with ill-formed parse trees

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

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

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

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

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

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

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

Semantic Analysis. Lecture 9. February 7, 2018

Semantic Analysis. Lecture 9. February 7, 2018 Semantic Analysis Lecture 9 February 7, 2018 Midterm 1 Compiler Stages 12 / 14 COOL Programming 10 / 12 Regular Languages 26 / 30 Context-free Languages 17 / 21 Parsing 20 / 23 Extra Credit 4 / 6 Average

More information

Principles of Programming Languages [PLP-2015] Detailed Syllabus

Principles of Programming Languages [PLP-2015] Detailed Syllabus Principles of Programming Languages [PLP-2015] Detailed Syllabus This document lists the topics presented along the course. The PDF slides published on the course web page (http://www.di.unipi.it/~andrea/didattica/plp-15/)

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

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! Next time reading assignment [ALSU07] Chapters 1,2 [ALSU07] Sections 1.1-1.5 (cover in class) [ALSU07] Section 1.6 (read on your

More information

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701)

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701) Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov 2014 Compiler Design (170701) Question Bank / Assignment Unit 1: INTRODUCTION TO COMPILING

More information

The role of semantic analysis in a compiler

The role of semantic analysis in a compiler Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Domain-Specific Languages for Composable Editor Plugins

Domain-Specific Languages for Composable Editor Plugins Domain-Specific Languages for Composable Editor Plugins LDTA 2009, York, UK Lennart Kats (me), Delft University of Technology Karl Trygve Kalleberg, University of Bergen Eelco Visser, Delft University

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"

More information

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun! Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques

More information

Contents Chapter 1 Introduction to Programming and the Java Language

Contents Chapter 1 Introduction to Programming and the Java Language Chapter 1 Introduction to Programming and the Java Language 1.1 Basic Computer Concepts 5 1.1.1 Hardware 5 1.1.2 Operating Systems 8 1.1.3 Application Software 9 1.1.4 Computer Networks and the Internet

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

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

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 in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False

More information

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

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

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking Agenda COMP 181 Type checking October 21, 2009 Next week OOPSLA: Object-oriented Programming Systems Languages and Applications One of the top PL conferences Monday (Oct 26 th ) In-class midterm Review

More information

CSE 431S Final Review. Washington University Spring 2013

CSE 431S Final Review. Washington University Spring 2013 CSE 431S Final Review Washington University Spring 2013 What You Should Know The six stages of a compiler and what each stage does. The input to and output of each compilation stage (especially the back-end).

More information

JRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();

JRadioButton account_type_radio_button2 = new JRadioButton(Current); ButtonGroup account_type_button_group = new ButtonGroup(); Q)Write a program to design an interface containing fields User ID, Password and Account type, and buttons login, cancel, edit by mixing border layout and flow layout. Add events handling to the button

More information

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc. Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing

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

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

2068 (I) Attempt all questions.

2068 (I) Attempt all questions. 2068 (I) 1. What do you mean by compiler? How source program analyzed? Explain in brief. 2. Discuss the role of symbol table in compiler design. 3. Convert the regular expression 0 + (1 + 0)* 00 first

More information

Operating Systems 2 nd semester 2016/2017. Chapter 4: Threads

Operating Systems 2 nd semester 2016/2017. Chapter 4: Threads Operating Systems 2 nd semester 2016/2017 Chapter 4: Threads Mohamed B. Abubaker Palestine Technical College Deir El-Balah Note: Adapted from the resources of textbox Operating System Concepts, 9 th edition

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

This page intentionally left blank

This page intentionally left blank This page intentionally left blank arting Out with Java: From Control Structures through Objects International Edition - PDF - PDF - PDF Cover Contents Preface Chapter 1 Introduction to Computers and Java

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

Undergraduate Compilers in a Day

Undergraduate Compilers in a Day Question of the Day Backpatching o.foo(); In Java, the address of foo() is often not known until runtime (due to dynamic class loading), so the method call requires a table lookup. After the first execution

More information

Renaud Durlin. May 16, 2007

Renaud Durlin. May 16, 2007 A comparison of different approaches EPITA Research and Development Laboratory (LRDE) http://www.lrde.epita.fr May 16, 2007 1 / 25 1 2 3 4 5 2 / 25 1 2 3 4 5 3 / 25 Goal Transformers:

More information

Question Bank. 10CS63:Compiler Design

Question Bank. 10CS63:Compiler Design Question Bank 10CS63:Compiler Design 1.Determine whether the following regular expressions define the same language? (ab)* and a*b* 2.List the properties of an operator grammar 3. Is macro processing a

More information

Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer

Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer Torben./Egidius Mogensen Introduction to Compiler Design ^ Springer Contents 1 Lexical Analysis 1 1.1 Regular Expressions 2 1.1.1 Shorthands 4 1.1.2 Examples 5 1.2 Nondeterministic Finite Automata 6 1.3

More information

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Compiler Theory. (Semantic Analysis and Run-Time Environments) Compiler Theory (Semantic Analysis and Run-Time Environments) 005 Semantic Actions A compiler must do more than recognise whether a sentence belongs to the language of a grammar it must do something useful

More information

Atelier Java - J2. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Atelier Java - J2. Marwan Burelle.   EPITA Première Année Cycle Ingénieur. marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 1 2 Notions of interfaces describe what an object must provide without describing how. It extends the types name strategy to provide

More information

List of Figures. About the Authors. Acknowledgments

List of Figures. About the Authors. Acknowledgments List of Figures Preface About the Authors Acknowledgments xiii xvii xxiii xxv 1 Compilation 1 1.1 Compilers..................................... 1 1.1.1 Programming Languages......................... 1

More information

CSE 401 Final Exam. March 14, 2017 Happy π Day! (3/14) This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,...

CSE 401 Final Exam. March 14, 2017 Happy π Day! (3/14) This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,... CSE 401 Final Exam March 14, 2017 Happy π Day! (3/14) Name This exam is closed book, closed notes, closed electronics, closed neighbors, open mind,.... Please wait to turn the page until everyone has their

More information

Alternatives for semantic processing

Alternatives for semantic processing Semantic Processing Copyright c 2000 by Antony L. Hosking. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies

More information

5. Semantic Analysis. Mircea Lungu Oscar Nierstrasz

5. Semantic Analysis. Mircea Lungu Oscar Nierstrasz 5. Semantic Analysis Mircea Lungu Oscar Nierstrasz Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes. http://www.cs.ucla.edu/~palsberg/

More information

You must bring your ID to the exam.

You must bring your ID to the exam. Com S 227 Spring 2017 Topics and review problems for Exam 2 Monday, April 3, 6:45 pm Locations, by last name: (same locations as Exam 1) A-E Coover 2245 F-M Hoover 2055 N-S Physics 0005 T-Z Hoover 1213

More information

STARCOUNTER. Technical Overview

STARCOUNTER. Technical Overview STARCOUNTER Technical Overview Summary 3 Introduction 4 Scope 5 Audience 5 Prerequisite Knowledge 5 Virtual Machine Database Management System 6 Weaver 7 Shared Memory 8 Atomicity 8 Consistency 9 Isolation

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA. R13 SET - 1 III B. Tech I Semester Regular Examinations, November - 2015 1 a) What constitutes a programming environment? [3M] b) What mixed-mode assignments are allowed in C and Java? [4M] c) What is

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

The Structure of a Syntax-Directed Compiler

The Structure of a Syntax-Directed Compiler Source Program (Character Stream) Scanner Tokens Parser Abstract Syntax Tree Type Checker (AST) Decorated AST Translator Intermediate Representation Symbol Tables Optimizer (IR) IR Code Generator Target

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Casting -Allows a narrowing assignment by asking the Java compiler to "trust us"

Casting -Allows a narrowing assignment by asking the Java compiler to trust us Primitives Integral types: int, short, long, char, byte Floating point types: double, float Boolean types: boolean -passed by value (copied when returned or passed as actual parameters) Arithmetic Operators:

More information

CS5363 Final Review. cs5363 1

CS5363 Final Review. cs5363 1 CS5363 Final Review cs5363 1 Programming language implementation Programming languages Tools for describing data and algorithms Instructing machines what to do Communicate between computers and programmers

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

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 January 19, 2006 14.00-15.30 This exam (8 pages) consists of 60 True/False

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level

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

Frequently Asked Questions

Frequently Asked Questions Frequently Asked Questions This PowerTools FAQ answers many frequently asked questions regarding the functionality of the various parts of the PowerTools suite. The questions are organized in the following

More information

UMBC CMSC 331 Final Exam

UMBC CMSC 331 Final Exam UMBC CMSC 331 Final Exam Name: UMBC Username: You have two hours to complete this closed book exam. We reserve the right to assign partial credit, and to deduct points for answers that are needlessly wordy

More information

Semantic Analysis. CSE 307 Principles of Programming Languages Stony Brook University

Semantic Analysis. CSE 307 Principles of Programming Languages Stony Brook University Semantic Analysis CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Role of Semantic Analysis Syntax vs. Semantics: syntax concerns the form of a

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Statically vs. Dynamically typed languages

More information

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures

Question 1. Notes on the Exam. Today. Comp 104: Operating Systems Concepts 11/05/2015. Revision Lectures Comp 104: Operating Systems Concepts Revision Lectures Today Here are a sample of questions that could appear in the exam Please LET ME KNOW if there are particular subjects you want to know about??? 1

More information

4. An interpreter is a program that

4. An interpreter is a program that 1. In an aboslute loading scheme, which loader function is accomplished by programmer? A. Allocation B. LInking C. Reallocation D. both (A) and (B) 2. A compiler program written in a high level language

More information

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] Code No: R05311201 Set No. 1 1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] 2. Compute the FIRST and FOLLOW sets of each

More information

REFLECTIONS ON OPERATOR SUITES

REFLECTIONS ON OPERATOR SUITES REFLECTIONS ON OPERATOR SUITES FOR REFACTORING AND EVOLUTION Ralf Lämmel, VU & CWI, Amsterdam joint work with Jan Heering, CWI QUESTIONS What s the distance between refactoring and evolution? What are

More information

Phosphor: Illuminating Dynamic. Data Flow in Commodity JVMs

Phosphor: Illuminating Dynamic. Data Flow in Commodity JVMs Phosphor: Illuminating Dynamic Fork me on Github Data Flow in Commodity JVMs Jonathan Bell and Gail Kaiser Columbia University, New York, NY USA Dynamic Data Flow Analysis: Taint Tracking Output that is

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

CPS221 Lecture: Threads

CPS221 Lecture: Threads Objectives CPS221 Lecture: Threads 1. To introduce threads in the context of processes 2. To introduce UML Activity Diagrams last revised 9/5/12 Materials: 1. Diagram showing state of memory for a process

More information

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview COMP 181 Compilers Lecture 2 Overview September 7, 2006 Administrative Book? Hopefully: Compilers by Aho, Lam, Sethi, Ullman Mailing list Handouts? Programming assignments For next time, write a hello,

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

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

Lecture 8 CS 412/413 Spring '00 -- Andrew Myers 2. Lecture 8 CS 412/413 Spring '00 -- Andrew Myers 4

Lecture 8 CS 412/413 Spring '00 -- Andrew Myers 2. Lecture 8 CS 412/413 Spring '00 -- Andrew Myers 4 CS412/413 Introduction to Compilers and Translators Spring 00 Outline Typechecking Symbol tables Using symbol tables for analysis Lecture 8: Semantic Analysis and Symbol Tables Lecture 8 CS 412/413 Spring

More information

Aspect-Oriented Programming

Aspect-Oriented Programming Aspect-Oriented Programming Based on the Example of AspectJ Prof. Harald Gall University of Zurich, Switzerland software evolution & architecture lab AOP is kind of a complicated one for me ( ) the idea

More information

Lecture 09: Data Abstraction ++ Parsing is the process of translating a sequence of characters (a string) into an abstract syntax tree.

Lecture 09: Data Abstraction ++ Parsing is the process of translating a sequence of characters (a string) into an abstract syntax tree. Lecture 09: Data Abstraction ++ Parsing Parsing is the process of translating a sequence of characters (a string) into an abstract syntax tree. program text Parser AST Processor Compilers (and some interpreters)

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

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

Relation Overriding. Syntax and Semantics. Simple Semantic Domains. Operational Semantics

Relation Overriding. Syntax and Semantics. Simple Semantic Domains. Operational Semantics SE3E03, 2006 1.59 61 Syntax and Semantics Syntax Shape of PL constructs What are the tokens of the language? Lexical syntax, word level How are programs built from tokens? Mostly use Context-Free Grammars

More information