Re: [abc-dev] About the thisJoinPoint optimization in abc compiler

From: Julian Tibble <>
Date: Fri Mar 24 2006 - 00:27:39 GMT

Hi Isaac,

Sorry for the delayed response - we (the abc team) are almost all
currently at the AOSD conference in Bonn.

> 1) subsitute thisJoinPoint with thisStaticJoinPoint as much as possible

This is couple of passes in the frontend. Roughly speaking it inspects all
the instances of thisJoinPoint, decides if all of them are safe to rewrite
(pass ASPECT_REFLECTION_INSPECT), and then does the rewrite if valid (pass
ASPECT_REFLECTION_REWRITE). "safe to rewrite" means that thisJoinPoint is
used in the form thisJoinPoint.someMethod(), where someMethod is one that
would be available for thisJoinPointStaticPart too.

The code is scattered around a bit, between the classes in
abc.aspectj.visit and the relevant tree nodes in abc.aspectj.ast.

> 2) delay the initialization of thisJoinPoint. However, it is pretty
> hard to know how both techniques work by just looking at the source
> code.

thisJoinPoint is the same object for all advice at a joinpoint. At each
shadow where it will be needed (or perhaps all shadows we weave at, I
forget), we create a new local, call it thisJoinPoint$n, to hold the
object. It is initialised to null.

Then before each piece of advice that needs thisJoinPoint, we check
whether thisJoinPoint$n is null, and if it is we instantiate it with the
actual object.

This guarantees that we never construct the object unless it is needed,
and that we only construct it at most once.

However, all these null checks and indeed the null instantiation itself
might not be necessary, so we try to remove them where possible:

> The 'abc' paper also mentions about a NullAnalysis for detecting the
> call to thisJoinPoint object. Where can I find the exact location of
> this analysis?

Sorry, this is a little hard to find :) It's in abc.main.AbcExtension,
in the addJimplePacks() method. All the code does is instantiate the
standard soot null-check analysis, overriding one method so that the
analysis "knows" that the "makeJP" methods never return null.

> Also, I was trying to locate, albeit unsuccessfully, the location where
> the boxing of the primitive value of the return value and the parameters
> of the join point. Can you please give me a direction where I can find
> it?

I think what you're looking for is in abc.weaving.residues.Box - which is
constructed in abc.weaving.residues.Bind

Residues are what's left over when you've matched as much of a pointcut
as you can statically - i.e. any necessary dynamic tests to determine
whether or not a particular pointcut matches, and things like Bind which
generates code to bind context values (the values available at a joinpoint)
to advice formals.

Hope this helps, feel free to ask lots more questions.

Julian and Ganesh
 on behalf of the abc team
Received on Fri Mar 24 00:27:41 2006

This archive was generated by hypermail 2.1.8 : Thu Mar 30 2006 - 01:40:05 BST