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

Here's an example of the nested type the paper refers to:

void around(): somePoints() {
    Runnable r = new Runnable() {
        public void run() { return proceed(); }
    };
    new Thread(r).start();
}

This advice runs the actual computation of the around in a different thread.

Trampolining will not help us eliminate the use of a closure object here.
The goal for trampolining is to handle the much more common cases where we
are currently inlining the around advice code and allow us to not inline the
code without paying a major performance price.  Not inlining code has many
advantages that we talk about in the advice weaving paper.

-Jim

-----Original Message-----
From: aspectj-dev-admin@xxxxxxxxxxx [mailto:aspectj-dev-admin@xxxxxxxxxxx]
On Behalf Of Eric Bodden
Sent: Monday, November 17, 2003 10:17 AM
To: aspectj-dev@xxxxxxxxxxx
Subject: [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


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev