]> Repositorios git - scryer-prolog.git/commitdiff
do not push stack variables to the heap in term_variables (#2087)
authorMark <[email protected]>
Mon, 9 Oct 2023 17:38:01 +0000 (11:38 -0600)
committerMark <[email protected]>
Mon, 9 Oct 2023 17:38:17 +0000 (11:38 -0600)
src/machine/system_calls.rs

index ba21168385881b718a19e227c3949bddb212b0d6..359e8e9ac5af72d08b41d9f41cadd1d42d738638 100644 (file)
@@ -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);