[Vm-dev] goto instruction with Cog VM

Eliot Miranda eliot.miranda at gmail.com
Mon Nov 3 21:54:53 UTC 2014


On Mon, Nov 3, 2014 at 1:11 PM, Colin Putney <colin at wiresong.com> wrote:

>
>
>
> On Mon, Nov 3, 2014 at 11:34 AM, Eliot Miranda <eliot.miranda at gmail.com>
> wrote:
>
>
>> If the bytecode is one that takes an integer on top of stack, and an
>> Array literal containing bytecode pcs, falling through on out of range,
>> then nothing other than the index need be pushed on top of stack.  That
>> would be my preference.
>>
>
> I think Levante's suggestion for jumpToTop was just to take the pc from
> the top of the stack, with no indirection through an Array literal. Then
> jumping to a pc in an array would be
>
> - push the array
> - push the index of the pc you want
> - send #at:
> - jumpToTop
>

Right, and that doesn't play well with the JIT because conversion would be
required and that's slow.  If one goes with teh explicit jump table in an
Array literal
a) compilation is likely easier because one doesn't have to know the pc
when generating the switch code
b) it plays well with teh JIT since the jit can convert the bytecode pcs to
machine code pcs at compile-time, not run-time.

In any case one can play the stack top game as an experiment using
thisContext pc:, no need for a bytecode.  But the bytecode should use the
literal approach for the reasons stated.

-Colin
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20141103/0adc7a49/attachment.htm


More information about the Vm-dev mailing list