Constructor call shadow matches - was: [abc] normal tests (+9f,-9p)

From: Eric Bodden <eric.bodden@mail.mcgill.ca>
Date: Wed Jul 11 2007 - 03:53:54 BST

This was introduced by the following change.

Assume the following constructor call in Jimple:

//1
x = new X();
staticinvoke x.<X:init>();
//2

In the current implementation of ConstructorCallShadowMatch, the
shadow starts at 1 and ends at 2. This leads into a subtle problem
with alias analysis in the presence of with after/after-throwing
advice, because we weave as follows:

==================

x=null;

label0:
 x = new O;
 x.<init>();
 goto label2;

label1:
//after throwing advice
//rethrow exception

label2:
...
trap: from label0 to label1 with label1

==================

The problem now arises at label 2: Because the trap starts *before*
the new-statement, Soot assumes that it could be the case that we
reach label 2 without having executed "x = new O;". Hence, our
must-alias analysis returns "UNKNOWN" for x at this location. However,
actually a new-statement can never fail (except probably with an
OutOfMemoryError in which the program will crash anyway?), so x is
always going to be non-null at label2. Hence I thought it might be
sound to have the shadow (and hence the trap) begin *after* the
new-statement. However, that seems to break certain assumptions during
weaving (or at execution time?).

Does anybody see a good solution to this? In general I find that it's
an interesting question what state a (bound) target object should be
in if its constructor threw an advice, anyway.

Cheers,
Eric

P.S. I reverted the change for now.

On 10/07/07, Ganesh Sittampalam <ganesh@earth.li> wrote:
> Pass: 981 (down 9)
> Fail: 27 (up 9)
> Skipped: 105 (no change)
>
> Lost:
> 1205: abctests/bugs - Preinit weaving problem
> 1206: abctests/bugs - Preinit weaving problem (test 2)
> 347: new - advice on implied empty constructor
> 363: new - , PR#249, PR#250 advice on constructor sites
> 526: new - cflow alone with around produces compiler bcg StackOverflowError
> 582: new - subclass advice not run for join points selected by superclass cflow-based pointcuts
> 762: new - can't apply around advice to the execution of around advice
> 782: bugs - Internal compiler error with thisJoinPoint.getStaticPart()
> 78401: abctests/bugs/messyAround - Ajc 1.1 rc1 java.lang.VerifyError with messy arounds - fixed
>
> Gained:
>
>

-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
Received on Wed Jul 11 03:54:01 2007

This archive was generated by hypermail 2.1.8 : Wed Jul 11 2007 - 11:30:09 BST