[Fun][Weird][VM] Objects as compiled methods

Avi Bryant avi at beta4.com
Sat May 17 20:18:37 UTC 2003


On Sat, 17 May 2003, Andreas Raab wrote:

> > A somewhat related question I've had for a long time - why
> > is there no primitive for invoking a CompiledMethod without first
> > installing it in a method dictionary?
>
> Well, there is. At least if I understand Anthony's work on the closure
> compiler correctly. If I'm not mistaken then he uses CompiledMethods as
> representations for closures which means that he's got to have a primitive
> for invoking them somehow. So that you might be able to get away with
> wrapping a CM into a closure and just evaluate it.

Ok, so let's get that primitive and your modifications into the 3.6 VM and
start having fun.

> It really should! Then one could use this to 'jump' from one kind of
> interpreter to another where the Squeak Bytecode interpreter sends
> #run:with:in: to any non-CompiledMethod and the IDunnoWhatInterpreter sends
> #run:with:in: if it encounters a CompiledMethod.
>
> Heh, heh. I'm just starting to imagine the possibilities here and it makes
> me grin like a cheshire cat 8-)))

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.

Avi



More information about the Squeak-dev mailing list