[abc-dev] [technical detail] Strange interactions in ShadowPointsSetter

From: Wouter De Borger <w.deborger_at_gmail.com>
Date: Wed, 29 Oct 2008 12:14:39 +0100

Hi,

As you may already know, I'm working on debugging support for AOP.
I use the ABC for that and I have found a rather strange feature interaction
in ShadowPointsSetter

when applying an execution joinpoint on a method like

private String method1(){
    return "normal method 1";
}

the joinpoint should contain at least

$X = "normal method 1";

When using before or after advice however, the joinpoint is empty,

$X = "normal method 1";
nop //begin joinpoint
nop //end joinpoint
return $X

When using around advice the joinpoint is

nop //begin joinpoint
$r0 = "normal method 1"
$r1 = $r0
$r0 = $r1
nop
nop //end joinpoint
return $r0;

In normal operation, this is not a problem, but if one wants to tag
joinpoint shadows, this is very unpleasant

The behavior is caused by the ShadowPointsSetter.restructureBody

in non around advices, the jimple going in is:

return "normal method 1"

then the begin is marked

nop //begin joinpoint
return "normal method 1"

then the Restructure.restructureReturn is called, it takes the nop before
return as it's end nop and extracts the constant and places it before the
end nop

$X = "normal method 1";
nop //begin joinpoint
return $X

then restructureBody places its end nop before return

$X = "normal method 1";
nop //begin joinpoint
nop //end joinpoint
return $X

When arround advice is matching, Restructure.restructureReturn is called
before the ShadowPointsSetter.restructureBody is called

the solution for this problem is first searching the end of the joinpoint
and then the beginning

Wouter

PS: my work on the eclipse plugin has come to a grinding halt, I'm currently
working on my AO debugger
Received on Wed Oct 29 2008 - 11:14:42 GMT

This archive was generated by hypermail 2.2.0 : Wed Oct 29 2008 - 18:20:12 GMT