do not use self.fail in compare_term_test

This commit is contained in:
Mark Thom
2025-09-16 21:23:23 -07:00
parent 72cdba82f5
commit 012e3de3a1

View File

@@ -593,26 +593,30 @@ impl MachineState {
self.pdl.push(char_as_cell!(c)); self.pdl.push(char_as_cell!(c));
self.pdl.push(heap_loc_as_cell!(l2)); self.pdl.push(heap_loc_as_cell!(l2));
} }
(HeapCellValueTag::Str, s) => { (HeapCellValueTag::Str, s2) => {
if tabu_list.contains(&(l1, s)) { if tabu_list.contains(&(l1, s2)) {
continue; continue;
} }
let (name, arity) = cell_as_atom_cell!(self.heap[s]) tabu_list.insert((l1, s2));
let (n2, a2) = cell_as_atom_cell!(self.heap[s2])
.get_name_and_arity(); .get_name_and_arity();
if name == atom!(".") && arity == 2 { match (2, atom!(".")).cmp(&(a2,n2)) {
tabu_list.insert((l1, s)); Ordering::Equal => {
let (c, succ_cell) = self.heap.last_str_char_and_tail(l1);
let (c, succ_cell) = self.heap.last_str_char_and_tail(l1); self.pdl.push(heap_loc_as_cell!(s2+2));
self.pdl.push(succ_cell);
self.pdl.push(heap_loc_as_cell!(s+2)); self.pdl.push(heap_loc_as_cell!(s2+1));
self.pdl.push(succ_cell); self.pdl.push(char_as_cell!(c));
}
self.pdl.push(heap_loc_as_cell!(s+1)); ordering => {
self.pdl.push(char_as_cell!(c)); self.pdl.clear();
} else { return Some(ordering);
self.fail = true; }
} }
} }
_ => { _ => {
@@ -673,19 +677,23 @@ impl MachineState {
} }
} }
(HeapCellValueTag::PStrLoc, l2) => { (HeapCellValueTag::PStrLoc, l2) => {
let (name, arity) = cell_as_atom_cell!(self.heap[s1]) let (n1, a1) = cell_as_atom_cell!(self.heap[s1])
.get_name_and_arity(); .get_name_and_arity();
if name == atom!(".") && arity == 2 { match (a1,n1).cmp(&(2, atom!("."))) {
let (c, succ_cell) = self.heap.last_str_char_and_tail(l2); Ordering::Equal => {
let (c, succ_cell) = self.heap.last_str_char_and_tail(l2);
self.pdl.push(succ_cell); self.pdl.push(succ_cell);
self.pdl.push(heap_loc_as_cell!(s1+2)); self.pdl.push(heap_loc_as_cell!(s1+2));
self.pdl.push(char_as_cell!(c)); self.pdl.push(char_as_cell!(c));
self.pdl.push(heap_loc_as_cell!(s1+1)); self.pdl.push(heap_loc_as_cell!(s1+1));
} else { }
self.fail = true; ordering => {
self.pdl.clear();
return Some(ordering);
}
} }
} }
_ => { _ => {