[Vm-dev] SqueakJS named primitives in the interpreter modulej

Bert Freudenberg bert at freudenbergs.de
Wed Jan 25 14:53:16 UTC 2017

On Wed, Jan 25, 2017 at 4:11 AM, David T. Lewis <lewis at mail.msen.com> wrote:

> Sorry to reply to my own post, but I need to retract this. The profiler
> shows that a big portion of the time is spent in
>     LargePositiveInteger(Integer)>>digitDiv:neg:
> I mistakenly assumed that primDigitDevNegative was not implemented for
> the LargeIntegers module, but that is wrong, I see now that function
> primDigitDivNegative() is implemented in the translated plugins. So maybe
> it is not an efficient implementation when translated to JavaScript?

It certainly is not efficient, and I did not yet try to improve its
efficiency, but it is faster than the fallback code:


What is the range of your LargeIntegers? SqueakJS does not implement most
of prims 30-37, whereas the C VM at least does so with up to 64 bits IIRC?

This is just laziness on my part (since the fallback + plugin works),
there's no good reason not to implement a fast path for these if the
numbers fall within the 53 bit range JS can handle directly. We do have the
code for 31 bit SmallInts, so this should be relatively simple.

These prims could even be made to handle arbitrary-sized large ints (in
which case the plugin wouldn't even be needed, and it would likely be much
faster) but getting the semantics exactly right is not trivial.

- Bert -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170125/a4804e83/attachment.html>

More information about the Vm-dev mailing list