[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: DeadAssignmentEliminator
public class correlator1
extends TypedAtomicActor
{
public TypedIOPort input1 = null;
public TypedIOPort input2 = null;
public boolean prefire() {
TypedIOPort typedioport = input1;
typedioport = input2;
boolean bool = super.prefire();
return bool;
}
}
This comes about because the original code:
public boolean prefire() throws IllegalActionException {
if (!input1.hasToken(0)) return false;
if (!input2.hasToken(0)) return false;
return super.prefire();
}
was processed with the assertion that the hasToken method returns true.
The method invocation, and the If statement are removed automatically,
but the field reference remains. However, the field reference is pointless
because this is obviously not null (since we invoked the method in the first
place).
Steve
> -----Original Message-----
> From: fdesch1@po-box.mcgill.ca [mailto:fdesch1@po-box.mcgill.ca]On
> Behalf Of Fabien Deschodt
> Sent: Monday, June 25, 2001 4:58 PM
> To: Stephen Andrew Neuendorffer
> Subject: Re: DeadAssignmentEliminator
>
>
> Hi,
>
> > However, this seems rather conservative. Specifically, I end
> up with alot
> > of assignments
> > from field this.foo that are dead.
> Can you show us a piece of code where you end up with a lot of those
> dead assignments?
>
> Fabien
>
> --
> ---- Fabien Deschodt Sable Research Group
> ------ fabien@deschodt.net http://www.sable.mcgill.ca
> ---- http://www.deschodt.net
> --
>