fix unsafe variable handling

This commit is contained in:
Mark Thom
2019-01-24 23:38:53 -07:00
parent c32090325a
commit ef3d3aa01a
13 changed files with 141 additions and 115 deletions

View File

@@ -59,6 +59,13 @@ impl MachineState {
}
}
#[allow(dead_code)]
pub fn print_heap(&self) {
for h in 0 .. self.heap.h {
println!("{} : {}", h, self.heap[h]);
}
}
#[inline]
pub fn machine_flags(&self) -> MachineFlags {
self.flags
@@ -1260,7 +1267,8 @@ impl MachineState {
if let Addr::HeapCell(hc) = addr {
if hc < h {
self.heap.push(HeapCellValue::Addr(addr));
let heap_val = self.heap[hc].clone();
self.heap.push(heap_val);
return;
}
}
@@ -2112,14 +2120,14 @@ impl MachineState {
.unwrap_or(0);
if and_gi > or_gi {
let index = self.e + 1;
let new_e = self.e + 1;
self.and_stack[index].e = self.e;
self.and_stack[index].cp = self.cp.clone();
self.and_stack[index].global_index = gi;
self.and_stack[new_e].e = self.e;
self.and_stack[new_e].cp = self.cp.clone();
self.and_stack[new_e].global_index = gi;
self.and_stack.resize(index, num_cells);
self.e = index;
self.and_stack.resize(new_e, num_cells);
self.e = new_e;
return;
}

View File

@@ -627,7 +627,7 @@ impl MachineState {
}
self.query_stepper(indices, policies, code_repo);
match self.p {
CodePtr::Local(LocalCodePtr::TopLevel(_, p)) if p > 0 => {},
_ => {

View File

@@ -516,9 +516,9 @@ impl MachineState {
&SystemClauseType::WriteTerm => {
let addr = self[temp_v!(1)].clone();
let ignore_ops = self[temp_v!(2)].clone();
let numbervars = self[temp_v!(3)].clone();
let quoted = self[temp_v!(4)].clone();
let ignore_ops = self.store(self.deref(self[temp_v!(2)].clone()));
let numbervars = self.store(self.deref(self[temp_v!(3)].clone()));
let quoted = self.store(self.deref(self[temp_v!(4)].clone()));
let mut printer = HCPrinter::new(&self, PrinterOutputter::new());