The Ita Runtime Library
The runtime library provides services for the programming language. Unlike many
other high level languages, the runtime for the Ita programming language was
written in the language itself.
Allocator/Garbage Collector
Memory allocation is currently performed using a simple bump pointer allocator.
Since the programming language is garbage collected, it was necessary to implement
a garbage collector. The garbage collector is a very simple semispace collector
implementing Cheney's algorithm.
Several choices were made when designing the computer's ISA and language
implementation that makes GC quite simple. For example, stack frames and the
code for functions are actually heap allocated objects with proper meta information.
That means that compiled code can hold direct references to garbage collected
objects. It also means that the GC doesn't need special code to walk stack
frames to find/update references. Stack frames are treated the same way as any
other heap allocated object in the system.
The fact that address instructions can be directly interpreted as references
(i.e. there is no need to mask away any bits or offset the value) makes referencing
GC'ed objects from compiled code trivial.
Multiply/Divide
Almost any recent processor has built-in multiply and divide instructions.
However this is not the case for the Ita CPU. This means that multiply and
divide must be implemented in software like many 8bit computer systems.
Multiply and divide are written in the Ita programming language essentially
like any other funtion would be. The function implementations must obviously
avoid using the multiply/divide operation to avoid infinite recursion. The
compiler inserts calls to these functions whenever a multiply or divide must be
performed.
Built-in Types
Several types are provided in the runtime library because they are required
by the compiler or required to write most programs in the language.
Here are some types that are included in the runtime system:
- Type
- void
- Object
- Integer
- String
The runtime library also provides definitions of some types that are
instantiated by the compiler directly. For example, there is a
StackFrame type that describes
the memory layout that is common to all stack frame's.
|