[Vm-dev] VM Maker: VMMaker.oscog-nice.1988.mcz

Eliot Miranda eliot.miranda at gmail.com
Mon Nov 14 22:50:07 UTC 2016


Hi Nicolas,

   just a couple of niggles...

On Sun, Nov 13, 2016 at 1:27 AM, <commits at source.squeak.org> wrote:

>
> Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-nice.1988.mcz
>
> ==================== Summary ====================
>
> ...

> Item was changed:
>   ----- Method: Spur32BitMemoryManager>>integerValueOf: (in category
> 'immediates') -----
>   integerValueOf: oop
>         "Translator produces 'oop >> 1'"
> +       ^(oop >> 31) = 1 "tests top bit"
> -       ^(oop bitShift: -31) = 1 "tests top bit"
>                 ifTrue: "negative"
> +                       [((oop >> 1) bitAnd: 16r3FFFFFFF) - 16r3FFFFFFF -
> 1  "Faster than -16r40000000 (a LgInt)"]
> -                       [((oop bitShift: -1) bitAnd: 16r3FFFFFFF) -
> 16r3FFFFFFF - 1  "Faster than -16r40000000 (a LgInt)"]
>                 ifFalse: "positive"
> +                       [oop >> 1]!
> -                       [oop bitShift: -1]!
>
> Item was changed:
>   ----- Method: Spur64BitMemoryManager>>integerValueOf: (in category
> 'immediates') -----
>   integerValueOf: oop
>         "Translator produces 'oop >> 3'"
> +       ^(oop >> 63) = 1 "tests top bit"
> -       ^(oop bitShift: -63) = 1 "tests top bit"
>                 ifTrue: "negative"
> +                       [((oop >> self numTagBits) bitAnd:
> 16r1FFFFFFFFFFFFFFF) - 16r1FFFFFFFFFFFFFFF - 1  "Faster than
> -16r4000000000000000 (a LgInt)"]
> -                       [((oop bitShift: self numTagBits negated) bitAnd:
> 16r1FFFFFFFFFFFFFFF) - 16r1FFFFFFFFFFFFFFF - 1  "Faster than
> -16r4000000000000000 (a LgInt)"]
>                 ifFalse: "positive"
> +                       [oop >> self numTagBits]!
> -                       [oop bitShift: self numTagBits negated]!
>

These two methods above are simulation-only.  The CCodeGenerator generates
 'oop >> 1' for them.  You've replaced the bitShift:'s (which are correct)
by >>'s and <<'s (which are also correct) which are slower.  I'm going to
revert these changes.  If you have a good reason for using the slower form
please explain.

_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20161114/6f50b437/attachment.html>


More information about the Vm-dev mailing list