Orca Implementation
Datatype System
Values are 16 bytes each (on both 32 & 64 bit systems).
Values exist on the stack and in blocks (a block is simply an array of values). See OValue in ovalue.h
Note
OValue will probably be changed to a union like the Thune UCell.
Complex values are stored in resizeable arrays. The two main storage arrays are:
- Block array
- String/Binary array
References to complex values are indices into one of the arrays.
Block Array
The block array exits in OEnv::blocks and is accessed using the orBLOCKS, orBLOCK, or orBlockPtr macros.
String Array
The string/binary array exits in OEnv::strings and is accessed using the orSTRINGS, orSTRING, or orStringPtr macros.
Garbage Collector
Complex values in the main arrays are garbage collected with a tracing mark-sweep collector.
Collection is currently only triggered when a new complex value is created but the storage array is full.
Simple values do not need to be collected. They simply go away when the block they exist in goes away.
Evaluation
Orca uses 3 stacks, the C stack, the data stack, and the call stack.
Data Stack
Function/native arguments and return values are stored here. This area is usually just called 'the stack'.
It exists in OEnv::dataStack. The top of the stack is referenced with the orRESULT macro.
Natives are passed a pointer to the top of the stack, normally called a1 (argument #1).
Call Stack
It exists in OEnv::callStack.
