pr3.3
This commit is contained in:
-100
@@ -1,103 +1,3 @@
|
||||
# PR-3.3 — Implement Basic Heap Allocator (No GC Yet)
|
||||
|
||||
### Briefing
|
||||
|
||||
We need a simple heap allocator that can store objects and return handles. This PR introduces a minimal allocator without garbage collection.
|
||||
|
||||
### Target
|
||||
|
||||
* Create a heap structure that stores objects.
|
||||
* Return `HeapRef` handles for allocated objects.
|
||||
|
||||
### Work items
|
||||
|
||||
* Implement a `Heap` struct.
|
||||
* Store objects in a vector or arena-like container.
|
||||
* Provide methods such as:
|
||||
|
||||
* `allocate_object(kind, payload)`.
|
||||
* Return a `HeapRef` handle.
|
||||
* Integrate heap into VM state.
|
||||
|
||||
### Acceptance checklist
|
||||
|
||||
* [ ] Heap exists and can allocate objects.
|
||||
* [ ] VM can hold a heap instance.
|
||||
* [ ] Allocation returns valid `HeapRef`.
|
||||
* [ ] `cargo test` passes.
|
||||
|
||||
### Tests
|
||||
|
||||
* Add a unit test allocating a few objects and verifying handles are valid.
|
||||
|
||||
### Junie instructions
|
||||
|
||||
**You MAY:**
|
||||
|
||||
* Use a simple vector-backed heap.
|
||||
* Implement minimal allocation logic.
|
||||
|
||||
**You MUST NOT:**
|
||||
|
||||
* Implement garbage collection here.
|
||||
* Add compaction or generational strategies.
|
||||
|
||||
**If unclear:**
|
||||
|
||||
* Ask before choosing allocation layout.
|
||||
|
||||
---
|
||||
|
||||
# PR-3.4 — Define GC Root Set (Stack, Frames, Globals)
|
||||
|
||||
### Briefing
|
||||
|
||||
The GC must know where roots are located. This PR defines the root set abstraction without running a full GC yet.
|
||||
|
||||
### Target
|
||||
|
||||
* Identify and enumerate all GC roots.
|
||||
* Provide a mechanism to iterate them.
|
||||
|
||||
### Work items
|
||||
|
||||
* Define a root traversal interface or helper.
|
||||
* Enumerate roots from:
|
||||
|
||||
* Value stack.
|
||||
* Call frames.
|
||||
* Globals or constant pools if applicable.
|
||||
* Provide a function like `visit_roots(visitor)`.
|
||||
|
||||
### Acceptance checklist
|
||||
|
||||
* [ ] Root set traversal exists.
|
||||
* [ ] Stack and frames are included as roots.
|
||||
* [ ] Code compiles.
|
||||
* [ ] `cargo test` passes.
|
||||
|
||||
### Tests
|
||||
|
||||
* Add a test that inserts a `HeapRef` in the stack and confirms it is visited by root traversal.
|
||||
|
||||
### Junie instructions
|
||||
|
||||
**You MAY:**
|
||||
|
||||
* Add root iteration helpers.
|
||||
* Traverse stack and frames.
|
||||
|
||||
**You MUST NOT:**
|
||||
|
||||
* Implement marking logic yet.
|
||||
* Change frame or stack architecture.
|
||||
|
||||
**If unclear:**
|
||||
|
||||
* Ask which structures must be roots.
|
||||
|
||||
---
|
||||
|
||||
# PR-3.5 — Implement Mark Phase (Reachability Traversal)
|
||||
|
||||
### Briefing
|
||||
|
||||
Reference in New Issue
Block a user