Skip to content

Commit

Permalink
check for PStr in eager stackful preorder iterator before adding tail…
Browse files Browse the repository at this point in the history
… of PStrOffset (#2272)
  • Loading branch information
mthom committed Jan 9, 2024
1 parent f9eadc8 commit cd89d71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/heap_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<'a> EagerStackfulPreOrderHeapIter<'a> {
let var_value = self.heap[h];
self.heap[h].set_mark_bit(self.mark_phase);

if !(self.heap[h].is_var() && self.heap[h].get_value() as usize == h) {
if var_value.get_mark_bit() || !(self.heap[h].is_var() && self.heap[h].get_value() as usize == h) {
self.iter_stack.push(var_value);
continue;
}
Expand All @@ -125,12 +125,13 @@ impl<'a> EagerStackfulPreOrderHeapIter<'a> {
continue;
}

let value = self.heap[h+1];

self.heap[h].set_mark_bit(self.mark_phase);
self.heap[h+1].set_mark_bit(self.mark_phase);

self.iter_stack.push(value);
if self.heap[h].get_tag() == HeapCellValueTag::PStr {
let value = self.heap[h+1];
self.heap[h+1].set_mark_bit(self.mark_phase);
self.iter_stack.push(value);
}
}
_ => {
}
Expand Down
1 change: 1 addition & 0 deletions src/machine/system_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ impl MachineState {
)
}


#[inline]
pub(crate) fn variable_set<S: BuildHasher>(
&mut self,
Expand Down

0 comments on commit cd89d71

Please sign in to comment.