[Fun][Weird][VM] Objects as compiled methods
Marcus Denker
marcus at ira.uka.de
Sun May 18 09:39:21 UTC 2003
On Sat, May 17, 2003 at 01:18:37PM -0700, Avi Bryant wrote:
>
> Yup :). Incidentally, does anyone know of prior art for doing that kind
> of jumping from VM to meta-interpreter and back, in Smalltalk or other
> similar (OO, bytecode) systems? There's a company doing exactly that to
> enable call/cc in Java, and I'm curious if their patent application has
> any validity.
>
I did some experiments with smalltalk/x in this direction (playing with
implementing an interpreter for Smalltalk in Smalltalk)
If I remember correctly, this worked somewhat like this:
In Smalltalk/X the vm sends "cannotInterpret" to the CompiledMethod
if there are no Bytecodes in the compiledMethod.
CompiledMethods are real Objects in SmalltalkX, the bytecodes are stored
in a ByteArray which is referenced in a instVar of the CompiledMethod.
And so you can simply make a subclass that has an aditional instVar for
your new set of bytecodes, "cannotInterpret" then would call the
interpreter for these bytecodes...
Marcus
--
Marcus Denker marcus at ira.uka.de -- Squeak! http://squeak.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030518/ef24e96f/attachment.pgp
More information about the Squeak-dev
mailing list
|