<s>
An	O
aspect	B-Application
weaver	I-Application
is	O
a	O
metaprogramming	B-Application
utility	O
for	O
aspect-oriented	B-Architecture
languages	I-Architecture
designed	O
to	O
take	O
instructions	O
specified	O
by	O
aspects	B-Application
(	O
isolated	O
representations	O
of	O
significant	O
concepts	O
in	O
a	O
program	O
)	O
and	O
generate	O
the	O
final	O
implementation	O
code	O
.	O
</s>
<s>
The	O
weaver	O
integrates	O
aspects	B-Application
into	O
the	O
locations	O
specified	O
by	O
the	O
software	O
as	O
a	O
pre-compilation	O
step	O
.	O
</s>
<s>
By	O
merging	O
aspects	B-Application
and	O
classes	O
(	O
representations	O
of	O
the	O
structure	O
of	O
entities	O
in	O
the	O
program	O
)	O
,	O
the	O
weaver	O
generates	O
a	O
woven	O
class	O
.	O
</s>
<s>
Aspect	B-Application
weavers	I-Application
take	O
instructions	O
known	O
as	O
advice	B-Application
specified	O
through	O
the	O
use	O
of	O
pointcuts	B-Application
and	O
join	B-Application
points	I-Application
,	O
special	O
segments	O
of	O
code	O
that	O
indicate	O
what	O
methods	B-Language
should	O
be	O
handled	O
by	O
aspect	B-Application
code	O
.	O
</s>
<s>
The	O
implementation	O
of	O
the	O
aspect	B-Application
then	O
specifies	O
whether	O
the	O
related	O
code	O
should	O
be	O
added	O
before	O
,	O
after	O
,	O
or	O
throughout	O
the	O
related	O
methods	B-Language
.	O
</s>
<s>
By	O
doing	O
this	O
,	O
aspect	B-Application
weavers	I-Application
improve	O
modularity	B-Architecture
,	O
keeping	O
code	O
in	O
one	O
place	O
that	O
would	O
otherwise	O
have	O
been	O
interspersed	O
throughout	O
various	O
,	O
unrelated	O
classes	O
.	O
</s>
<s>
However	O
,	O
the	O
desire	O
to	O
create	O
radically	O
different	O
programming	O
languages	O
to	O
support	O
the	O
aspect-oriented	B-Architecture
programming	I-Architecture
paradigm	O
is	O
not	O
significant	O
due	O
to	O
business-related	O
concerns	O
;	O
there	O
are	O
risks	O
associated	O
with	O
adopting	O
new	O
technologies	O
.	O
</s>
<s>
Use	O
of	O
an	O
entirely	O
new	O
language	O
relies	O
on	O
a	O
business	O
's	O
ability	O
to	O
acquire	O
new	O
developers	B-Application
.	O
</s>
<s>
Finally	O
,	O
a	O
business	O
would	O
need	O
to	O
acquire	O
a	O
new	O
toolchain	B-General_Concept
(	O
suite	O
of	O
tools	O
)	O
for	O
development	O
,	O
which	O
is	O
often	O
both	O
an	O
expense	O
in	O
both	O
money	O
and	O
time	O
.	O
</s>
<s>
Primary	O
concerns	O
about	O
roadmaps	O
for	O
the	O
adoption	O
of	O
new	O
technologies	O
tend	O
to	O
be	O
the	O
need	O
to	O
train	O
new	O
developers	B-Application
and	O
adapt	O
existing	O
processes	O
to	O
the	O
new	O
technology	O
.	O
</s>
<s>
To	O
address	O
these	O
business	O
concerns	O
,	O
an	O
aspect	B-Application
weaver	I-Application
enables	O
the	O
use	O
of	O
widely	O
adopted	O
languages	O
like	O
Java	B-Language
with	O
aspect-oriented	B-Architecture
programming	I-Architecture
through	O
minor	O
adaptations	O
such	O
as	O
AspectJ	B-Application
which	O
work	O
with	O
existing	O
tools	O
.	O
</s>
<s>
Instead	O
of	O
developing	O
an	O
entirely	O
new	O
language	O
,	O
the	O
aspect	B-Application
weaver	I-Application
interprets	O
the	O
extensions	O
defined	O
by	O
AspectJ	B-Application
and	O
builds	O
"	O
woven	O
"	O
Java	B-Language
code	I-Language
which	O
can	O
then	O
be	O
used	O
by	O
any	O
existing	O
Java	B-Language
compiler	B-Language
.	O
</s>
<s>
This	O
ensures	O
that	O
any	O
existing	O
object	B-Language
oriented	I-Language
code	O
will	O
still	O
be	O
valid	O
aspect-oriented	B-Architecture
code	O
and	O
that	O
development	O
will	O
feel	O
like	O
a	O
natural	O
extension	O
of	O
the	O
object-oriented	B-Language
language	I-Language
.	O
</s>
<s>
The	O
AspectC++	B-Application
programming	O
language	O
extends	O
C++	B-Language
through	O
the	O
use	O
of	O
an	O
aspect	B-Application
weaver	I-Application
,	O
offering	O
the	O
additional	O
efficiency	O
over	O
AspectJ	B-Application
that	O
is	O
necessary	O
for	O
embedded	B-Architecture
systems	I-Architecture
while	O
still	O
retaining	O
the	O
benefits	O
of	O
aspect-oriented	B-Architecture
programming	I-Architecture
.	O
</s>
<s>
Aspect	B-Application
weavers	I-Application
operate	O
by	O
taking	O
instructions	O
specified	O
by	O
aspects	B-Application
,	O
known	O
as	O
advice	B-Application
,	O
and	O
distributing	O
it	O
throughout	O
the	O
various	O
classes	O
in	O
the	O
program	O
automatically	O
.	O
</s>
<s>
The	O
advice	B-Application
specifies	O
the	O
exact	O
location	O
and	O
functionality	O
of	O
the	O
injected	O
code	O
.	O
</s>
<s>
Through	O
this	O
weaving	O
process	O
,	O
aspect	B-Application
weavers	I-Application
allow	O
for	O
code	O
which	O
would	O
have	O
otherwise	O
been	O
duplicated	O
across	O
classes	O
.	O
</s>
<s>
By	O
eliminating	O
this	O
duplication	O
,	O
aspect	B-Application
weavers	I-Application
promote	O
modularity	B-Architecture
of	O
cross-cutting	B-Application
concerns	I-Application
.	O
</s>
<s>
Aspects	B-Application
define	O
the	O
implementation	O
code	O
which	O
would	O
have	O
otherwise	O
been	O
duplicated	O
and	O
then	O
use	O
pointcuts	B-Application
and	O
join	B-Application
points	I-Application
to	O
define	O
the	O
advice	B-Application
.	O
</s>
<s>
During	O
weaving	O
,	O
the	O
aspect	B-Application
weaver	I-Application
uses	O
the	O
pointcuts	B-Application
and	O
join	B-Application
points	I-Application
,	O
known	O
as	O
a	O
pointcut	B-Application
designator	O
,	O
to	O
identify	O
the	O
positions	O
in	O
candidate	O
classes	O
at	O
which	O
the	O
implementation	O
should	O
be	O
injected	O
.	O
</s>
<s>
The	O
implementation	O
is	O
then	O
injected	O
into	O
the	O
classes	O
at	O
the	O
points	O
identified	O
,	O
thus	O
permitting	O
the	O
code	O
to	O
be	O
executed	O
at	O
the	O
appropriate	O
times	O
without	O
relying	O
on	O
manual	O
duplication	O
by	O
the	O
programmer	B-Application
.	O
</s>
<s>
pointcut	B-Application
method( )	O
:	O
execution( *	O
*( 	O
..	O
)	O
)	O
;	O
</s>
<s>
thisJoinPoint.getSignature( )	O
.toString( )	O
)	O
;	O
</s>
<s>
thisJoinPoint.getSignature( )	O
.toString( )	O
)	O
;	O
</s>
<s>
In	O
the	O
programming	O
language	O
AspectJ	B-Application
,	O
pointcuts	B-Application
,	O
join	B-Application
points	I-Application
,	O
and	O
the	O
modularized	O
code	O
are	O
defined	O
in	O
an	O
aspect	B-Application
block	O
similar	O
to	O
that	O
of	O
Java	B-Language
classes	O
.	O
</s>
<s>
Classes	O
are	O
defined	O
using	O
Java	B-Language
syntax	O
.	O
</s>
<s>
The	O
weaving	O
process	O
consists	O
of	O
executing	O
the	O
aspect	B-Application
advice	B-Application
to	O
produce	O
only	O
a	O
set	O
of	O
generated	O
classes	O
that	O
have	O
the	O
aspect	B-Application
implementation	O
code	O
woven	O
into	O
it	O
.	O
</s>
<s>
The	O
example	O
at	O
right	O
shows	O
a	O
potential	O
implementation	O
of	O
an	O
aspect	B-Application
which	O
logs	O
the	O
entry	O
and	O
exit	O
of	O
all	O
methods	B-Language
.	O
</s>
<s>
Without	O
an	O
aspect	B-Application
weaver	I-Application
,	O
this	O
feature	O
would	O
necessitate	O
duplication	O
of	O
code	O
in	O
the	O
class	O
for	O
every	O
method	O
.	O
</s>
<s>
Instead	O
,	O
the	O
entry	O
and	O
exit	O
code	O
is	O
defined	O
solely	O
within	O
the	O
aspect	B-Application
.	O
</s>
<s>
The	O
aspect	B-Application
weaver	I-Application
analyzes	O
the	O
advice	B-Application
specified	O
by	O
the	O
pointcut	B-Application
in	O
the	O
aspect	B-Application
and	O
uses	O
that	O
advice	B-Application
to	O
distribute	O
the	O
implementation	O
code	O
into	O
the	O
defined	O
class	O
.	O
</s>
<s>
The	O
aspect	B-Application
weaver	I-Application
determines	O
the	O
appropriate	O
code	O
to	O
generate	O
in	O
each	O
situation	O
as	O
defined	O
by	O
the	O
implementation	O
advice	B-Application
and	O
then	O
injects	O
it	O
into	O
methods	B-Language
matching	O
the	O
specified	O
pointcut	B-Application
.	O
</s>
<s>
Instead	O
of	O
generating	O
a	O
set	O
of	O
woven	O
source	O
code	O
,	O
some	O
AspectJ	B-Application
weavers	O
instead	O
weave	O
the	O
aspects	B-Application
and	O
classes	O
together	O
directly	O
into	O
bytecode	O
,	O
acting	O
both	O
as	O
the	O
aspect	B-Application
weaver	I-Application
and	O
compiler	B-Language
.	O
</s>
<s>
It	O
is	O
expected	O
that	O
the	O
performance	O
of	O
aspect	B-Application
weavers	I-Application
which	O
also	O
perform	O
the	O
compilation	B-Language
process	O
will	O
require	O
more	O
computation	O
time	O
due	O
to	O
the	O
weaving	O
process	O
involved	O
.	O
</s>
<s>
However	O
,	O
the	O
bytecode	O
weaving	O
process	O
produces	O
more	O
efficient	O
runtime	B-Library
code	O
than	O
would	O
usually	O
be	O
achieved	O
through	O
compiled	B-Language
woven	O
source	O
.	O
</s>
<s>
Developments	O
in	O
AspectJ	B-Application
have	O
revealed	O
the	O
potential	O
to	O
incorporate	O
just-in-time	O
compilation	B-Language
into	O
the	O
execution	O
of	O
aspect-oriented	B-Architecture
code	O
to	O
address	O
performance	O
demands	O
.	O
</s>
<s>
At	O
run-time	B-Library
,	O
an	O
aspect	B-Application
weaver	I-Application
could	O
translate	O
aspects	B-Application
in	O
a	O
more	O
efficient	O
manner	O
than	O
traditional	O
,	O
static	B-General_Concept
weaving	O
approaches	O
.	O
</s>
<s>
Using	O
AspectJ	B-Application
on	O
a	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
,	O
dynamic	O
weaving	O
of	O
aspects	B-Application
at	O
run-time	B-Library
has	O
been	O
shown	O
to	O
improve	O
code	O
performance	O
by	O
26%	O
.	O
</s>
<s>
While	O
some	O
implementations	O
of	O
just-in-time	O
virtual	B-Architecture
machines	I-Architecture
implement	O
this	O
capability	O
through	O
a	O
new	O
virtual	B-Architecture
machine	I-Architecture
,	O
some	O
implementations	O
can	O
be	O
designed	O
to	O
use	O
features	O
that	O
already	O
exist	O
in	O
current	O
virtual	B-Architecture
machines	I-Architecture
.	O
</s>
<s>
The	O
requirement	O
of	O
a	O
new	O
virtual	B-Architecture
machine	I-Architecture
is	O
contrary	O
to	O
one	O
of	O
the	O
original	O
design	O
goals	O
of	O
AspectJ	B-Application
.	O
</s>
<s>
To	O
accomplish	O
just-in-time	O
weaving	O
,	O
a	O
change	O
to	O
the	O
virtual	B-Architecture
machine	I-Architecture
that	O
executes	O
the	O
compiled	B-Language
bytecode	O
is	O
necessary	O
.	O
</s>
<s>
A	O
proposed	O
solution	O
for	O
AspectJ	B-Application
uses	O
a	O
layered	B-Architecture
approach	O
which	O
builds	O
upon	O
the	O
existing	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
to	O
add	O
support	O
for	O
join	B-Application
point	I-Application
management	O
and	O
callbacks	O
to	O
a	O
Dynamic	O
Aspect-Oriented	B-Architecture
Programming	I-Architecture
Engine	O
.	O
</s>
<s>
An	O
alternative	O
implementation	O
uses	O
a	O
weaving	O
engine	O
that	O
uses	O
breakpoints	O
to	O
halt	O
execution	O
at	O
the	O
pointcut	B-Application
,	O
select	O
an	O
appropriate	O
method	O
,	O
embed	O
it	O
into	O
the	O
application	O
,	O
and	O
continue	O
.	O
</s>
<s>
The	O
use	O
of	O
breakpoints	O
in	O
this	O
manner	O
has	O
been	O
shown	O
to	O
reduce	O
performance	O
due	O
to	O
a	O
very	O
large	O
number	O
of	O
context	B-Operating_System
switches	I-Operating_System
.	O
</s>
<s>
Aspect	B-Application
weavers	I-Application
 '	O
performance	O
,	O
as	O
well	O
as	O
the	O
performance	O
of	O
the	O
code	O
that	O
they	O
produce	O
,	O
has	O
been	O
a	O
subject	O
of	O
analysis	O
.	O
</s>
<s>
It	O
is	O
preferable	O
that	O
the	O
improvement	O
in	O
modularity	B-Architecture
supplied	O
by	O
aspect	B-Application
weaving	O
does	O
not	O
impact	O
run-time	B-Library
performance	O
.	O
</s>
<s>
Aspect	B-Application
weavers	I-Application
are	O
able	O
to	O
perform	O
aspect-specific	O
optimizations	O
.	O
</s>
<s>
While	O
traditional	O
optimizations	O
such	O
as	O
the	O
elimination	O
of	O
unused	O
special	O
variables	O
from	O
aspect	B-Application
code	O
can	O
be	O
done	O
at	O
compile-time	B-Application
,	O
some	O
optimizations	O
can	O
only	O
be	O
performed	O
by	O
the	O
aspect	B-Application
weaver	I-Application
.	O
</s>
<s>
For	O
example	O
,	O
AspectJ	B-Application
contains	O
two	O
similar	O
but	O
distinct	O
keywords	O
,	O
thisJoinPoint	O
,	O
which	O
contains	O
information	O
about	O
this	O
particular	O
instance	O
of	O
woven	O
code	O
,	O
and	O
thisJoinPointStaticPart	O
,	O
which	O
contains	O
information	O
common	O
to	O
all	O
instances	O
of	O
code	O
relevant	O
to	O
that	O
set	O
of	O
advice	B-Application
.	O
</s>
<s>
The	O
optimization	O
of	O
replacing	O
thisJoinPoint	O
with	O
the	O
more	O
efficient	O
and	O
static	B-General_Concept
keyword	O
thisJoinPointStaticPart	O
can	O
only	O
be	O
done	O
by	O
the	O
aspect	B-Application
weaver	I-Application
.	O
</s>
<s>
By	O
performing	O
this	O
replacement	O
,	O
the	O
woven	O
program	O
avoids	O
the	O
creation	O
of	O
a	O
join	B-Application
point	I-Application
object	O
on	O
every	O
execution	O
.	O
</s>
<s>
Studies	O
have	O
shown	O
that	O
the	O
unnecessary	O
creation	O
of	O
join	B-Application
point	I-Application
objects	O
in	O
AspectJ	B-Application
can	O
lead	O
to	O
a	O
performance	O
overhead	O
of	O
5%	O
at	O
run-time	B-Library
,	O
while	O
performance	O
degradation	O
is	O
only	O
approximately	O
1%	O
when	O
this	O
object	O
is	O
not	O
created	O
.	O
</s>
<s>
Compile-time	B-Application
performance	O
is	O
generally	O
worse	O
in	O
aspect	B-Application
weavers	I-Application
than	O
their	O
traditional	O
compiler	B-Language
counterparts	O
due	O
to	O
the	O
additional	O
work	O
necessary	O
for	O
locating	O
methods	B-Language
which	O
match	O
the	O
specified	O
pointcuts	B-Application
.	O
</s>
<s>
A	O
study	O
done	O
showed	O
that	O
the	O
AspectJ	B-Application
compiler	B-Language
ajc	O
is	O
about	O
34%	O
slower	O
than	O
the	O
Sun	O
Microsystems	O
Java	B-Language
1.3	O
compiler	B-Language
and	O
about	O
62%	O
slower	O
than	O
the	O
Java	B-Language
1.4	O
compiler	B-Language
.	O
</s>
