fix cont function crashes (#2920)
This commit is contained in:
@@ -1261,10 +1261,6 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
let code_len = self.wam_prelude.code.len();
|
let code_len = self.wam_prelude.code.len();
|
||||||
let mut code_ptr = code_len;
|
let mut code_ptr = code_len;
|
||||||
|
|
||||||
if key == (atom!("..."), 2) {
|
|
||||||
print!("");
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut clauses = vec![];
|
let mut clauses = vec![];
|
||||||
let mut preprocessor = Preprocessor::new(settings);
|
let mut preprocessor = Preprocessor::new(settings);
|
||||||
|
|
||||||
|
|||||||
@@ -186,26 +186,8 @@ impl IndexMut<RegType> for MachineState {
|
|||||||
|
|
||||||
pub type CallResult = Result<(), Vec<FunctorElement>>;
|
pub type CallResult = Result<(), Vec<FunctorElement>>;
|
||||||
|
|
||||||
/*
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn pstr_loc_and_offset(heap: &[HeapCellValue], index: usize) -> (usize, Fixnum) {
|
|
||||||
read_heap_cell!(heap[index],
|
|
||||||
(HeapCellValueTag::PStr | HeapCellValueTag::CStr) => {
|
|
||||||
(index, Fixnum::build_with(0))
|
|
||||||
}
|
|
||||||
(HeapCellValueTag::PStrOffset, h) => {
|
|
||||||
(h, cell_as_fixnum!(heap[index+1]))
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// size may be an upper bound.
|
// size may be an upper bound.
|
||||||
// true_size is calculated to compute the exact offset.
|
// true_size is calculated to compute the exact offset.
|
||||||
|
|
||||||
fn push_var_eq_functors<'a>(
|
fn push_var_eq_functors<'a>(
|
||||||
heap: &mut Heap,
|
heap: &mut Heap,
|
||||||
size: usize,
|
size: usize,
|
||||||
|
|||||||
@@ -5711,7 +5711,6 @@ impl Machine {
|
|||||||
|
|
||||||
if addr.get_tag() == HeapCellValueTag::StackVar {
|
if addr.get_tag() == HeapCellValueTag::StackVar {
|
||||||
section.push_cell(heap_loc_as_cell!(h + 1 + idx));
|
section.push_cell(heap_loc_as_cell!(h + 1 + idx));
|
||||||
|
|
||||||
self.machine_st.stack[stack_offset] = heap_loc_as_cell!(h + 1 + idx);
|
self.machine_st.stack[stack_offset] = heap_loc_as_cell!(h + 1 + idx);
|
||||||
|
|
||||||
// have to inline the TrailRef::Ref(RefTag::StackCell) case of MachineState::trail
|
// have to inline the TrailRef::Ref(RefTag::StackCell) case of MachineState::trail
|
||||||
@@ -5730,7 +5729,7 @@ impl Machine {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let chunk = str_loc_as_cell!(self.machine_st.heap.cell_len());
|
let chunk = str_loc_as_cell!(h);
|
||||||
unify!(self.machine_st, self.machine_st.registers[3], chunk);
|
unify!(self.machine_st, self.machine_st.registers[3], chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6317,13 +6316,13 @@ impl Machine {
|
|||||||
let e = and_frame.prelude.e;
|
let e = and_frame.prelude.e;
|
||||||
let e = Fixnum::build_with(i64::try_from(e).unwrap());
|
let e = Fixnum::build_with(i64::try_from(e).unwrap());
|
||||||
|
|
||||||
let mut writer = Heap::functor_writer(functor!(atom!("dir_entry"), [fixnum(cp)]));
|
|
||||||
|
|
||||||
let p_functor_cell = step_or_resource_error!(machine_st, writer(&mut machine_st.heap));
|
|
||||||
|
|
||||||
machine_st.unify_fixnum(e, machine_st.registers[2]);
|
machine_st.unify_fixnum(e, machine_st.registers[2]);
|
||||||
|
|
||||||
if !machine_st.fail {
|
if !machine_st.fail {
|
||||||
|
let mut writer = Heap::functor_writer(functor!(atom!("dir_entry"), [fixnum(cp)]));
|
||||||
|
let p_functor_cell =
|
||||||
|
step_or_resource_error!(machine_st, writer(&mut machine_st.heap));
|
||||||
|
|
||||||
unify!(machine_st, p_functor_cell, machine_st.registers[3]);
|
unify!(machine_st, p_functor_cell, machine_st.registers[3]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -6350,6 +6349,12 @@ impl Machine {
|
|||||||
// active permanent variables can be read from
|
// active permanent variables can be read from
|
||||||
// it later.
|
// it later.
|
||||||
let and_frame = self.machine_st.stack.index_and_frame(e);
|
let and_frame = self.machine_st.stack.index_and_frame(e);
|
||||||
|
|
||||||
|
if and_frame.prelude.cp == 0 {
|
||||||
|
self.machine_st.fail = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let cp = and_frame.prelude.cp - 1;
|
let cp = and_frame.prelude.cp - 1;
|
||||||
let mut writer = Heap::functor_writer(functor!(atom!("dir_entry"), [fixnum(cp)]));
|
let mut writer = Heap::functor_writer(functor!(atom!("dir_entry"), [fixnum(cp)]));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user