Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bringing Reflection to Life with First-Class Interpreters

Similar presentations


Presentation on theme: "Bringing Reflection to Life with First-Class Interpreters"— Presentation transcript:

1 Bringing Reflection to Life with First-Class Interpreters
Toon Verwaest Camillo Bruni David Gurtner Adrian Lienhard Oscar Nierstrasz Software Composition Group University of Bern Switzerland

2 debugging is hard

3 System.out.println

4 developing debuggers is even harder

5 Object-Flow Debugger Lienhard '07

6 modifications to the Virtual Machine

7

8 What if we could build a specialized debugger in just a few hours?

9 implement debuggers in the language itself in terms of the source code

10 Debugger interpret: [ Person new ]

11 Debugger interpret: [ Person new ] reflection

12 recursive AST visitor garbage collection object model Interpreter
environment visitAssign: visitBlock: visitClass: visitConstant: visitSelf: visitSend: visitSuper: visitVariable: ... interpret: send:to:class: classOf: invokeMethod: recursive AST visitor garbage collection object model

13 recursive AST visitor garbage collection object model Interpreter
environment interpret: send:to:class: classOf: invokeMethod: ... recursive AST visitor garbage collection object model Debugger send:to:class: shell

14 send: message to: receiver: class: class self print:
receiver class name,'>>', message. self shell. ^ super send: message to: receiver class: class Interpreter environment interpret: send:to:class: classOf: invokeMethod: ... Debugger send:to:class: shell

15 AliasInterpreter interpret: [
person := Person new. person name: 'John'. person name: 'Doe'. person ]

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32 interpretMethod: method | result |
Interpreter environment interpret: send:to:class: classOf: interpretMethod: ... interpretMethod: method | result | result := super interpretMethod: method. ^ (ReturnAlias alias: result) environment: environment AliasInterpreter classOf: interpretMethod: ...

33 AliasInterpreter interpret: [
person := Person new. person name: 'John'. person name: 'Doe'. person ]

34 Pinocchio Metacircular
Performance (fib) 2.5x slower than Squeak 2x slower than Ruby 1.9 1.3x faster than Python 2.6.4 6x faster than Ruby 1.8 160x slower than Pinocchio Pinocchio Metacircular

35 Pinocchio Metacircular Ruby 1.8 Performance (fib)
2.5x slower than Squeak 2x slower than Ruby 1.9 1.3x faster than Python 2.6.4 6x faster than Ruby 1.8 160x slower than Pinocchio Pinocchio Metacircular Ruby 1.8 163x slower than Java 1.6

36 Future work debuggers as recursive AST visitors
extensible using OO techniques implemented practical debuggers Future work performance is not addressed yet

37 Future work http://scg.unibe.ch/pinocchio
debuggers as recursive AST visitors extensible using OO techniques implemented practical debuggers Future work performance is not addressed yet


Download ppt "Bringing Reflection to Life with First-Class Interpreters"

Similar presentations


Ads by Google