major refactor

This commit is contained in:
Mark Thom
2018-05-15 22:47:36 -06:00
parent 8f1d721477
commit 06d896277c
22 changed files with 587 additions and 1276 deletions

View File

@@ -1065,13 +1065,6 @@ impl MachineState {
duplicator.duplicate_term(addr);
}
pub(super) fn unwind_stack(&mut self) {
self.b = self.block;
self.or_stack.truncate(self.b);
self.fail = true;
}
pub(super) fn setup_call_n(&mut self, arity: usize) -> Option<PredicateKey>
{
let stub = self.functor_stub(clause_name!("call"), arity + 1);
@@ -1121,7 +1114,14 @@ impl MachineState {
Some((name, arity + narity - 1))
}
pub(super) fn unwind_stack(&mut self) {
self.b = self.block;
self.or_stack.truncate(self.b);
self.fail = true;
}
fn heap_ball_boundary_diff(&self) -> usize {
if self.ball.boundary > self.heap.h {
self.ball.boundary - self.heap.h
@@ -1945,6 +1945,13 @@ impl MachineState {
self[r] = Addr::Con(Constant::Usize(b0));
self.p += 1;
},
&CutInstruction::GetLevelAndUnify(r) => {
let b0 = Addr::Con(Constant::Usize(self.b0));
let a = self[r].clone();
self.unify(a, b0);
self.p += 1;
},
&CutInstruction::Cut(r) => {
cut_policy.cut(self, r);
self.p += 1;