[abc-dev] Modifying context capture behavior

From: Eduardo S. Cordeiro <cordeiro@dcc.ufmg.br>
Date: Mon Oct 23 2006 - 19:28:55 BST

Hello there,

I've recently sent a personal "help wanted" email to Eric Bodden about
modifying the context capture behavior of abc for around advices, and he
mentioned this list as a better reference. Since then, I've been
studying the abc source-code and trying to get this done, with not much
success, and I hope that maybe someone can give me a hand with this.

When weaving around advices, the weaver creates inlined implementations
of the advice body, and captures available context to be used as
signature for these methods. However, variables can be needed for an
advice implementations for two reasons: the programmer has explicitly
captured them (via args, target and this clauses) or they're required
for the execution of the extracted join point. There might be an
interception between these sets, but abc doesn't detect this, and some
context variables are repeated on inlined advice implementation's
signatures.

While trying to fix this problem, I've been reading the source-code for
around weaving, and at this time I'm concentrating on the
AdviceApplicationInfo class. The list of context variables implicitly
needed for the shadow execution is calculated by the /findLocalsGoingIn/
method of this class, which returns a list I'll call /context/. The
variables captured by the programmer are stored in /Bind/ residues,
which, I assume (as I haven't studied the code to this level), are built
by the front-end.

Inside /AdviceApplicationInfo.doWeave/, after the call to
/findLocalsGoingIn/, if one removes from /context/ the locals that are
contained in the residue's bindings, the inlined advice's signature is
simplified correctly, and repeated context variables disappear. However,
the method's body, as one might expect, becomes corrupted, specifically
at the proceed method call, which uses uninitialized locals.

I've spent the last week trying to identify a way to fix this problem,
with no success. It seems that, in the beginning of the advice body,
context values are loaded from the first list of variables to other
frame positions, and these positions are used to load arguments for the
proceed call. However, after removing the repeated variables from
/context/, these store instructions are no longer generated. Can anyone
give me hints on relevant portions of the weaver source-code to modify
so that the advice body doesn't become corrupted by this instruction?

Thanks and best regards,
Eduardo Cordeiro
Master Student - UFMG
Received on Mon Oct 23 20:29:25 2006

This archive was generated by hypermail 2.1.8 : Tue Oct 24 2006 - 17:40:08 BST