Benchmarking Smalltalk on JVM

Rémi Forax forax at univ-mlv.fr
Thu Feb 2 02:52:00 PST 2012


On 02/02/2012 04:45 AM, Mark Roos wrote:
> From Rémi
>         Anyway, you can optimize the last instructions, <= should 
> return a boolean
>        so the sequence should be:
>
>        ldc 41000000
>        aload 1
>        indy <= (ILObject;)Z
>        if_eq LABEL 1
>
> I am not sure how to handle this in a Smalltalk envrionment.  All of 
> the objects are instances of the same
> java type so <= is a method which returns an RtObject which is the 
> singular instance of true.  I have to
> compare that return to 'true' to get what the if bytecode wants.

<= should be a method that returns a boolean which is wrapped
to a RtObject by invokedynamic if the return type is an Object
but not if the return type is a boolean.

>
> <= could have been a block making type inference more interesting.

The idea is just to propagate the type you need if you can.
So
   for a = 2 <= 3, '<=' will return a RtObject but
   for if (2 <= 3),  '<=' will return a boolean because it's called in 
an if.

>
> thanks for the thoughts
>
> mark

cheers,
Rémi



More information about the mlvm-dev mailing list