[Vm-dev] goto instruction with Cog VM

Ralph Boland rpboland at gmail.com
Sat Nov 1 20:37:01 UTC 2014


I am working on a parser generator tool (a replacement for SmaCC) and
one of the things I a m interested in is the direct translation of
language specifications into the virtual machine code (SmaCC and my
current version of it use Squeak as the target language).
One of the problems I have is that, for some languages, the natural
translation
into VM code uses computed gotos.
There are two scenarios here:

     1) goto X  where X is a variable.
     2) goto  (coll at: y)  where coll is a Collection.

For example, one such language is that of regular expressions, which I wish
to translate into finite state machines implemented in VM code.
In this case I need case 2) gotos where coll is a collection of
associations, possibly a
Dictionary. I also plan to write a debugger for this (and other languages)
but that is another story.

I realize that the Cog VM is being built for Smalltalk (Squeak? Pharo?) for
which the goto instructions are not needed and thus I assume unavailable.
But there is something to
viewing a virtual machine as general purpose and thus the target of
multiple languages as is
the case for the Java virtual machine.
If the Cog VM is viewed this way then I argue there is a need for my goto
instructions
because some languages have need for them.
For example, many languages have case statements.  (I am all for object
oriented
but I would be willing to accept a case statement in Smalltalk too;  the
Squeak code
implemented one in Squeak doesn't cut it).

Anyway, I am not arguing to Change Squeak or Smalltalk but I am arguing
to have my goto instructions in Cog VM. Is there any chance of this?????

I don't know the Squeak VM or the Cog VM either but I assume these
instructions don't exist because I see no need of them when the source
language is
Squeak or any version of Smalltalk for that matter. I also assume that
there is already
a full list of 256 instructions in the Cog VM and thus no room for my goto
instructions
unless some instructions are removed.

Are there Cog VM instructions that are so rarely used that they could be
removed without
unreasonably slowing down the Cog VM interpretation of byte codes generated
from Squeak source code?????

I accept that it will always be that almost all byte codes to be
interpreted by the
Cog VM are generated from Smalltalk source.

Good luck with the Cog VM.  I look forward to seeing it used in
Squeak/Pharo.

Ralph Boland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20141101/4b92ecf9/attachment.htm


More information about the Vm-dev mailing list