reset attributed variables queue when backtracking (#678, etc.)
This commit is contained in:
@@ -34,12 +34,6 @@ impl AttrVarInitializer {
|
|||||||
self.attr_var_queue.clear();
|
self.attr_var_queue.clear();
|
||||||
self.bindings.clear();
|
self.bindings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub(super) fn backtrack(&mut self, queue_b: usize, bindings_b: usize) {
|
|
||||||
self.attr_var_queue.truncate(queue_b);
|
|
||||||
self.bindings.truncate(bindings_b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MachineState {
|
impl MachineState {
|
||||||
|
|||||||
@@ -752,20 +752,7 @@ pub(crate) trait CallPolicy: Any + fmt::Debug {
|
|||||||
.heap
|
.heap
|
||||||
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
||||||
|
|
||||||
let attr_var_init_queue_b = machine_st
|
machine_st.attr_var_init.reset();
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_queue_b;
|
|
||||||
let attr_var_init_bindings_b = machine_st
|
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_bindings_b;
|
|
||||||
|
|
||||||
machine_st
|
|
||||||
.attr_var_init
|
|
||||||
.backtrack(attr_var_init_queue_b, attr_var_init_bindings_b);
|
|
||||||
|
|
||||||
machine_st.hb = machine_st.heap.h();
|
machine_st.hb = machine_st.heap.h();
|
||||||
machine_st.p += 1;
|
machine_st.p += 1;
|
||||||
@@ -808,20 +795,7 @@ pub(crate) trait CallPolicy: Any + fmt::Debug {
|
|||||||
.heap
|
.heap
|
||||||
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
||||||
|
|
||||||
let attr_var_init_queue_b = machine_st
|
machine_st.attr_var_init.reset();
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_queue_b;
|
|
||||||
let attr_var_init_bindings_b = machine_st
|
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_bindings_b;
|
|
||||||
|
|
||||||
machine_st
|
|
||||||
.attr_var_init
|
|
||||||
.backtrack(attr_var_init_queue_b, attr_var_init_bindings_b);
|
|
||||||
|
|
||||||
machine_st.hb = machine_st.heap.h();
|
machine_st.hb = machine_st.heap.h();
|
||||||
machine_st.p = CodePtr::Local(dir_entry!(machine_st.p.local().abs_loc() + offset));
|
machine_st.p = CodePtr::Local(dir_entry!(machine_st.p.local().abs_loc() + offset));
|
||||||
@@ -862,20 +836,7 @@ pub(crate) trait CallPolicy: Any + fmt::Debug {
|
|||||||
.heap
|
.heap
|
||||||
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
||||||
|
|
||||||
let attr_var_init_queue_b = machine_st
|
machine_st.attr_var_init.reset();
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_queue_b;
|
|
||||||
let attr_var_init_bindings_b = machine_st
|
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_bindings_b;
|
|
||||||
|
|
||||||
machine_st
|
|
||||||
.attr_var_init
|
|
||||||
.backtrack(attr_var_init_queue_b, attr_var_init_bindings_b);
|
|
||||||
|
|
||||||
machine_st.b = machine_st.stack.index_or_frame(b).prelude.b;
|
machine_st.b = machine_st.stack.index_or_frame(b).prelude.b;
|
||||||
machine_st.stack.truncate(b);
|
machine_st.stack.truncate(b);
|
||||||
@@ -918,20 +879,7 @@ pub(crate) trait CallPolicy: Any + fmt::Debug {
|
|||||||
.heap
|
.heap
|
||||||
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
.truncate(machine_st.stack.index_or_frame(b).prelude.h);
|
||||||
|
|
||||||
let attr_var_init_queue_b = machine_st
|
machine_st.attr_var_init.reset();
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_queue_b;
|
|
||||||
let attr_var_init_bindings_b = machine_st
|
|
||||||
.stack
|
|
||||||
.index_or_frame(b)
|
|
||||||
.prelude
|
|
||||||
.attr_var_init_bindings_b;
|
|
||||||
|
|
||||||
machine_st
|
|
||||||
.attr_var_init
|
|
||||||
.backtrack(attr_var_init_queue_b, attr_var_init_bindings_b);
|
|
||||||
|
|
||||||
machine_st.b = machine_st.stack.index_or_frame(b).prelude.b;
|
machine_st.b = machine_st.stack.index_or_frame(b).prelude.b;
|
||||||
machine_st.stack.truncate(b);
|
machine_st.stack.truncate(b);
|
||||||
|
|||||||
@@ -3298,9 +3298,6 @@ impl MachineState {
|
|||||||
or_frame.prelude.h = self.heap.h();
|
or_frame.prelude.h = self.heap.h();
|
||||||
or_frame.prelude.b0 = self.b0;
|
or_frame.prelude.b0 = self.b0;
|
||||||
|
|
||||||
or_frame.prelude.attr_var_init_queue_b = self.attr_var_init.attr_var_queue.len();
|
|
||||||
or_frame.prelude.attr_var_init_bindings_b = self.attr_var_init.bindings.len();
|
|
||||||
|
|
||||||
self.b = b;
|
self.b = b;
|
||||||
|
|
||||||
for i in 1..n + 1 {
|
for i in 1..n + 1 {
|
||||||
@@ -3504,8 +3501,6 @@ impl MachineState {
|
|||||||
or_frame.prelude.tr = self.tr;
|
or_frame.prelude.tr = self.tr;
|
||||||
or_frame.prelude.h = self.heap.h();
|
or_frame.prelude.h = self.heap.h();
|
||||||
or_frame.prelude.b0 = self.b0;
|
or_frame.prelude.b0 = self.b0;
|
||||||
or_frame.prelude.attr_var_init_queue_b = self.attr_var_init.attr_var_queue.len();
|
|
||||||
or_frame.prelude.attr_var_init_bindings_b = self.attr_var_init.attr_var_queue.len();
|
|
||||||
|
|
||||||
self.b = b;
|
self.b = b;
|
||||||
|
|
||||||
|
|||||||
@@ -112,8 +112,6 @@ pub(crate) struct OrFramePrelude {
|
|||||||
pub(crate) pstr_tr: usize,
|
pub(crate) pstr_tr: usize,
|
||||||
pub(crate) h: usize,
|
pub(crate) h: usize,
|
||||||
pub(crate) b0: usize,
|
pub(crate) b0: usize,
|
||||||
pub(crate) attr_var_init_queue_b: usize,
|
|
||||||
pub(crate) attr_var_init_bindings_b: usize,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
Reference in New Issue
Block a user