fix list copying
This commit is contained in:
@@ -71,13 +71,31 @@ impl<T: CopierTarget> CopyTermState<T> {
|
|||||||
*self.value_at_scan() = HeapCellValue::Addr(Addr::Lis(threshold));
|
*self.value_at_scan() = HeapCellValue::Addr(Addr::Lis(threshold));
|
||||||
|
|
||||||
let hcv = self.target[addr].clone();
|
let hcv = self.target[addr].clone();
|
||||||
self.target.push(hcv);
|
|
||||||
|
|
||||||
|
let ra = hcv.as_addr(threshold);
|
||||||
|
let rd = self.target.store(self.target.deref(ra));
|
||||||
|
|
||||||
|
self.target.push(hcv);
|
||||||
|
|
||||||
let hcv = self.target[addr + 1].clone();
|
let hcv = self.target[addr + 1].clone();
|
||||||
self.target.push(hcv);
|
self.target.push(hcv);
|
||||||
|
|
||||||
self.trail.push((Ref::HeapCell(addr), self.target[addr].clone()));
|
match rd.clone() {
|
||||||
self.target[addr] = HeapCellValue::Addr(Addr::Lis(threshold));
|
Addr::AttrVar(h) | Addr::HeapCell(h) if h >= self.old_h => {
|
||||||
|
self.target[threshold] = HeapCellValue::Addr(rd)
|
||||||
|
}
|
||||||
|
ra @ Addr::AttrVar(_) | ra @ Addr::HeapCell(..) | ra @ Addr::StackCell(..) => {
|
||||||
|
if ra == rd {
|
||||||
|
self.reinstantiate_var(ra, threshold);
|
||||||
|
} else {
|
||||||
|
self.target[threshold] = HeapCellValue::Addr(ra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
self.trail.push((Ref::HeapCell(addr), self.target[addr].clone()));
|
||||||
|
self.target[addr] = HeapCellValue::Addr(Addr::Lis(threshold))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
self.scan += 1;
|
self.scan += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user