Compiler

The compiler is implemented in Rust.

To work around Rust's restrictions on circular references, index-based data-structures are used heavily.

Standard Library

The standard library is implemented in Core itself, though some types and functions exposed in the standard library are implemented as intrinsics provided by the runtime.

Intermediate Representation

...

Runtime

The runtime is implemented in Rust.

Code Generation

Code is generated at runtime, just-in-time.

The backend is implemented specifically for Core and does not rely on the LLVM or other frameworks.

Supported architectures are AMD64 and ARM64. A backend for the RISC-V architecture (RV64G) is work-in-progress.

Garbage Collection

While the language encourages the use of immutable value types (keyword value), reference-based types (keyword class) are available and managed by precise garbage collection.

Memory Layout

Values

Numbers
integer values (64 bit)
+---------------+---------------+ | ┊ ┊ ┊ | ┊ ┊ ┊ | +---------------+---------------+ ╰───────────────┬───────────────╯ 64 bits: signed value
integer values (32 bit)
+---------------+ | ┊ ┊ ┊ | +---------------+ ╰───────┬───────╯ 32 bits: signed value
floating-point values (64 bit)
11 bits: exponent ╭──┴─╮ +---------------+---------------+ | ┊ ┊ ┊ | ┊ ┊ ┊ | +---------------+---------------+ │ ╰─────────────┬───────────╯ 1 bit: sign 52 bits: mantissa
floating-point values (32 bit)
8 bits: exponent ╭─┴─╮ +---------------+ | ┊ ┊ ┊ | +---------------+ │ ╰────────┬─╯ 1 bit: sign 23 bits: mantissa
Enums
tag-based enum values

References

There is ongoing work to reduce the size of the object headers (which contain a vtable pointer and forwarding pointer) from 16 bytes to 8 bytes.

This will decrease the size of everything reference-based – of regular class instances, array and string instances, trait-boxed instances and reference-based enum instances.

regular class instances
38 bits: forwarding pointer ╭───────┴──────────╮ +---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | instance fields ... +---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰─────┬─────╯ ╰┤ 24 bits: vtable pointer 2 bits: mark bits

array instances
38 bits: forwarding pointer 64 bits: array size ╭───────┴──────────╮╭───────────────┴───────────────╮ +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ | array elements ... +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰─────┬─────╯ ╰┤ 24 bits: vtable pointer 2 bits: mark bits

string instances
38 bits: forwarding pointer 36 bits: string size ╭───────┴──────────╮╭───────┴─────────╮ +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ | utf8 bytes ... +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰─────┬─────╯ ╰┤ ╰───────┬───────╯ 24 bits: vtable pointer 2 bits: mark bits 32 bits: hash code

trait-boxed instances
38 bits: forwarding pointer ╭───────┴──────────╮ +---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | instance ... +---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰─────┬─────╯ ╰┤ 24 bits: vtable pointer 2 bits: mark bits
Classes
regular class instances
62 bits: forwarding pointer ╭───────────────┴──────────────╮ +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | instance fields ... +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰───────────────┬───────────────╯ ╰┤ 64 bits: vtable pointer 2 bits: mark bits
array instances
62 bits: forwarding pointer 64 bits: array size ╭───────────────┴──────────────╮╭───────────────┴───────────────╮ +---------------+---------------+---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ | array elements ... +---------------+---------------+---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰───────────────┬───────────────╯ ╰┤ 64 bits: vtable pointer 2 bits: mark bits
string instances
62 bits: forwarding pointer 36 bits: string size ╭───────────────┴──────────────╮╭───────┴─────────╮ +---------------+---------------+---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ | utf8 bytes ... +---------------+---------------+---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰───────────────┬───────────────╯ ╰┤ ╰───────┬───────╯ 64 bits: vtable pointer 2 bits: mark bits 32 bits: hash code
Traits
trait-boxed instances
62 bits: forwarding pointer ╭───────────────┴──────────────╮ +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ | ┊ ┊ ┊ | ┊ ┊ ┊ | ┊ ┊ ┊ ┊ ┊ ┊ ┊ | instance ... +---------------+---------------+---------------+---------------+─ ─ ─ ─ ─ ─ ─ ─ ╰───────────────┬───────────────╯ ╰┤ 64 bits: vtable pointer 2 bits: mark bits
Enums
trait-boxed enum instances
...
reference-based enum instances
...