Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Around advice: Superflous methods in generated code?

Around advice is always compiled into the two methods you've observed.  One
method includes the body of the around and the other method is a stub for
the proceed call.  These methods are essential to the implementation of
around.  Even when the around body is inlined, the weaver finds the code to
inline from the corresponding method.  If that method was removed then the
weaver wouldn't know what code to use for the around's body.

It's possible that these methods could be removed after weaving; however,
that would break our important property of separate compilation.  This means
that you can compile an aspect to a .class file, and then weave that .class
file against as much code as you want and the .class file won't change.  If
we removed these methods that wouldn't be possible.  Finally, the whole
closure support needs to be there in case somebody uses the -XnoInline flag
to force the use of closures for all around advice.

-Jim

-----Original Message-----
From: aspectj-dev-admin@xxxxxxxxxxx [mailto:aspectj-dev-admin@xxxxxxxxxxx]
On Behalf Of Eric Bodden
Sent: Thursday, November 20, 2003 7:20 AM
To: aspectj-dev@xxxxxxxxxxx
Subject: [aspectj-dev] Around advice: Superflous methods in generated code?

Hi!

During my bytecode investigations I found something that I assume to be a
bug (though not a severe one). If you have a look at the attached file, you
can see that all the code of the around advice is inlined, as it should be,
so no Closure is needed at all.
Though in the aspect class, there are two methods generated, namely
ajc$around$AroundFoo$86 and ajc$around$AroundFoo$86proceed that (I assume)
are the closure-counterpart of the parts. These two methods are never called
and should be eliminated.

That raises a second question: Probably the AJ compiler should use an
algorith for dead code elimination in general.

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




Back to the top