Faculty of Information Technology
Software Engineering Group

Opened 7 years ago

Last modified 6 years ago

#105 new defect

STC compiled forces result of #<, #<=, ... to be a boolean

Reported by: Jan Vrany Owned by:
Priority: major Milestone:
Component: stc Keywords:
Cc: Also affects CVS HEAD (eXept version): no


..regardless of what a message actually returns. For example, assume following code:

(self popI < 0) then:[ self goto: targetPC ]

when compiled by stc, result of self popI < 0 is always a boolean (and always false) even if #< method returns another object!

This is because STC tries to be smart and inlines fast SmallInteger comparison to avoid send in common cases. It checks for both, receiver and argument being small integers but in a bad way: the code looks like:

    (isSmallInteger(rec) && isSmallInteger(arg)) // both smallints?
        ? __intVal(rec) < __intVal(arg) // if so, do a fast compare
        : __SSEND1(rec, @symbol(<), arg)== __STX_true // if not, perform a send
) ? __STX_true : __STX_false)       

Of course, the check ==_STX_true) ? __STX_true : __STX_false should be moved to inner branch doing the fast smallint compare.

Attachments (1)

Change History (3)

comment:1 Changed 7 years ago by Jan Vrany

Milestone: 8.0.0

comment:2 Changed 6 years ago by Jan Vrany

Milestone: 8.0.0

This is not essential for 8.0.0, let's postpone it. This one is needed for DragonFly? experiment, which is...well...an experiment :-)

Note: See TracTickets for help on using tickets.