From Metaobject Protocols to Versatile Kernels for AOP ric T anter - - PowerPoint PPT Presentation

from metaobject protocols to versatile kernels for aop
SMART_READER_LITE
LIVE PREVIEW

From Metaobject Protocols to Versatile Kernels for AOP ric T anter - - PowerPoint PPT Presentation

Santiago, Chile - November 8th 2004 From Metaobject Protocols to Versatile Kernels for AOP ric T anter PhD Thesis Defense Universit de Nantes Universidad de Chile DCC - CWR OBASCO - EMN/INRIA Thesis Committee President Prof. Eric


slide-1
SLIDE 1

From Metaobject Protocols to Versatile Kernels for AOP

Éric T anter

PhD Thesis Defense

Universidad de Chile

DCC - CWR

Université de Nantes

OBASCO - EMN/INRIA

Santiago, Chile - November 8th 2004

slide-2
SLIDE 2

Thesis Committee

President

  • Prof. Eric Monfroy (U.Nantes, France)

Principal Examiners

  • Prof. Theo d’Hondt (VUB, Belgium)
  • Prof. Shigeru Chiba (TITECH, Japan)

Committee Members

  • Prof. Nancy Hitschfeld (DCC U.Chile, Chile)
  • Prof. Gustavo Rossi (LIFIA, Argentina)

Advisors

  • Prof. Pierre Cointe (EMN/INRIA, France)
  • Dr. Jacques Noyé (EMN/INRIA, France)
  • Prof. José Piquer (DCC U.Chile, Chile)

2

slide-3
SLIDE 3

3

Context

Software design: fundamental trade-off

structure (modularization) evolution (adaptation)

Basic principles

Separation of Concerns (SoC) [Dijkstra68] Information hiding [Parnas72]

T echnical means

modules, classes, objects: limits

slide-4
SLIDE 4

4

Problem Statement

Computational reflection [Smith82]

most general approach Issues of reflection limit its acceptance

cost, rigidity, complexity

Aspect-Oriented Programming [Kiczales+97]

More specific support for modularization

aspect languages

Sacrificing flexibility and extensibility

R AOP ?

slide-5
SLIDE 5

5

Thesis in a nutshell

An operational model of reflection

genericity of reflection and specificity of AOP

Versatile substrate for AOP

based on reflective model combined with guidance of aspect languages

Validation

Prototype implementation in Java: Reflex Significant applications

R AOP ?

slide-6
SLIDE 6

6

Contents

Thesis in a Nutshell Concepts: reflection & AOP Contributions Conclusions & Perspectives

slide-7
SLIDE 7

7

Computational Reflection

Computational system (CS)[Maes87]

program (text) + evaluator

Metasystem

CS manipulating other programs/CS evaluator, debugger, ...

Reflective system

CS accessing its own metasystem

[Smith82]

slide-8
SLIDE 8

8

Reflection and Adaptation

Reflection operators [FriedmanWand84]

reification absorption

A program can

  • bserve its evaluator’s state (introspection)

modify its evaluator (intercession)

e.g. concurrency at the metalevel

meta base

slide-9
SLIDE 9

9

Reflection & OOP: MOPs

Structure metalevel interface with OO

get the benefits of object orientation

abstraction, encapsulation, localized extension

Metaobject Protocols (MOPs) [Kiczales+91]

Different models [Ferber89]

metaclass [Cointe87], metaobject [Maes87], message reification, etc.

slide-10
SLIDE 10

10

MOPs: Modeling Issues

nature of metalink [Matsuoka+91]

individual based, group wide, hybrid...

metalevel structure [McAffer96]

structural vs. operational decomposition

granularity, locality of change [GowingCahill96]

fine-grained MOPs, multiple reflective models

slide-11
SLIDE 11

11

Mastering Locality

Central tension support crosscutting views of a system? “very often, the concepts that are most natural to use at the metalevel crosscut those provided at the base level”

[Kiczales92]

slide-12
SLIDE 12

12

AOP Principles [Kiczales+97]

Modularization of crosscutting functionalities

providing extra composition mechanisms GP languages: procedure call responsible for code tangling

Aspects, Weaver

P A A A WEAVER SYSTEM

slide-13
SLIDE 13

13

AOP Languages

Join-point models [Masuhara+03]

join-points

points of reference in a base program that aspects can affect

means of identifying join points means of effecting at join points

slide-14
SLIDE 14

14

AOP & Reflection

“ AOP is a goal, for which reflection is one powerful tool”

“ AOP is a principled subset of reflection” “ AOP is not reflection”

[Kiczales+97]

Relation

reflection can be used for aspect weaving used in the early experiments on AOP

Intrigue

first, ideas of reflection and MOPs then, shift to “reflection-free” discourse what’s the reality behind? spectrum/range?

[Douence04] [Kiczales01]

slide-15
SLIDE 15

15

Contents

Thesis in a Nutshell Concepts: reflection & AOP Contributions Conclusions & Perspectives

slide-16
SLIDE 16

16

Contributions

Partial Behavioral Reflection Versatile AOP Kernels Reflex/Java, Open Implementation Applications

R AOP ?

slide-17
SLIDE 17

17

Specific Context

Behavioral reflection / runtime MOPs

metaobjects reasoning and acting upon reifications of a program described in terms

  • f operations [McA96]

Specific issues

base object metaobject reification metalink hook control flow

base meta

slide-18
SLIDE 18

18

  • 1. Cost Issue

Reifying operation occurrences is expensive

reify only when needed reify only needed information (+how)

A a =

  • .foo(5);

A a = metaobj.handle( new Call(this, o,

  • .getClass().getMethod(“foo”),

new Object[]{new Integer(5)}));

hook

slide-19
SLIDE 19

19

  • 2. Metalink Issue

Classical view on metalink

entity-based: per object, per class

leads to tangled metalevel

what we want: a concern-based metalevel

meta base meta base

slide-20
SLIDE 20

20

  • 3. MOP Design Issue

Definition of the precise protocol between levels T rade-off

expressiveness / performance / flexibility

Frozen in existing reflective systems

at least rigid (e.g. [GowingCahill96])

slide-21
SLIDE 21

21

Proposal

Operational model of Partial Reflection

Selective reification Links as configurable first-class entities Open MOP support / MOP specialization

[OOPSLA03]

slide-22
SLIDE 22

22

Selective reification

Systematic analysis of partiality Spatial selection

what should be reified? entities, operations, operation occurrences

T emporal selection

when to reify? dynamically-evaluated conditions e.g. transparent futures

slide-23
SLIDE 23

23

Links

Flexible metalink

Group selected hooks in a hookset (1st class, composable) Bind hookset to metaobject Attributes

scope: global, class, object activation: predicate control: before, after, replace ...

Event Condition Action

meta base

linkC linkB linkA

slide-24
SLIDE 24

24

Open MOP Support

Specific MOPs are defined by metalevel architects

what is an operation? which are supported? interface of metaobjects (method and data)

Several MOPs can coexist

slide-25
SLIDE 25

25

MOP Specialization

Flexible and fine-grained specialization

call generator descriptors type, method and parameters

MOP descriptors per

  • peration

link hookset

[SCCC04]

slide-26
SLIDE 26

26

MOP Specialization for SOM

somLink = API.links().addLink(MsgReceive.class, ...); somLink.setControl(Control.BEFORE_AFTER); _mo_somLink.beforeMsgReceive([m, r, args]); .. _mo_somLink.afterMsgReceive([m, r, args, res]);

Using standard MOP

somLink.setMOCall(Control.BEFORE, Scheduler.class, “enter”, nameP, argsP); somLink.setMOCall(Control.AFTER, Scheduler.class, “exit”); _mo_somLink.enter(“put”, [ o ]); .. _mo_somLink.exit();

Using specialized MOP

[ECOOP04]

slide-27
SLIDE 27

27

MOP Specialization for SOM

2,125 4,250 6,375 8,500 2 4 8 16 32 64 128

standard MOP specialized MOP

consumers time (ms)

  • buffer, 1 slot, 1 producer, n consumers -

as efficient as hand-made source code modification

1 2 3 4 2 4 8 16 32 64 128

speedup

slide-28
SLIDE 28

28

Contributions

Partial Behavioral Reflection Versatile AOP Kernels Reflex/Java, Open Implementation Applications

R AOP ?

slide-29
SLIDE 29

29

Specific Context

Variety of AOP proposals

exploring the design space

different models domain-specific vs. general-purpose

combining different approaches

depending on tackled concern (domain) positive reports [Rashid01]

slide-30
SLIDE 30

30

Compatibility Reuse of weaver

AOP Kernels

API application compose weave translate compose translate

L1 L2 KERNEL

Issues

application weave compose weave

L1 L2

?!?

slide-31
SLIDE 31

31

Features of AOP

Analysis of AOP proposals

asymmetric approaches (e.g., Pointcut-Advice)

Anatomy of AOP languages

sub-languages

cut: where action: what binding: association, instantiation

behavior and structure

[Masuhara+03,Wand+04]

slide-32
SLIDE 32

32

Kernel Requirements

Aspect languages

  • pen support, modular integration

Behavior and structure

expressive cut, complete action, separate binding

Composition and collaboration Explicit interactions application/aspects Base-language compliance

[EIWAS04]

slide-33
SLIDE 33

33

Kernel Approach

Use partial reflection as base

generality + specializability

Mapping

cut: introspection (hookset, activation) action: intercession (metaobject) binding: metalink (link, MOP)

Abstraction gap

e.g., an AspectJ aspect with cflow

versatility

[GPCE05]

in cflow?

slide-34
SLIDE 34

34

Kernel Requirements

Aspect languages

  • pen support, modular integration

Behavior and structure

expressive cut, complete action, separate binding

Composition and collaboration Explicit interactions application/aspects Base-language compliance

slide-35
SLIDE 35

35

Aspect Languages

Abstraction gap

1 aspect = 1 linkset = n links

Lightweight plugin architecture

plugin = AL parser + kernel definitions AL general-purpose or domain-specific

Composition and traceability

conflicts detected on links reported and resolved on linksets

schedule: BoundedBuffer with: MyScheduler

slide-36
SLIDE 36

36

Contributions

Partial Behavioral Reflection Versatile AOP Kernels Reflex/Java, Open Implementation Applications

slide-37
SLIDE 37

37

Reflex for Java

Working implementation

portable and efficient

bytecode transformation (Javassist [Chiba00,Chiba+03])

Open Implementation

iterative process, progressive decoupling intensive use of OI design guidelines [Kiczales+97b] modular and extensible:

Core Reflex / API (180 classes) Standard library: operations, base metaobjects... T

  • ols, examples, plugins...

[Reflection01,OOPSLA03,GPCE05]

slide-38
SLIDE 38

38

Contributions

Partial Behavioral Reflection Versatile AOP Kernels Reflex/Java, Open Implementation Applications

slide-39
SLIDE 39

39

Applications

Reference management in mobile code

initial motivation and requirements

T ransparent futures

expressive MOP and selection, temporal selection

Sequential Object Monitors (SOM)

MOP specialization, efficiency, DSAL

subset of AspectJ

dynamic crosscutting, efficiency, GPAL

[SCCC01,EWMOS02] [OOPSLA03] [ECOOP04] [SCCC04]

slide-40
SLIDE 40

40

Contents

Thesis in a Nutshell Concepts: reflection & AOP Contributions Conclusions & Perspectives

slide-41
SLIDE 41

41

Model of Partial Reflection

Achievements

balance trade-off between genericity/specificity

flexible metalink, MOP specialization

in between low-level and high-level tools portable, efficient, applicable implementation

Perspectives

influence of “real-world constraints” trade-off structure/adaptation fully-static and fully-dynamic contexts

slide-42
SLIDE 42

42

AOP Kernels

Achievements

identification of the need and analysis first prototype, including composition combine power of reflection and guidance of aspect languages

Perspectives

AO models: prototypes, basic blocks finer-grained, more precise, interactions back to applications: Grid computing, Web apps, ...

DSALs: design, composition and interactions

slide-43
SLIDE 43

Publications

with: Noury Bouraqadi, Denis Caromel (2), Pierre Cointe, Peter Ebraert (2), Luis Mateu, Jacques Noyé (6), José Piquer (3), Leonardo Rodríguez (2), Marc Ségura, Michael Vernaillen

I n t . C o n f e r e n c e s

A Versatile Kernel for Multi-Language AOP” @GPCE’05

  • “Supporting Dynamic Crosscutting with Partial

Behavioral Reflection: a Case Study” @SCCC’04

  • “Sequential Object Monitors” @ECOOP’04
  • “Partial Behavioral Reflection: Spatial and

T emporal Selection of Reification” @OOPSLA ’03

Altering Java Semantics via Bytecode Manipulation” @GPCE’02

  • “Managing References upon Object Migration:

Applying Separation of Concerns” @SCCC’01

  • “Reflex - T
  • wards an Open Reflective Extension
  • f Java” @Reflection’01

I n t . W o r k s h o p s

  • “Motivation and Requirements for a

Versatile AOP Kernel” @EIWAS’04

A Concern-based Approach to Software Evolution” @DAW/AOSD’04

A Flexible Approach to Runtime Inspection” @ASARTI/ECOOP’03

  • “T
  • wards T

ransparent Adaptation of Migration Policies” @EWMOS/ECOOP’02

  • “Runtime Metaobject Protocols: the

Quest for their Holy Application” @PhDOOS/ECOOP’02

also: François Nollen, Angel Núñez, Guillaume Pothier, Rodolfo T

  • ledo
slide-44
SLIDE 44