fix: preserve plain reference rebinding during read-only calls

This commit is contained in:
2026-10-21 14:30:06 +08:00
parent ff49f266a2
commit 4a2f81cb48
9 changed files with 51 additions and 2 deletions
+6 -1
View File
@@ -72,13 +72,14 @@ impl ObjectStore {
}
pub fn assign_from(&mut self, target: ObjectRef, source: ObjectRef) -> Result<bool, VmError> {
self.heap.prepare_change(target)?;
self.object(target)?;
self.object(source)?;
if let Some(cell) = self
.object(target)?
.payload()
.assignment_cell(source, self)?
{
self.heap.prepare_change(target)?;
// Replacing the Cell edge may otherwise reclaim a target which is
// reachable only through the edge being removed.
self.retain(target)?;
@@ -89,6 +90,10 @@ impl ObjectStore {
self.release(target)?;
return result.map(|()| true);
}
if self.is_read_only() && self.object(target)?.payload().reference_assignment_only() {
return Ok(false);
}
self.heap.prepare_change(target)?;
let changed = self
.object(target)?
.payload()