• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Unanticipated Partial Behavioral Reflection

on

  • 775 views

Unanticipated Partial Behavioral Reflection. David Röthlisberger,

Unanticipated Partial Behavioral Reflection. David Röthlisberger,
Marcus Denker,
Eric Tanter. ESUG 2006, Prague

Statistics

Views

Total Views
775
Views on SlideShare
775
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Unanticipated Partial Behavioral Reflection Unanticipated Partial Behavioral Reflection Presentation Transcript

    • Unanticipated Partial Behavioral Reflection David Röthlisberger Marcus Denker Eric Tanter © Marcus Denker
    • Roadmap > Example > Behavioral Reflection — Smalltalk / Metaclasstalk — Unanticipated Reflection — Partial Reflection > Unanticipated Partial Behavioral Reflection > Example revisited > Benchmarks > Conclusion © Marcus Denker
    • Running Example > Typical web application (e.g. Wiki) > Shows performance problem under high load > Goals: — Profile and fix the problem — No restart / interruption of service © Marcus Denker
    • Towards a Solution > Analyse the problem — Install profiler — Analyze — Retract profiler > Solve the problem — Introduce a caching mechanism — Experiment with multiple solutions © Marcus Denker
    • Reflection > Reflection: computation about computation — base level / meta level — causally connected > Structural Reflection — Reification of structure > Behavioral Reflection — Reification of execution © Marcus Denker
    • Unanticipated Reflection > “Unanticipated Use” means: — No need to know in advance (and plan for) reflection — Possible to be done at runtime > Java: reflection only at load time — No runtime change in general — Need to compile in hooks for reflection > Smalltalk reflection is unanticipated — taken for granted. But it’s quite cool! © Marcus Denker
    • Reflection in Smalltalk > Structural Reflection — Classes / Methods are objects — Can be changed at runtime > Behavioral Reflection — No model of execution below method body — message sending / variable access hard coded by VM — #doesNotUnderstand / MethodWrappers > Reflective capabilities of Smalltalk should be improved! © Marcus Denker
    • MetaclassTalk > Extends the Smalltalk metaclass model > Metaclass defines — message lookup — access to instance variables > Problems: — Reflection only controllable at class boundaries — No fine-grained selection (e.g. single operations) — Protocol between base and meta level is fixed © Marcus Denker
    • Partial 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 © Marcus Denker
    • Geppetto > Partial Behavioral Reflection pioneered in Java — Code transformation at load time — Not unanticipated (it’s Java...) > Geppetto: Partial Behavioral Reflection for Smalltalk > For Squeak 3.9 with ByteSurgeon — but portable to other dialects > Let’s see an example! © Marcus Denker
    • Solving the Problem > Operation: — Method Execution (around) > Hookset: — All execution operations in the wiki package metaobject > Metaobject: — A profiling tool links activation condition hookset © Marcus Denker
    • Solving the Problem: Hookset + Link > Hookset allExecs := Hookset new. allExecs inPackage: ’Wiki’; operation: MethodEval. > Link profile := Link id: #profiler hookset: allExecs metaobject: Profiler new. profile control: Control around. © Marcus Denker
    • Solving the Problem: Protocol > Protocol profile callDescriptor: (CallDescriptor selector: #profileMethod:in:withArguments: parameters: {Parameter selector. Parameter self. Parameter arguments.} passingMode: PassingMode plain). > Install / Retract profile install. profile uninstall. © Marcus Denker
    • Solving the Problem: Caching > Operation: — Method Execution (around) > Hookset: — The one slow method (#toughWorks:) metaobject > Metaobject: — A Cache links activation condition hookset © Marcus Denker
    • Caching II > Hookset: toughWorks := Hookset new. toughWorks inClass: Worker; inMethod: #toughWork:; operation: MethodEval. > Link: cache := Link id: #cache hookset: toughWorks metaobject: Cache new. cache control: Control around. cache callDescriptor:(CallDescriptor selector: #cacheFor: parameters: {Parameter arg1} passingMode: PassingMode plain). © Marcus Denker
    • Geppetto > Operations: — MethodEval (like MethodWrappers) — MsgSend, InstVarAccess, TempAccess > Control — Before, After, Around, Replace > Activation condition per Link © Marcus Denker
    • Benchmarks I > Slowdown for reification of message send System Slowdown Geppetto 10.85 Iguana/J 24 Metaclasstalk 20 © Marcus Denker
    • Benchmarks II > Geppetto Vs. Metaclasstalk Metaclasstalk Geppetto Speedup (ms) (ms) message 108 46 2.3x send instance var 272 92 2.9x read © Marcus Denker
    • Future Work > Pluggable backends — Bytecode — AST based transformation — VM Support > Use for typical ByteSurgeon based projects — e.g. Tracing, Unstuck-Debugger > Experiment with advanced Scoping © Marcus Denker
    • Conclusion > Example for the need of Partial Behavioral Reflection > Overview of Geppetto > Solution of the Example > Benchmarks © Marcus Denker
    • Conclusion > Example for the need of Partial Behavioral Reflection > Overview of Geppetto > Solution of the Example > Benchmarks Questions? © Marcus Denker