From: Mark Thom Date: Tue, 21 Apr 2026 23:02:55 +0000 (-0700) Subject: dereference compare_term_test args down from stack (#3286, #3295) X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=703a6dddd1038a2eae7eb10724298953d33891e9;p=scryer-prolog.git dereference compare_term_test args down from stack (#3286, #3295) --- diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index fdaa6aeb..80f6c61f 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -557,6 +557,11 @@ impl MachineState { } pub fn compare_term_test(&self, h1: HeapCellValue, h2: HeapCellValue) -> Option { + // all derefs downstack from this function are heap bound so + // dereference stack vars pointing into the heap while possible + let h1 = self.store(h1); + let h2 = self.store(h2); + for term_pair in ParallelHeapIter::from(self, h1, h2) { match term_pair { TermPair::Vars(v1_offset, v2_offset) if v1_offset != v2_offset => {