From: Mark Date: Mon, 9 Oct 2023 17:38:01 +0000 (-0600) Subject: do not push stack variables to the heap in term_variables (#2087) X-Git-Tag: remove~43 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=4b9cf0952edcb8f0b29f245b6462b762bb1714df;p=scryer-prolog.git do not push stack variables to the heap in term_variables (#2087) --- diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index ba211683..359e8e9a 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -6872,6 +6872,17 @@ impl Machine { return; } + let stored_v = if stored_v.is_stack_var() { + let h = self.machine_st.heap.len(); + + self.machine_st.heap.push(heap_loc_as_cell!(h)); + self.machine_st.bind(Ref::heap_cell(h), stored_v); + + heap_loc_as_cell!(h) + } else { + stored_v + }; + let mut seen_set = IndexSet::with_hasher(FxBuildHasher::default()); self.machine_st.variable_set(&mut seen_set, stored_v);