diff --git a/crates/console/prometeu-bytecode/src/program_image.rs b/crates/console/prometeu-bytecode/src/program_image.rs index d40394db..9dcca171 100644 --- a/crates/console/prometeu-bytecode/src/program_image.rs +++ b/crates/console/prometeu-bytecode/src/program_image.rs @@ -102,7 +102,7 @@ impl From for BytecodeModule { Value::String(v) => ConstantPoolEntry::String(v.clone()), Value::Int32(v) => ConstantPoolEntry::Int32(*v), Value::Bounded(v) => ConstantPoolEntry::Int32(*v as i32), - Value::Gate(_) => ConstantPoolEntry::Null, + Value::Handle(_) => ConstantPoolEntry::Null, }) .collect(); diff --git a/crates/console/prometeu-bytecode/src/value.rs b/crates/console/prometeu-bytecode/src/value.rs index 7604e678..a1a26e09 100644 --- a/crates/console/prometeu-bytecode/src/value.rs +++ b/crates/console/prometeu-bytecode/src/value.rs @@ -23,7 +23,7 @@ pub enum Value { /// Bounded 16-bit-ish integer. Bounded(u32), /// A pointer to an object on the heap. - Gate(usize), + Handle(usize), /// Represents the absence of a value (equivalent to `null` or `undefined`). Null, } @@ -43,7 +43,7 @@ impl PartialEq for Value { (Value::Boolean(a), Value::Boolean(b)) => a == b, (Value::String(a), Value::String(b)) => a == b, (Value::Bounded(a), Value::Bounded(b)) => a == b, - (Value::Gate(a), Value::Gate(b)) => a == b, + (Value::Handle(a), Value::Handle(b)) => a == b, (Value::Null, Value::Null) => true, _ => false, } @@ -99,7 +99,7 @@ impl Value { Value::Bounded(b) => format!("{}b", b), Value::Boolean(b) => b.to_string(), Value::String(s) => s.clone(), - Value::Gate(r) => format!("[Gate {}]", r), + Value::Handle(r) => format!("[Handle {}]", r), Value::Null => "null".to_string(), } } diff --git a/crates/console/prometeu-hal/src/host_return.rs b/crates/console/prometeu-hal/src/host_return.rs index ad395f0a..b0cc5b4b 100644 --- a/crates/console/prometeu-hal/src/host_return.rs +++ b/crates/console/prometeu-hal/src/host_return.rs @@ -26,7 +26,7 @@ impl<'a> HostReturn<'a> { self.stack.push(Value::Null); } pub fn push_gate(&mut self, g: usize) { - self.stack.push(Value::Gate(g)); + self.stack.push(Value::Handle(g)); } pub fn push_string(&mut self, s: String) { self.stack.push(Value::String(s)); diff --git a/crates/console/prometeu-vm/src/virtual_machine.rs b/crates/console/prometeu-vm/src/virtual_machine.rs index f3a99cab..af1f97e2 100644 --- a/crates/console/prometeu-vm/src/virtual_machine.rs +++ b/crates/console/prometeu-vm/src/virtual_machine.rs @@ -92,7 +92,7 @@ pub struct VirtualMachine { pub breakpoints: std::collections::HashSet, } -// HIP/Gate runtime structures removed per PR-2.1 +// HIP/Handle runtime structures removed per PR-2.1 impl Default for VirtualMachine { fn default() -> Self { diff --git a/files/TODOs.md b/files/TODOs.md index d1e05a7b..f9958d77 100644 --- a/files/TODOs.md +++ b/files/TODOs.md @@ -1,58 +1,3 @@ -# PR-2.3 — Normalize Value Model (Stack vs Heap References) - -### Briefing - -The VM must use a clear value model: primitives and tuples on the stack, heap objects referenced through opaque handles. This PR prepares the VM for the GC-based heap. - -### Target - -* Define a single `Value` representation that distinguishes: - - * Immediate primitives. - * Heap references (opaque handles). -* Remove any gate-based or borrow-based value types. - -### Work items - -* Review the `Value` or equivalent enum/struct. -* Remove variants related to gates, borrows, or HIP. -* Ensure only the following categories remain: - - * Primitives (int, bool, etc.). - * Tuples or small aggregates. - * Heap reference handle (placeholder for future GC objects). -* Update stack operations accordingly. - -### Acceptance checklist - -* [ ] `Value` type has no HIP/gate-related variants. -* [ ] All stack operations compile with the new value model. -* [ ] No borrow/mutate semantics remain. -* [ ] `cargo test` passes. - -### Tests - -* Existing tests only. - -### Junie instructions - -**You MAY:** - -* Simplify the `Value` enum/struct. -* Remove legacy variants and adjust matches. - -**You MUST NOT:** - -* Design the GC handle layout. -* Introduce new object systems. -* Change instruction semantics beyond type cleanup. - -**If unclear:** - -* Ask what the intended value shape should be. - ---- - # PR-2.4 — Consolidate Trap and Error Surface ### Briefing