[squeak-dev] Interesting Decompiler bug

David T. Lewis lewis at mail.msen.com
Thu Jun 20 12:16:09 UTC 2013


On Thu, Jun 20, 2013 at 01:04:00PM +0100, Frank Shearar wrote:
> On 20 June 2013 12:58, David T. Lewis <lewis at mail.msen.com> wrote:
> > On Thu, Jun 20, 2013 at 12:20:00PM +0200, Nicolas Cellier wrote:
> >> The bug is that (true ifTrue:[^true] ifFalse:[^false]) won't push any value
> >> on the stack (same as emitEffect: rather than emitValue:)
> >> The decompiler wants to find the argument of self value: ... on the stack
> >> and it's not there.
> >>
> >> So either we should forbid such construct at compile time
> >> (emit an 'un-reachable code' error when emitValue: does not emit any value)
> >
> > The original code example (before I reduced it to a trivial version)
> > was this:
> >
> >     < aNumberWithUnits
> >         (self compareUnits: aNumberWithUnits)
> >             ifTrue: [self value: (aNumberWithUnits value < self value
> >                             ifTrue: [^ true]
> >                             ifFalse: [^ false])]
> >             ifFalse: [^ Error new signal: 'Incompatible unit types.']
> >
> > This does not have the unreachable branch, and it displays the same
> > decompiler error.
> 
> The #value: send to self is unreachable because both of the inner
> #ifTrue:ifFalse: blocks force a return.
> 

D'oh! Now I see it. Thanks.

Dave



More information about the Squeak-dev mailing list