[Vm-dev] primitives argument handling

Bert Freudenberg bert at freudenbergs.de
Sat Aug 20 17:15:29 UTC 2016

Each primitive is supposed to check the number of arguments it is called
with. If the number is not what it expects, it must fail, and leave the
stack untouched (so that the primitive method can run the failure code).

The same primitive can also handle different numbers of arguments, e.g.

SystemNavigation default browseAllSelect: [:cm | cm primitive = 254]

- Bert -

On Sat, Aug 20, 2016 at 3:41 PM, Ben Coman <btc at openinworld.com> wrote:

> Just checking my understanding of how something works.  I think I
> heard somewhere that its the primitive's job to drop its arguments off
> the stack.
> So it would seem(??) that starting with VM1/Image1 having primitive
> #primX ... if VM2 had modified that primitive to take an optional
> argument such that Image2 invoked that primitive as #primX: ,  then
> Image2 could not be backward compatible with VM, because Image2 would
> be adding the argument to the stack that would not be removed by VM1.
> The reason I ask is I was considering having a go at the VM clock
> improvements issue [1] I logged.  As well as implementing the clock
> skewing algorithm Eliot suggested, I was also wanting to provide Image
> access to the two clocks used by that algorithm - so the algorithm
> performance could be monitored from the Image.
> cheers -ben
> [1] https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/36
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160820/effce74c/attachment.htm

More information about the Vm-dev mailing list