From 223b946199ae9229b7b92b4c046c4b41ff38b6db Mon Sep 17 00:00:00 2001 From: Edward Amsden Date: Mon, 30 Jan 2023 19:27:41 -0600 Subject: [PATCH] [ares] comment explaining why unifying equality does not, in fact, infinite loop --- rust/ares/src/mem.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/ares/src/mem.rs b/rust/ares/src/mem.rs index 7fa0e67..3a5c29b 100644 --- a/rust/ares/src/mem.rs +++ b/rust/ares/src/mem.rs @@ -671,6 +671,13 @@ pub unsafe fn unifying_equality(stack: &mut NockStack, a: *mut Noun, b: *mut Nou stack.reclaim_in_previous_frame::<(*mut Noun, *mut Noun)>(); continue; } else { + /* THIS ISN'T AN INFINITE LOOP + * If we discover a disequality in either side, we will + * short-circuit the entire loop and reset the work stack. + * + * If both sides are equal, then we will discover pointer + * equality when we return and unify the cell. + */ *(stack.alloc_in_previous_frame()) = (x_cell.tail_as_mut(), y_cell.tail_as_mut()); *(stack.alloc_in_previous_frame()) =