View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

Extending the Squeak Virtual Machine

Extending the Squeak Virtual Machine, by Andrew Greenberg

Latest draft: greenberg.pdf

Promised Reviewers:
Jörn Eyrich (


From Tim Rowlege:
A quick look suggests an excellent start - particularly since you explain a few things I can now refer to instead of having to explain myself :-)
I didn't notice any explanations of quite a lot of the TestInterpreterPlugin stuff, which I hope will make it to a later draft. It's too important to leave out.
I also need to get an explanation to you of the changes made for the pluginizedVM - a couple of extra things like setInterpreter: were needed.

Very well done job, Andrew!
This is a model of how to write such a thing.


Some typos:

p.3: (picky, sorry!)
By far, the more flexible
and adaptable solution -and the primary subject of this chapter - are named,
or ?pluggable? primitives.
should be:
"is named"... or "is to use named"...

(in the MacOS, for example, by dragging plugin files
into certain folders),
might be changed to for example:
... into the VM's folder

0 to: numInstVars do: [self foo: (p at: I)]
should probably be
0 to: numInstVars do: [:i | self foo: (p at: i)]

As side effects, #fetchInteger:ofObject: will fail unless the oop
corresponds to a SmallInteger, and #fetchInteger:ofObject will fail if
the oop corresponds to a SmallInteger.
should probably be:
... and #fetchPointer:ofObject will fail ...

.. next review ..

Have not had the time read all yet. So far excellent. Well formulated and informative.
More comments later (I hope).
Mats Nygren

Mark's Review of "Extending the Squeak Virtual Machine"

As a sign of the value of this chapter, several of my students have already downloaded it and are using it in their projects. In fact, an undergrad recently asked a question on our internal "Squeakers" list which was answered with "Greenberg, p. 16." Clearly, this is an important chapter with very important content.

My concerns with the chapter are mostly in terms of structure and order of events. "Slang" doesn't get introduced until pretty late in the chapter (p. 13), and the basic idea of producing primitives through Squeak doesn't get will articulated (e.g., sending the plugin "translate") until then, yet every single example of code is matched Squeak and C equivalents. I love the idea of the equivalents, but when I first came to them I wondered, "Why am I seeing this? I thought that primitives were written in C – why do I need this Squeak code?"

My suggestion is to start the chapter just as you do – it's a nice discussion of why you might want a primitive. And then, BEFORE the anatomy of an extension, explain the process of primitives: Producing them in C and linking them in, or producing them in Slang. Then go ahead and describe the anatomy, the Smalltalk objects "shapes" issues, and so on as you do.


from Jörn Eyrich:

I used Acrobat's annotation features, which might not have been as clever an idea as I would have thought. Here is a 69K zip of the annotated pdf


from Andy

Thanks to everyone for their attentive, and often kind, remarks.

The primary issue, it seems is the cursory treatment and substantial use of the term Slang. I had originally thought that Tim's paper was going to introduce the topic, and intended to refer by citation, but that doesn't seem to be how things are happening. I would be pleased to introduce a chapter on Slang, but it will likely increase substantially the length of the paper, which is already over-budget.

Secondly, there seems to be repeated inquiries for detailing the new "testPlugin" primitive structure. Again, I'd be pleased to do so, but I would be pressing my budget for parchment real estate.

Woudl it be OK to do the slang or testPlugin segments, even if it made the paper overlong?

From Jörn: I would love to see something about slang, maybe it should even have its own chapter

TestPlugin would be nice, too, of course, but if you must choose between the two for space rasons, my vote is for slang

From Tim - sorry if I ended up not explaining Slang! I'm having to cut back quite a bit of stuff due to bad time management on my part. If you can manage to explain anything at all about writing in Slang within your time available, go for it - please!

I would like to know how does the squeak virtual machine interact with other compiler or maybe different processor(dynamic compilation) such as the FPGA

Link to this Page