From: Mark Thom Date: Sun, 4 May 2025 05:04:04 +0000 (-0700) Subject: correct threshold marking in copy_structure (#2920) X-Git-Tag: v0.10.0~35^2~15 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=8b009448f4630b6efa3dfd84f199895cd3f106f3;p=scryer-prolog.git correct threshold marking in copy_structure (#2920) --- diff --git a/src/machine/copier.rs b/src/machine/copier.rs index 57e034af..78658c4a 100644 --- a/src/machine/copier.rs +++ b/src/machine/copier.rs @@ -426,7 +426,7 @@ impl CopyTermState { let index_cell = self.target[addr.saturating_sub(1)]; - *self.value_at_scan() = if get_structure_index(index_cell).is_some() { + let str_cell = if get_structure_index(index_cell).is_some() { // copy the index pointer trailing this // inlined or expanded goal. let mut writer = self.target.reserve(1).unwrap(); @@ -440,11 +440,12 @@ impl CopyTermState { str_loc_as_cell!(threshold) }; + *self.value_at_scan() = str_cell; self.target.copy_slice_to_end(addr .. addr + 1 + arity)?; let trail_item = mem::replace( &mut self.target[addr], - str_loc_as_cell!(threshold), + str_cell, ); self.trail.push((TrailRef::heap_cell(addr), trail_item));