links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Virtual Machine (Overview)
Last updated at 10:20 pm UTC on 21 June 2020
The virtual machine (VM) is an executable program you need to run the Squeak .image file.

Different types of Virtual Machines

Experimental Virtual Machines

Currently, the VM executables share the same name but are not backward compatible for images. Each image type needs a matching VM. The utility ckformat prints the image format code for a given image. On Linux ports, VM run utility script, uses this utility to launch a compatible VM.

History of the Squeak Virtual Machine

(Source : http://fast.org.ar/uploads/2016/11/Friday_16h00_Eliot_Miranda_Cog_in_Motion.pdf )

A two decade history of Squeak VM is described in this paper [1]

The first Squeak VM Object Engine, as described in the Back To The Future paper [2], was simply called the Squeak VM and is now known as Context Interpreter or V3 Interpreter. Its bytecode set very close to the blue book [3]. This virtual machine allocated objects, including Contexts, from a single linear heap wtih a slow pointer reversal garbage collect. Context objects from the heap for each non-primitive send. Its blocks were non-reentrant blocks and the object memory was a single linear heap with a slow pointer-reversal GC. As images grew larger, the performance suffered [4]. We now use the name V3 to refer to its bytecode set and object representation. This source code was maintained in squeakvm.org and used SVN for version control.

Around 2008, Andreas Raab and Eliot Miranda, started working on speeding up this virtual machine under a new initiative known as Open Smalltalk. The source code moved to Github for version control. The VM was used not just for Squeak but also for other projects like Cuis, Pharo and Newspeak.

Open Smalltalk improved upon Squeak V3 VM in two stages. In V3 VM, Context objects were one of the most frequently allocated, but extremely short-lived objects. In the first stage, the original Deutsch & Schiffman [5] lazy context creation scheme was modified to eliminate context overheads by allocating them from the stack. New bytecodes werre added (V3PlusClosures or Stack bytecode set) to improve context-to-stack mapping and support re-entrant blocks [6]. This version came to be known as StackInterpreter and given the triplet, squeak.stack.v3 in source code. The image format code also changed. Squeak 3.10 shipped image files in both V3 (6502) and stack (6504) formats but subsequent releases shipped in 6504 format only.

In the next stage, a JIT (Just-in-Time) compiler (Cog) was integrated into the Interpreter (CoInterpreter) retaining the same V3PlusClosures bytecode set and object representation [7][8]. A new tweak for floating point was introduced under a new image format (6505). It was given the triplet, squeak.cog.v3. The StackInterpreter VMs continued to be used for platforms like iPhone where JIT-ing is forbidden for non-Apple applications. Cog VM was introduced in Squeak 4.x series under two image formats (6504 and 6505).

Around 2012/13, the object memory manager was redesigned with a better garbage collector and object representation. It introduced comprehensive support for 64-bit words and replaced the single heap with a segmented heap that could grow and shrink, support for pinning and read-only objects and a much faster become: primitive. An incremental compactor was also added. This design was known as Spur with both 32-bit and 64-bit image variants under the triplet code, squeak.cog.spur. Spur takes only 60% of the time that Cog took to interpret bytecodes. Squeak 5.x series used this VM to run both 32-bit (6521) and 64-bit (68021) image formats.

Currently, work is in progress on an adaptive optimizer to further improve performance. This has two parts - one in the VM and the other in the image. The optimizer in the VM is called Sista (Speculative Inlining Smalltalk Architecture) [14] and image-level optimizer is called Scorch [13]. Sista was the topic of Clément Bera’s PhD [15]. This is tagged with the triplet squeak.sista.spur.


  1. Two Decades of Smalltalk VM Development: Live VM Development Through Simulation Tools, https://doi.acm.org/10.1145/3281287.3281295
  2. Back to The Future: The Story of Squeak, A Practical Smalltalk Written in Itself, https://doi.org/10.1145/263698.263754
  3. Part 4 of Smalltalk-80 - The Language and its Implementation, http://stephane.ducasse.free.fr/FreeBooks/BlueBook/Bluebook.pdf
  4. http://www.mirandabanda.org/cogblog/2008/06/07/closures-part-i/
  5. Efficient implementation of the smalltalk-80 system, https://doi.org/10.1145/800017.800542
  6. http://www.mirandabanda.org/cogblog/2009/01/14/under-cover-contexts-and-the-big-frame-up/
  7. http://www.mirandabanda.org/cogblog/2011/03/01/build-me-a-jit-as-fast-as-you-can/
  8. http://www.mirandabanda.org/cogblog/2011/03/04/an-arranged-marriage/
  9. http://www.mirandabanda.org/cogblog/2013/09/05/a-spur-gear-for-cog/
  10. http://www.mirandabanda.org/cogblog/2013/09/13/lazy-become-and-a-partial-read-barrier/
  11. http://www.mirandabanda.org/cogblog/2014/02/08/primitives-and-the-partial-read-barrier/
  12. Lazy Pointer Update for Low Heap compaction Pause Times, https://doi.org/10.1145/3359619.3359741
  13. Sista: Saving Optimized Code in Snapshots for Fast Start-Up, https://doi.acm.org/10.1145/3132190.3132201
  14. http://forum.world.st/how-can-I-build-a-sista-spur-64-vm-tt5113715.html#a5113828
  15. Sista: a Metacircular Architecture for Runtime Optimisation Persistence, https://hal.inria.fr/tel-01634137/file/FinalThesis.pdf