[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: DeadAssignmentEliminator



On Mon, 25 Jun 2001, Stephen Andrew Neuendorffer wrote:

> OK, I'm being slow today...
> if(!method.isStatic() &&
> 	((InstanceFieldRef)rhs).getBase() == body.getThisLocal()) {
> 	isEssential = false;
> }

This looks correct.  I'll commit this change; until then, you can use it
in your local copy of Soot.  

I just checked that this is a final variable for javac, so it can't be
changed in java code.  On the other hand, in the VM you can assign to
'local variable 0', which is 'this'.  Fortunately, this can't happen in
Jimple; some splitting phase gives the following bizarre code:

    int g()
    {
        EasyTest r0;
        null_type $n0;
        int $i0, $i1;

        r0 := @this: EasyTest;
        $n0 = null;
        $i0 = $n0.<EasyTest: int a>;
        $i1 = $i0 + 1;
        return $i1;
    }

I'm not sure that this is guaranteed to happen, and I'm not sure what java
bytecode this would compile to, but assuming that ThisRef is final seems
like a good bet.

pat