[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how should Chain.iterator(n,n-1) work?
John Jorgensen <jorgnsn@lcd.uregina.ca> wrote:
> Good point. As you go on to say in a subsequent message,
> getBeginUnit() == getEndUnit() when there are no longer any
> trapped units at all.
>
> I have re-revised the documentation to make that explicit, though
> in the process I have boldly specified as a fact something that
> perhaps "ain't necessarily so". That is, I say that when a Trap
> no longer traps any units, it will be the case that
>
> getBeginUnit() == getEndUnit() == some_untrapped_unit
I see, so this strange case is really a consequence of PatchingChain
not knowing what to do after a given optimization, and not really
desired behaviour -- unless perhaps if new units need to be
subsequently added to the empty trapped zone (e.g. if swapping out the
last trapped Unit for a new one).
Ideally when there is no beginUnit, I imagine that
getBeginUnit()/getEndUnit() should really return
"NoSuchElementException", or if following the usual Soot conventions
simply "null".
Maybe this is something Trap itself could be hacked to do if it finds
getBeginUnit() == getEndUnit()? It's ugly but at least
getBeginUnit()/getEndUnit() won't have to return a meaningless result
and PatchingChain doesn't have to be any wiser.
Cheers,
Navin.