add scc_block to MachineState to avoid SCC cleanup terms being deallocated too early (#1427)

This commit is contained in:
Mark
2023-07-06 11:20:49 -06:00
parent 9ff1b660f1
commit 483e4568a2
8 changed files with 90 additions and 31 deletions

View File

@@ -47,6 +47,7 @@ impl MachineState {
tr: 0,
hb: 0,
block: 0,
scc_block: 0,
ball: Ball::new(),
ball_stack: vec![],
lifted_heap: Heap::new(),
@@ -328,6 +329,11 @@ impl MachineState {
unifier.unify_internal();
}
#[inline(always)]
pub(super) fn effective_block(&self) -> usize {
std::cmp::max(self.block, self.scc_block)
}
pub(super) fn set_ball(&mut self) {
self.ball.reset();
@@ -341,8 +347,9 @@ impl MachineState {
);
}
#[inline(always)]
pub(super) fn unwind_stack(&mut self) {
self.b = self.block;
self.b = self.effective_block();
self.fail = true;
}
@@ -1437,17 +1444,6 @@ impl MachineState {
.unwrap_or(true)
}
pub fn reset_block(&mut self, addr: HeapCellValue) {
read_heap_cell!(self.store(addr),
(HeapCellValueTag::Fixnum, n) => {
self.block = n.get_num() as usize;
}
_ => {
self.fail = true;
}
)
}
#[inline(always)]
fn try_functor_compound_case(&mut self, name: Atom, arity: usize) {
self.try_functor_unify_components(atom_as_cell!(name), arity);