[Vm-dev] goto instruction with Cog VM

Levente Uzonyi leves at elte.hu
Sat Nov 1 21:57:04 UTC 2014


On Sat, 1 Nov 2014, Ralph Boland wrote:

(No quote, sorry)

The current Squeak bytecode set contains various jump intructions, which 
are variants of goto, but none of them are dynamic.
The sole instruction you'd need is a modified jumpTo: which jumps to the 
value found on the top of the stack instead of a value encoded in the 
bytecode. Let's call it jumpToTop.
With this new instruction you could compile goto X to a variable push and 
jumpToTop. It would also cover your other variant - goto (coll at: y) - by 
pushing coll and y, sending #at:, and finally jumpToTop.
You can create a custom VM with a new bytecode set (one which includes 
jumpToTop), the same way the NewSpeak VM is built.

Levente


More information about the Vm-dev mailing list