This commit is contained in:
2026-03-24 13:40:38 +00:00
parent 13f025e448
commit 966f0f9a8f
2 changed files with 136 additions and 54 deletions
-51
View File
@@ -1,54 +1,3 @@
# PR-3.5 — Implement Mark Phase (Reachability Traversal)
### Briefing
This PR introduces the mark phase of a simple mark-sweep collector. It must traverse from roots and mark reachable objects.
### Target
* Implement reachability marking from root set.
* Set mark bits on visited objects.
### Work items
* Implement a `mark()` function in the heap.
* Traverse roots using the root iterator.
* For each `HeapRef`, mark the object.
* Recursively traverse references inside objects.
* Ensure no infinite loops on cycles.
### Acceptance checklist
* [ ] Mark phase visits all reachable objects.
* [ ] Cycles are handled safely.
* [ ] Unreachable objects remain unmarked.
* [ ] `cargo test` passes.
### Tests
* Add tests:
* Reachable object stays marked.
* Unreachable object remains unmarked.
* Cyclic references do not crash.
### Junie instructions
**You MAY:**
* Implement a simple DFS or stack-based marking.
**You MUST NOT:**
* Add generational, incremental, or parallel GC.
* Change object layout.
**If unclear:**
* Ask before deciding traversal structure.
---
# PR-3.6 — Implement Sweep Phase (Reclaim Unmarked Objects)
### Briefing