File: ac%2B%2Bexec-survey.lyx

package info (click to toggle)
aspectc%2B%2B 1.0pre4~svn.20090918-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 117,308 kB
  • ctags: 410,601
  • sloc: cpp: 1,883,007; ansic: 17,279; sh: 2,190; makefile: 1,088
file content (455 lines) | stat: -rw-r--r-- 11,214 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\begin_preamble

%--------------------------------------------------------------------
% PDF related
%--------------------------------------------------------------------
\newif\ifpdf 
\ifx\pdfoutput\undefined 
  \pdffalse                     % we are not running PDFLaTeX 
\else 
  \pdfoutput=1                % we are running PDFLaTeX 
  \pdftrue 
\fi

%--------------------------------------------------------------------
% setup hyperref
%--------------------------------------------------------------------
\ifpdf
  \usepackage{color}
  \pagecolor{white}
  \usepackage{hyperref}  
  \hypersetup{% 
    %
    %% general document information
    pdftitle          = {AspectC++ Language Reference}, 
    pdfsubject     = {Dokumentation}, 
    pdfkeywords  = {AOP, AspectC++, pure-systems}, 
    pdfauthor      = {\textcopyright\ pure-systems GmbH and Olaf Spinczyk}, 
    pdfcreator     = {\LaTeX\ with package \flqq hyperref\frqq},
    pdfproducer  = {pdfTeX-0.\the\pdftexversion\pdftexrevision},
    %
    %% document style
    colorlinks=true,                  % colored link
    urlcolor=blue,                    % blue URL links
    bookmarks=true,                % generate bookmarks
    bookmarksnumbered=true,  % generate section numbers
    pdfpagemode=None           % don't open bookmarks
  } 
  
  %% set document creation date to 10.7.2003 00:00
  \pdfinfo {/CreationDate (D:20040628000000)}
\fi

%--------------------------------------------------------------------
% create hyperrefs depending on the use of pdflatex
%--------------------------------------------------------------------
\newcommand\depref[2]{%
  \ifpdf
    \href{#1}{#2}
  \else  
    {#2}
  \fi
}

\rhead{AspectC++ Execution Model Overview}
\lfoot{\copyright 2005 Olaf Spinczyk}
\end_preamble
\language english
\inputencoding auto
\fontscheme pslatex
\graphics default
\paperfontsize default
\spacing single 
\papersize a4paper
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\leftmargin 1cm
\topmargin 0.7cm
\rightmargin 2.5cm
\bottommargin 0.7cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle fancy

\layout Title
\noindent 

\series bold 
\emph on 
AspectC++ -- Execution Model Overview
\layout Author


\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
copyright
\end_inset 

 2005 Olaf Spinczyk <os@aspectc.org>
\newline 
Friedrich-Alexander University Erlangen-Nuremberg
\newline 
Computer Science 4
\layout Standard

This is an overview about the AspectC++ execution model prepared for the
 European AOSD Network of Excellence.
 Detailed information on AspectC++ including manuals and tutorial slides
 with lots of examples is available from 
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
depref{http://www.aspectc.org/}{
\backslash 
emph{the AspectC++ Project Homepage}}
\backslash 
hspace{-4pt}
\end_inset 

.
\layout Standard

The overview is based on the documentation for AspectC++ 0.9.3.
 The execution model is still 
\begin_inset Quotes eld
\end_inset 

work in progress
\begin_inset Quotes erd
\end_inset 

.
\layout Standard
\added_space_top bigskip \line_bottom \noindent 

\size largest 
Models
\layout Section*

Architectural Characteristics
\layout Standard

The following objectives of the AspectC++ development effort are responsible
 for the design of the AspectC++ execution model:
\layout Itemize

The resource consumption of AspectC++ applications should be minimal.
 Compared to a tangled implementation of the same functionality there should
 be 
\emph on 
no overhead
\emph default 
.
\layout Itemize

AspectC++ should fit into the 
\begin_inset Quotes eld
\end_inset 

philosophy
\begin_inset Quotes erd
\end_inset 

 of C++, i.e.
 as much as possible is done at compile-time.
\layout Itemize

AspectC++ should not rely on any runtime infrastructure provided by C++
 such as a heap or RTTI.
 These features are often not available in embedded systems projects or
 system software.
\layout Standard

AspectC++ is implemented by a static source to source transformation from
 AspectC++ to C++.
 A version that is able to generate pure C code if the component code language
 is C will be available in the near future.
\layout Standard

A separate AOP run-time infrastructure is not needed by the generated applicatio
ns.
 A small number of helper functions, classes, and templates is woven directly
 into the application code modules.
\layout Section*

Aspect Model
\layout Standard

The AspectC++ weaver transforms aspects into ordinary C++ classes.
 The generated aspect classes do not inherited from a specific (common)
 base class.
 Therefore, the object layout is not affected by the tranformation.
\layout Section*

Advice Model
\layout Standard

After the transformation, advice becomes an aspect (class) member function.
 If the system is compiled with optimizations enabled, the advice code will
 typically be inlined into the component code.
 The argument list of the advice (function) contains the context variables
 that are passed from the join point to the advice and an optional 
\family typewriter 
\size small 
JoinPoint *tjp
\family default 
\size default 
 pointer.
 This pointer is only passed if the advice code actually uses 
\family typewriter 
\size small 
tjp
\family default 
\size default 
.
\layout Standard

In the case that the advice uses 
\family typewriter 
\size small 
tjp
\family default 
\size default 
, static members, or types defined in 
\family typewriter 
\size small 
JoinPoint
\family default 
\size default 
 the advice is transformed into a template function with 
\family typewriter 
\size small 
JoinPoint
\family default 
\size default 
 as a template parameter type.
 Due to the template instantiation mechanism of C++, multiple instances
 of the advice code might exist at runtime.
\layout Section*

Pointcut Model
\layout Standard

Pointcuts have no runtime representation.
\layout Standard
\added_space_top bigskip \line_bottom \noindent 

\size largest 
Functionality
\layout Section*

Joinpoint Shadow Retrieval
\layout Standard

In the static AspectC++ weaver
\family typewriter 
\size small 
 ac++
\family default 
\size default 
 , joinpoints are retrieved only at compile time.
 A complete syntactical and semantical analysis has to be performed on the
 AspectC++ code.
 The result is a syntax tree representation with links to symbol tables,
 which in include the results of the semantic analysis, and links to tokens
 in the input file.
 The token links are needed for the code transformation.
 Based on the symbol tables the set of static joinpoints (see language descripti
on), execution joinpoints, construction joinpoints, and destruction joinpoints
 is constructed.
 A visitor is used to find all call joinpoint shadows in the syntax tree.
\layout Section*

Weaving Approach
\layout Standard

Our weaver 
\family typewriter 
\size small 
ac++
\family default 
\size default 
 is usually applied directly before calling the C++ compiler.
 With the 
\family typewriter 
\size small 
ag++
\family default 
\size default 
 front-end both steps are even integrated into one tool.
 Depending on the advice defined in the program, the weaver performs the
 following manipulations:
\layout Itemize

function calls are replaced with calls to wrapper functions that call the
 advice chain
\layout Itemize

function implementations are replaced with wrapper functions
\layout Itemize

new members are inserted into classes
\layout Itemize


\family typewriter 
\size small 
#include
\family default 
\size default 
 directives are generated
\layout Itemize


\family typewriter 
\size small 
#include
\family default 
\size default 
 directives are expanded (only in the so-called "single translation unit"
 mode)
\layout Itemize

aspects are transformed into classes
\layout Itemize

the 
\family typewriter 
\size small 
aspectof()
\family default 
\size default 
 function is generated if there is no user defined one
\layout Itemize

code for the instantiation of singleton aspects is generated
\layout Itemize

code for cflow management is generated (enter, exit, check, state instance)
\layout Itemize

helper functions for runtime type condition checks on objects are generated
 (for 
\family typewriter 
\size small 
that
\family default 
\size default 
, 
\family typewriter 
\size small 
target
\family default 
\size default 
, and combinations) 
\layout Standard

Currently, all aspects of the project become 
\begin_inset Quotes eld
\end_inset 

friends
\begin_inset Quotes erd
\end_inset 

 of all classes and other aspects of the project.
 A more sophisticated access control mechanism is future work.
\layout Standard

Introduced members become ordinary members.
 Their visibility (private, public, or protected) is taken from the visibility
 of the advice declaration in the aspect body.
\layout Standard

Advice code and the generated wrapper functions, which call the advice,
 can normally be inlined.
 Only in case of around advice the 
\family typewriter 
\size small 
tjp->proceed()
\family default 
\size default 
 is implemented by an indirect call using a function pointer.
 Therefore, this operation is currently not inlined, which leads to a noticeably
 higher resource consumption than for a combined before and after advice.
 We are currently working on a better code transformation pattern to avoid
 this problem.
\layout Section*

Special Treatment of Dynamic Pointcuts
\layout Standard

Currently, the cflow in AspectC++ does not support pointcuts with context
 variables in the cflow argument.
 Therefore, a cflow can easily be implemented by a counter that is incremented
 when the cflow is entered and decremented when the cflow is left.
 An improved cflow implementation that allows context variables is under
 development.
 Here the context will be stored on the call stack.
\layout Standard

For the 
\family typewriter 
\size small 
that()
\family default 
\size default 
 and 
\family typewriter 
\size small 
target()
\family default 
\size default 
 pointcut functions it is sometimes necessary to generate runtime type checks.
 As we do not require the application code to be compiled with enabled runtime
 type information, 
\family typewriter 
\size small 
ac++
\family default 
\size default 
 generates virtual type condition check functions wherever needed.
 This operation might change the object layout if the corresponding class
 had no associated virtual function table before.
\layout Section*

Advice Instance Management
\layout Standard

Advice code is instantiated at compile time.
 If the advice depends on the type 
\family typewriter 
\size small 
JoinPoint
\family default 
\size default 
, a join point specific class that implements the required types and functions
 is generated and used as a template parameter for the advice code.
\layout Section*

Deployment and Undeployment
\layout Standard

There is no dynamic deployment or undeployment of aspects.
 
\the_end