Heap management and Datum refactor #35

Closed
opened 2025-07-24 11:55:40 -07:00 by affine · 0 comments
Owner

We want a polymorphic datum type. We want one that will fit into a physical register on any machine. Even if we opt to stay stack based. The datum type does not fit in a single register on any machine. Plan to solve:

  1. Actual encapsulated data (individual vecs, ints, anything non datum) goes into Rc<RefCell<..>> in a heap manager.
    • Heap manager returns mutable references that cast immediately into Datum
    • Heap manager will return a mutable reference for a given index by cloning the rc and turning it into a ptr or ref.
    • Heap manager can alloc and return new data at any time if the VM suddenly wants new memory for a result
    • Heap manager can receive a ptr or ref, turn it back into an Rc, and then drop it. AT THIS POINT test if can drop original data as well
    • Heap manager in oncelock so it can be accessed as singleton without being allocated elsewhere
  2. Datum wrap around heap indexes.
    • Datum has a custom drop impl that tells heap manager to decrement some reference count
  3. Registers store Datum directly with copy/clone
We want a polymorphic datum type. We want one that will fit into a physical register on any machine. Even if we opt to stay stack based. The datum type does not fit in a single register on any machine. Plan to solve: 1. Actual encapsulated data (individual vecs, ints, anything non datum) goes into Rc<RefCell<..>> in a heap manager. - Heap manager returns mutable references that cast immediately into Datum - Heap manager will return a mutable reference for a given index by cloning the rc and turning it into a ptr or ref. - Heap manager can alloc and return new data at any time if the VM suddenly wants new memory for a result - Heap manager can receive a ptr or ref, turn it back into an Rc, and then drop it. AT THIS POINT test if can drop original data as well - Heap manager in oncelock so it can be accessed as singleton without being allocated elsewhere 2. Datum wrap around heap indexes. - Datum has a custom drop impl that tells heap manager to decrement some reference count 3. Registers store Datum directly with copy/clone
affine added this to the HyphaeVM Roadmap project 2025-07-24 11:55:40 -07:00
affine self-assigned this 2025-07-24 12:30:51 -07:00
affine referenced this issue from a commit 2025-07-25 23:35:03 -07:00
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: affine/Mycelium#35
No description provided.