pop AND stack frames after unwinding the trail (#250)
This commit is contained in:
@@ -510,8 +510,8 @@ pub(crate) trait CallPolicy: Any {
|
||||
machine_st.registers[i] = machine_st.or_stack[b][i].clone();
|
||||
}
|
||||
|
||||
machine_st.pop_stack_frames();
|
||||
|
||||
let old_e = machine_st.e;
|
||||
|
||||
machine_st.num_of_args = n;
|
||||
machine_st.e = machine_st.or_stack[b].e;
|
||||
machine_st.cp = machine_st.or_stack[b].cp.clone();
|
||||
@@ -522,6 +522,8 @@ pub(crate) trait CallPolicy: Any {
|
||||
machine_st.unwind_trail(old_tr, curr_tr);
|
||||
machine_st.tr = machine_st.or_stack[b].tr;
|
||||
|
||||
machine_st.pop_stack_frames(old_e);
|
||||
|
||||
machine_st.trail.truncate(machine_st.tr);
|
||||
|
||||
let old_pstr_tr = machine_st.or_stack[b].pstr_tr;
|
||||
@@ -558,7 +560,7 @@ pub(crate) trait CallPolicy: Any {
|
||||
machine_st.registers[i] = machine_st.or_stack[b][i].clone();
|
||||
}
|
||||
|
||||
machine_st.pop_stack_frames();
|
||||
let old_e = machine_st.e;
|
||||
|
||||
machine_st.num_of_args = n;
|
||||
machine_st.e = machine_st.or_stack[b].e;
|
||||
@@ -570,6 +572,8 @@ pub(crate) trait CallPolicy: Any {
|
||||
machine_st.unwind_trail(old_tr, curr_tr);
|
||||
machine_st.tr = machine_st.or_stack[b].tr;
|
||||
|
||||
machine_st.pop_stack_frames(old_e);
|
||||
|
||||
machine_st.trail.truncate(machine_st.tr);
|
||||
|
||||
let old_pstr_tr = machine_st.or_stack[b].pstr_tr;
|
||||
|
||||
@@ -3172,9 +3172,9 @@ impl MachineState {
|
||||
self.p += 1;
|
||||
}
|
||||
|
||||
pub(super) fn pop_stack_frames(&mut self) {
|
||||
if self.and_stack.len() > self.e {
|
||||
let and_gi = self.and_stack[self.e].global_index;
|
||||
pub(super) fn pop_stack_frames(&mut self, e: usize) {
|
||||
if self.and_stack.len() > e {
|
||||
let and_gi = self.and_stack[e].global_index;
|
||||
let or_gi = self
|
||||
.or_stack
|
||||
.top()
|
||||
@@ -3182,7 +3182,7 @@ impl MachineState {
|
||||
.unwrap_or(0);
|
||||
|
||||
if and_gi > or_gi {
|
||||
self.and_stack.truncate(self.e + 1);
|
||||
self.and_stack.truncate(e + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user