Ok, this document will describe protos, ints, blobs, atoms, slots, and their references.

References in the system were Originally 2 bit, now they are 3

  0 - PROTO - Data is a reference
  1 - INT - Data is actual int
  2 - BLOB - Data is a reference
  3 - ATOM - Data is a reference

New Entries
  4 - CODE-PROTO    - Data is a reference - Describes a proto that holds the
                      slots for arguments and locals for a method. This reference is mainly
                      checked by the PASSTHRU cnd CODE routines.
  4 - BLOCK-PROTO   - Data is a reference - Describes a block proto that holds the
                      slots for arguments and locals for a block. This reference is for
                      the push instruction so it can easily detect a block that it needs to clone
                      (which will become a CODE-PROTO).
  5 - CONTEXT-PROTO - Describes an activation record in the stack This is necessary for block protos.
                      Their variables access variables of some other protos via the stack. Therefore,
                      the Frame pointer will have to be set to that context.
                      Upon return, the frame pointer needs to be restored. So, activateSlot will just have to set
                      it different, and the previous.
  7 - FLOAT         - Data is a reference

ATOMS - Since only 21 bits are allowed in the slot keys, this limits us to about 2 million unique
strings in the system.
INT - Since there are only 29 bits for integers, and they are signed, our range is +/- 500 million.
Hopefully, that is enough.

Arrays and Floats could have special attributes in the proto to handle their special cases rather than have a reference. Could have a 'float area', for more efficient storage, but using a full proto will be fine for now.

By going to 3 bit's of data for the reference, the referenced data must be on an 8 byte boundary.
 

PROTO's are Aligned on 16 byte boundaries Their bitfields describe There is a field which describes the number of data slots in use and slots in use. Data slots are 32 bit fields. Slots are 32 bit fields.

In terms of 32 bit values, here is the structure of a proto on the heap.

0 - Malloc Header/Size - When malloc allocates a block of memory, the first 32 bit pointer, in general, is the
size parameter. It indicates how many bytes are used (with a 16 byte alignment, or chunks). We use the lower 4 bits to indicate special properties of the proto. The high bit is used for indicating a garbage collection marker.
1 - The size field - This is another field that indicates the allocation of the bytes within the proto. The lower 16 bits indicate the number of data slots and key slots. This indicates a maximum of 256 data or key slots.

Later on, we may allow the upper bits to indicate that the object is a float or an array (in smalltalk this is called an indexed type).

<NEED TO DESCRIBE THIS BETTER>

The first 21 bits are the Atom reference.
The next 3 are the Action types
Finally, the last 8 bits are for the index into the data slots of the data.

TYPES OF ACTIONS IN SLOTS 3 bit
  0 - GET
  1 - SET
  2 - GETFRAME
  3 - SETFRAME
  4 - PASSTHRU
  5 - CODE
  6 - INTRINSIC
  7 - ??