Image

The image consists of all the objects in your computer, both the ones you create and the ones Smalltalk already provides.

Because “everything is an object,” the image contains unusual objects like compiled methods. That is, whenever you write and compile a Smalltalk method, Smalltalk's compiler produces an instance of the class *CompiledMethod*. Each of these objects consists of bytecodes, which are the machine instructions that the virtual machine knows how to execute.

A running Smalltalk system therefore consists of these two pieces of software – a Virtual Machine running on your underlying computer hardware plus an image run­ning bytecodes on the virtual machine. This is really a familiar notion cloaked in a fancy name. An interpreter – a BASIC interpreter, or a Pascal p-code interpreter – is also a virtual machine. Instead of executing the bytecodes in a Smalltalk image, it exe­cutes some other language, like BASIC or p-code. Sometimes people even refer to the Smalltalk virtual machine as the Smalltalk interpreter.

The difference between Smalltalk's virtual machine and other, simpler virtual machines (or interpreters) is sophistication. The Smalltalk virtual machine does more than merely execute one bytecode after another. It also manages processing and memory resources, much as a full-blown operating system does.

By the way, one side-effect of this arrangement, or of any arrangement based on a virtual machine, is a technique for transporting applications between computer architectures. If Smalltalk runs on one computer architecture, we ought to be able to make it run on another by rewriting only the virtual machine. The image should run as well on one virtual machine as another. The industry's early learning experience with Smalltalk came about in just this fashion. Early in the 1980s, Xerox PARC released the Smalltalk-80 image, along with the specification for its virtual machine, so that any computer manufacturer could run Smalltalk-80 on their own hardware, merely by writing a virtual machine. In those days a basic virtual machine implementation could be built in about one programmer-year.

~