Your SlideShare is downloading. ×
0
The Reflectivity

              Marcus Denker

              with:
              David Röthlisberger
              Philippe...
Structural Reflection



>    Structure modeled as objects

     — e.g. Classes, methods
     — Causally connected

>    Us...
Methods and Reflection



>    Method are Objects
     — e.g in Smalltalk


>    No high-level model for sub-method element...
Sub-Method Reflection



>    Many tools work on sub method level
     — Profiler, Refactoring Tool, Debugger, Type Checker
...
Solution: Reflective Methods


> Annotated, persistent AST
> Bytecode generated on demand and cached


    :ReflectiveMethod...
Reflectivity


>    Implementation of Reflective Methods for Squeak
     Smalltalk

>    Smalltalk Compiler generates Reflect...
DEMO I




>    Show invalidation of code



>    Show assert Demo




© Marcus Denker
Reflective Methods: Annotations


>    Source visible annotations
     — extended Smalltalk syntax

                  (9 ra...
Example: Pluggable Type-System


>    Example for textual annotations


      bitFromBoolean: aBoolean <:type: Boolean :>
...
Reflex: Partial Behavioral Reflection


> Hooksets: collection of operation occurrences
> Links
     — Bind hooksets to meta...
Links as Annotations

>    Links can be annotations on the AST



                                           Meta
        ...
Demo II: Geppetto




>    Show Bounce Demo




>    Show Coverage Demo




© Marcus Denker
Future Work


>    Optimize Size of AST Representation
     — Simpler AST
     — AST Compression

>    Contextual Reificati...
Upcoming SlideShare
Loading in...5
×

Reflectivity Demo

640

Published on

Reflectivity Demo (Dyla07, ECOOP 2007)

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
640
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Reflectivity Demo"

  1. 1. The Reflectivity Marcus Denker with: David Röthlisberger Philippe Marschall Nik Haldiman Adrian Lienhard / Lukas Renggli Eric Tanter Stephane Ducasse Oscar Nierstrasz © Marcus Denker
  2. 2. Structural Reflection > Structure modeled as objects — e.g. Classes, methods — Causally connected > Uses: — Development environments — Language extensions and experiments © Marcus Denker
  3. 3. Methods and Reflection > Method are Objects — e.g in Smalltalk > No high-level model for sub-method elements — Message sends — Assignments — Variable access > Structural reflection stops at the granularity of methods © Marcus Denker
  4. 4. Sub-Method Reflection > Many tools work on sub method level — Profiler, Refactoring Tool, Debugger, Type Checker > Communication between tools needed — example: Code coverage > All tools use different representations — Tools are harder to build — Communication not possible © Marcus Denker
  5. 5. Solution: Reflective Methods > Annotated, persistent AST > Bytecode generated on demand and cached :ReflectiveMethod :CompiledMethod annotation compiledMethod #(12 13 45 38 98 128 annotation reflectiveMethod 84 72 42 77 22 28 59 32 7 49 51 87 64) Tools VM © Marcus Denker
  6. 6. Reflectivity > Implementation of Reflective Methods for Squeak Smalltalk > Smalltalk Compiler generates Reflective Methods — Translated to Bytecode on demand > Open Compiler: Plugins — Generator plugin: called before code generation – Transform a copy of the AST — Analysis plugin: called after name analysis © Marcus Denker
  7. 7. DEMO I > Show invalidation of code > Show assert Demo © Marcus Denker
  8. 8. Reflective Methods: Annotations > Source visible annotations — extended Smalltalk syntax (9 raisedTo: 10000) <:evaluateAtCompiletime:> > Source invisible annotations — Reflective API — Can reference any object > Every node can be annotated > Semantics: Compiler Plugins © Marcus Denker
  9. 9. Example: Pluggable Type-System > Example for textual annotations bitFromBoolean: aBoolean <:type: Boolean :> ^ (aBoolean ifTrue: [1] ifFalse: [0]) <:type: Integer :> > Optional, pluggable type-system > Types stored as annotations in the Reflective Methods © Marcus Denker
  10. 10. Reflex: Partial Behavioral Reflection > Hooksets: collection of operation occurrences > Links — Bind hooksets to metaobjects — Define Protocol between base and meta metaobject > Goals — Highly selective reification links activation condition — Flexiblel metalevel engineering – Protocol specification hookset – Cross-cutting hooksets Tanter, OOPSLA03 © Marcus Denker
  11. 11. Links as Annotations > Links can be annotations on the AST Meta Link © Marcus Denker
  12. 12. Demo II: Geppetto > Show Bounce Demo > Show Coverage Demo © Marcus Denker
  13. 13. Future Work > Optimize Size of AST Representation — Simpler AST — AST Compression > Contextual Reifications — Context depended Links > Beyond Text — Store only AST (no text) — Build text from annotated AST © Marcus Denker
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×