pr 31
This commit is contained in:
parent
9189d2a023
commit
25482e865f
@ -156,6 +156,16 @@ pub enum InstrKind {
|
|||||||
GateEndMutate,
|
GateEndMutate,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// List of instructions that are sensitive to Reference Counting (RC).
|
||||||
|
/// These instructions must trigger retain/release operations on gate handles.
|
||||||
|
pub const RC_SENSITIVE_OPS: &[&str] = &[
|
||||||
|
"LocalStore",
|
||||||
|
"GateStore",
|
||||||
|
"Pop",
|
||||||
|
"Ret",
|
||||||
|
"FrameSync",
|
||||||
|
];
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -343,4 +353,15 @@ mod tests {
|
|||||||
assert!(!name.contains("Ref"), "Instruction {} contains forbidden 'Ref' terminology", name);
|
assert!(!name.contains("Ref"), "Instruction {} contains forbidden 'Ref' terminology", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_rc_sensitive_list_exists() {
|
||||||
|
// Required by PR-06: Documentation test or unit assertion that the RC-sensitive list exists
|
||||||
|
assert!(!RC_SENSITIVE_OPS.is_empty(), "RC-sensitive instructions list must not be empty");
|
||||||
|
|
||||||
|
let expected = ["LocalStore", "GateStore", "Pop", "Ret", "FrameSync"];
|
||||||
|
for op in expected {
|
||||||
|
assert!(RC_SENSITIVE_OPS.contains(&op), "RC-sensitive list must contain {}", op);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,22 @@
|
|||||||
//! * Heap is never directly addressable.
|
//! * Heap is never directly addressable.
|
||||||
//! * All HIP (Heap) access is mediated via Gate Pool resolution.
|
//! * All HIP (Heap) access is mediated via Gate Pool resolution.
|
||||||
//! * `Gate(GateId)` is the only HIP pointer form in `ir_vm`.
|
//! * `Gate(GateId)` is the only HIP pointer form in `ir_vm`.
|
||||||
|
//!
|
||||||
|
//! ## Reference Counting (RC)
|
||||||
|
//!
|
||||||
|
//! The VM uses Reference Counting to manage HIP memory.
|
||||||
|
//!
|
||||||
|
//! ### RC Rules:
|
||||||
|
//! * **Retain**: Increment `strong_rc` when a gate handle is copied.
|
||||||
|
//! * **Release**: Decrement `strong_rc` when a gate handle is overwritten or dropped.
|
||||||
|
//!
|
||||||
|
//! ### RC-Sensitive Instructions:
|
||||||
|
//! The following instructions are RC-sensitive and must trigger RC updates:
|
||||||
|
//! * `LocalStore`: Release old value, retain new value.
|
||||||
|
//! * `GateStore`: Release old value, retain new value.
|
||||||
|
//! * `Pop`: Release the popped value.
|
||||||
|
//! * `Ret`: Release all live locals in the frame.
|
||||||
|
//! * `FrameSync`: Safe point; reclamation occurs after this point.
|
||||||
|
|
||||||
pub mod types;
|
pub mod types;
|
||||||
pub mod module;
|
pub mod module;
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
# PR-06 — RC Hooks Documentation (No RC Yet)
|
|
||||||
|
|
||||||
### Goal
|
|
||||||
|
|
||||||
Prepare the VM for RC without implementing it yet.
|
|
||||||
|
|
||||||
### Required Changes
|
|
||||||
|
|
||||||
* Document which VM instructions are RC-sensitive:
|
|
||||||
|
|
||||||
* `LocalStore`
|
|
||||||
* `GateStore`
|
|
||||||
* stack pop / drop (if present)
|
|
||||||
* frame end / `FrameSync` as safe points
|
|
||||||
|
|
||||||
* Document RC rules:
|
|
||||||
|
|
||||||
* retain on handle copy
|
|
||||||
* release on overwrite/drop
|
|
||||||
|
|
||||||
### Tests
|
|
||||||
|
|
||||||
* Documentation test or unit assertion that the RC-sensitive list exists
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## STOP POINT
|
|
||||||
|
|
||||||
After PR-06:
|
|
||||||
|
|
||||||
* `ir_core` and `ir_vm` are fully decoupled
|
|
||||||
* Lowering is deterministic and placeholder-free
|
|
||||||
* VM ISA v0 is defined and stable
|
|
||||||
* VM runtime work may begin safely
|
|
||||||
|
|
||||||
**Any VM changes before this point must be rejected.**
|
|
||||||
Loading…
x
Reference in New Issue
Block a user