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

Bert Freudenberg bert at freudenbergs.de
Wed Jan 25 15:12:15 UTC 2017


On Wed, Jan 25, 2017 at 3:53 PM, Bert Freudenberg <bert at freudenbergs.de>
wrote:

>
> What is the range of your LargeIntegers? SqueakJS does not implement most
> of prims 30-37,
>

I meant 20 - 37, the large int arithmetic prims, of course


> whereas the C VM at least does so with up to 64 bits IIRC?
> https://github.com/bertfreudenberg/SqueakJS/blob/master/vm.js#L4301
>
> 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.
>

If someone wants to give this a shot, it should work along the lines of

case 21: return this.popNandPush53BitIntIfOK(2,this.stackSigned53BitInt(1) +
this.stackSigned53BitInt(0)); // primitiveAddLargeIntegers

similar to what is already there for prims 23-28. Don't forget to extend
NonSmallInt so you can reuse vm.div / vm.mod.

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


More information about the Vm-dev mailing list