Design of Primordial Soup

Primordial Soup (or psoup) is an implementation of the Newspeak programming language. It consists of a virtual machine and platform modules written against the primitives the VM provides.

A Newspeak program defines a graph of objects that evolves over time as a result of message sends. The virtual machine runs snapshots, which are the serialized form of the platform object and an application object. The VM starts by deserializing a snapshot into a heap, then interprets bytecode from an initial message until it encounters an exit primitive. This repository includes a snapshot for a compiler that takes Newspeak source code and produces application snapshots that can be run by the VM. The major components of the virtual machine are an object memory, an interpreter and a set of primitives. The object memory defines the representation of objects in memory, and manages their allocation and garbage collection. The interpreter executes bytecode methods produced by the compiler. It implements operations on the expression stack, message sends and returns. Some methods have a corresponding primitive, which runs in place of the method body. Primitives implement operations that cannot be expressed by the language as a regular method body, such as arithmetic, array access, string operations, become, allInstances, isolate messaging, etc. Together, these components direct the evolution of a program's objects over time. (It is essential for the object-capability model that code outside of the platform implementation cannot mark its methods as primitive, otherwise the set of primitives would constitute ambient authority. Currently the compiler marks methods as primitive based metadata in their bodies, providing an ambient authority.)

## Object Representation The object representation is based on that of the Dart VM . Object pointers refer either to immediate objects or heap objects, as distinguished by a tag in the low bits of the pointer. Primordial Soup has only one kind of immediate object, SmallIntegers, whose pointers have a tag of 0. Heap objects have a pointer tag of 1. The upper bits of a SmallInteger pointer are its value, and the upper bits of a heap object pointer are the most signficant bits of its address (the least significant bit is always 0 because heap objects always have greater than 2-byte alignment).