don't hold on to popped or frames

This commit is contained in:
Mark Thom
2020-01-20 20:59:30 -07:00
parent 6be2d8ccf2
commit 40bf5bc75f
3 changed files with 6 additions and 15 deletions

View File

@@ -552,7 +552,7 @@ pub(crate) trait CallPolicy: Any {
attr_var_init_queue_b,
attr_var_init_bindings_b);
machine_st.truncate_stack();
machine_st.stack.truncate(machine_st.b);
machine_st.b = machine_st.stack.index_or_frame(b).prelude.b;
machine_st.hb = machine_st.heap.h;
@@ -600,7 +600,7 @@ pub(crate) trait CallPolicy: Any {
attr_var_init_bindings_b,
);
machine_st.truncate_stack();
machine_st.stack.truncate(machine_st.b);
machine_st.b = machine_st.stack.index_or_frame(b).prelude.b;
machine_st.hb = machine_st.heap.h;

View File

@@ -2077,12 +2077,6 @@ impl MachineState {
self.fail = true;
}
pub(super) fn truncate_stack(&mut self) {
if self.b > self.e {
self.stack.truncate_to_frame(self.b);
}
}
pub(crate) fn is_cyclic_term(&self, addr: Addr) -> bool {
let mut seen = IndexSet::new();
let mut fail = false;

View File

@@ -321,18 +321,15 @@ impl Stack {
}
}
pub fn truncate_to_frame(&mut self, b: usize) {
pub fn truncate(&mut self, b: usize) {
if b == 0 {
self.truncate(mem::align_of::<Addr>());
self.inner_truncate(mem::align_of::<Addr>());
} else {
let univ_prelude = self.index_or_frame(b).prelude.univ_prelude;
let size = OrFrame::size_of(univ_prelude.num_cells);
self.truncate(b + size);
self.inner_truncate(b);
}
}
fn truncate(&mut self, b: usize) {
fn inner_truncate(&mut self, b: usize) {
let mut b = b + self.base as usize;
let base = b;