Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] XReferences Algorithm

Hopefully I am commenting on the shadow IDs that you have seen in the
code... Shadows are assigned IDs for a short time during weaving, this
is because during pointcut rewriting, some of the primitive pointcut
designators making up the pointcut are duplicated in different
branches as is it is transformed to disjunctive normal form.  To
prevent the wasted expense of asking the same shadow if it matches the
same pointcut, the pointcut remembers the last shadow it matched, if a
pointcut is asked again if it matches a shadow with the same ID as it
was most recently asked, then we reply immediately with the same
answer as last time.  Once pointcuts are matched, the IDs are
forgotten.

> Is this whole "ask-every-possible-shadow-if
> -it-matches-some-of-the-
> mungers"-process done every time the weaver runs?

yes

> Or can the weaver somehow maintain the ID (thus the list of matching
> mungers) of a shadow during code evolution by processing the code
> with an incremental weaving feature?

no

> The documentation on incremental weaving per-class tells me that if
> some crosscutting specification may have been updated, then all code
> potentially affected by it may need to be woven.

yes, depending on what is modified, we may need to re-weave code.  If
you change a pointcut and save it we currently have to check
everywhere in case a new match is occurring or an old match is no
longer correct.  However, if you simply change the body of an advice
in an aspect, there is (usually) no need to reweave as the affected
classes call the advice and the advice (by design) maintains its name
in the recompiled aspect.

If you make a change to a class (as opposed to an aspect) and save it,
we usually can get away with merely having to compile that class then
weave the existing aspects with it - rather than doing a full
recompile of the entire system.

There are a lot of possible optimizations to the algorithms we use, by
performing more complete analysis of the change made to a file that
will enable us to know more accurately whether we need to reweave and
if we do then what we need to reweave - we just haven't gotten around
to implementing them yet.

Andy.


Back to the top