Golden

Systems & Software

<- GDSL

Core ->

Acorn

Acorn is the memory model for GDSL, it's the (current) lowest level, and it can also refer to the experimental ISA/bytecode

Acorn is the name of a character in Golden, an orphaned child. I chose that name because the other child was Pip which is more contested in the tech space. Also, because Acorns are the seeds of things so it fits both ways.

source

QCol

At its core, Acorn is really just ranges of bytes. The QCol is about as primitive as it gets, just storage, length, and capacity.

Derived from the QCol is the QString and QCellCol. Both are just forms of QCol that specialize their storage for chars and CCols respectively.

CCol

The CCol is the next step up from the QCol, it adds the concept of things. Where a QCol is just some range, a CCol has element_size and a tag that lets it become an array of things.

It also has Index and Hash, which are used by the QCellCol and as scratch space otherwise.

Live is more important, it's actually a general locking system with reader and writer locks crammed into a byte. It used to just be a flag for recycling.

Then there's gen and cachelevel, cachelevel is unused, gen is incremented on each recycle so staleness can be detected.

QCellCol

A specialization of QCol for storing CCols, this is Acorn's map when used in combination with a col.

Each CCol, or cell, uses its index to point into a Col, its hash for lookup, and its storage and tag for the key so it can be recovered for printing or collision detection.

Originally it was just linear search, but I upgraded it to be a robin hood style map.

Col

The Col is one of the two core things in Acorn, it adds labels, free list, cells, and heterogeneity.

Label is just a QString.

The free list is a g_lib (my C++ standard library) list, it is likely it will be replaced with a QCol in the future. Its purpose is to store which slots in the column have been recycled.

Cells is a QCellCol maintained by the Col, it provides a secondary lookup method other than just indexes, using keys. It's also how slots can be labeled.

Heterogeneous is a flag that marks if a Col is storing homogenous data like an int or elements with a layout like a Node (think like a struct in C).

Ptr

Ptr is the other core thing in Acorn, it plays many, many roles.

A Ptr is a 32 byte structure composed of a void pointer cache, one byte cachelevel, one byte specialization, and two bytes gen. Then five levels.

Specialization is currently just used for marking if a Ptr is dead or not, but it's open for future extension.

Gen is for tracking Ptr relevance when the slot it refers to gets recycled.

Cache is used to accelerate Ptr resolution when we know the real storage won't change. The cachelevels are:

0=no cache (full resolution)

1=sidx valid, cache is a col

2=idx valid, cache is a ColCol

3=pool valid, cache is a ColColCol

4=subunit valid, cache is a PtrColColCol

Most Ptrs are cachelevel 3, because subunits use one level of indirection so that their Ptrs can remain stable even as the count of subunits changes.

Cache can be swapped out to get Region and Zone as levels, but I haven't done that anywhere yet.