Commit graph

4 commits

Author SHA1 Message Date
2392d5c2fa Finish garbage collected heap
This commit adds unit tests for garbage collection as well as a
deep copy implementation for cons which fully deep copies the whole
tree and a clone implementation for Datum which deep copies cons.

Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-07-28 23:02:06 +00:00
524f79733c HyphaeVM Cons instruction prototype
All checks were successful
per-push tests / build (push) Successful in 49s
per-push tests / test-frontend (push) Successful in 33s
per-push tests / test-utility (push) Successful in 35s
per-push tests / test-backend (push) Successful in 29s
per-push tests / timed-decomposer-parse (push) Successful in 34s
This commit implements the Cons instruction with desired behavior.
Tests are yet to be implemented for any instruction, but are coming
soon.

Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-07-27 07:18:14 +00:00
cf626b2bfc HyphaeVM Garbage Collection
All checks were successful
per-push tests / build (push) Successful in 36s
per-push tests / test-utility (push) Successful in 36s
per-push tests / test-frontend (push) Successful in 37s
per-push tests / test-backend (push) Successful in 31s
per-push tests / timed-decomposer-parse (push) Successful in 34s
This commit removes the dependency upon Mycelium::sexpr::Datum from Hyphae
and instead adds a heap.rs module including three types:

- Gc: This is essentially a Box<Rc<T>> but passed around as a *const Rc<T>.
    not only does this allow the wrapped T to be passed around in a format
    that fits completely within a single physical register, this also
    applies a greedy reference counting garbage collection to each and
    every object allocated in the VM.

- Datum: This is a simplified enum for type polymorphism. Similar to the
    original Mycelium::sexpr::Datum.

- Cons: This is a very standard Cons cell type.

Additionally, two new instructions are added:
- DUPL: a deep copy instruction
- CONST: an instruction to create number datum from embedded constants
- NTOI: casts a number to its inexact form
- NTOE: casts a number to its exact form

Fixes: #35 and #36

Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-07-25 22:27:51 -07:00
8d2d0ebf0c Clean up project structure
All checks were successful
per-push tests / build (push) Successful in 32s
per-push tests / test-utility (push) Successful in 32s
per-push tests / test-frontend (push) Successful in 34s
per-push tests / test-backend (push) Successful in 30s
per-push tests / timed-decomposer-parse (push) Successful in 26s
The number package is moved into its own package henceforth referred
to as "organelle". Hyphae and Mycelium are updated accordingly. In
addition, Hyphae gets a copy of the sexpr module of Mycelium. This
will not remain a copy, rather it will be the basis of a heap manager
module within Mycelium to be worked on in the future.

Fixes #32

Signed-off-by: Ava Affine <ava@sunnypup.io>
2025-07-24 19:44:43 +00:00