[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Weaving of around: Inlining or closure?

Hi!

Today I had a look at the implementation of the weaving of the around advice
to have a closer look at some optimization, that Erik suggested
(trampolining). My problem is that I could not exactly figure out _when_ an
around is inlined and when the closure is used.

I did have a look at the paper about AJ weaving, however the following
paragraph confused me rather than it clarified the situation:

"If there was a proceed call in a nested type the weaver must
assume that the call to proceed is closed over. Therefore we
need to create a closure object for the proceed call. We create a
new subclass of AroundClosure whose run method dispatches to
the new shadow method. In place of the shadow is left code that
instantiates an instance of the new subclass and passes that
instance to the around advice (in addition to any state the around
advice requires)."

So if I understand correctly the "shadow" is the raw method body that would
have been executed without around advice, right?
But what nested type is referred to?
Is it a nested type of the aspect or of the class that is woven into?
And why does a nested type yield the necessity of a closure object at all?

Thank you very much in advance,
Eric

------------------------------------------------------------
Eric Bodden
Aachen University of Technology (RWTH)
ICQ UIN: 12656220
Website: http://www.bodden.de
PGP key: http://www.bodden.de/pub_key.asc