]> Repositorios git - scryer-prolog.git/commitdiff
take Lis index from rd in copy_var (#3298)
authorMark Thom <[email protected]>
Tue, 21 Apr 2026 21:31:53 +0000 (14:31 -0700)
committerMark Thom <[email protected]>
Tue, 21 Apr 2026 21:31:53 +0000 (14:31 -0700)
src/machine/copier.rs

index dec0f427d7d09d187e7752ee3df5dc782fd64aeb..e6ce699cb28fa365d60030ebb2e2e801cf68f7be 100644 (file)
@@ -384,7 +384,6 @@ impl<T: CopierTarget> CopyTermState<T> {
     }
 
     fn copy_var(&mut self, addr: HeapCellValue) -> Result<(), AllocError> {
-        let index = addr.get_value() as usize;
         let rd = self.target.deref(addr);
         let ra = self.target.store(rd);
 
@@ -397,6 +396,7 @@ impl<T: CopierTarget> CopyTermState<T> {
                 }
             }
             (HeapCellValueTag::Lis, h) => {
+               let index = rd.get_value() as usize;
                 if h >= self.old_h && self.target[index].get_mark_bit() {
                     *self.value_at_scan() = heap_loc_as_cell!(
                         if ra.get_forwarding_bit() {