From 073f281f1e2d22b8de4be1051a24cead776eec56 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sun, 21 Nov 2021 13:25:24 -0700 Subject: [PATCH] fix arg/3 bug --- src/lib/builtins.pl | 4 ---- src/machine/machine_state_impl.rs | 2 +- src/machine/system_calls.rs | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index ef9f555e..730b97bd 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -209,10 +209,6 @@ repeat :- repeat. :- meta_predicate ->(0,0). -% '!' is for internal use as a callable no-op within if/then/else. -% Where it shouldn't be a no-op, it's interpreted under the expected -% semantics by comma_dispatch/3. - ! :- '$get_staggered_cp'(B), '$set_cp'(B). G1 -> G2 :- '$get_staggered_cp'(B), call('$call'(G1)), '$set_cp'(B), call('$call'(G2)). diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index 47019772..00556078 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -2974,7 +2974,7 @@ impl MachineState { // arg(+N, +Term, ?Arg) pub fn try_arg(&mut self) -> CallResult { let stub_gen = || functor_stub(atom!("arg"), 3); - let n = self.registers[1]; //self.store(self.deref(self.registers[1])); // TODO: necessary? + let n = self.store(self.deref(self.registers[1])); read_heap_cell!(n, (HeapCellValueTag::Var | HeapCellValueTag::AttrVar | HeapCellValueTag::StackVar) => { diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index b5fb568e..5bc6a915 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -3795,12 +3795,12 @@ impl MachineState { self.reset_block(addr); } &SystemClauseType::ResetContinuationMarker => { - self.registers[3] = atom_as_cell!(atom!("none")); - let h = self.heap.len(); - self.heap.push(heap_loc_as_cell!(h)); + self.registers[3] = atom_as_cell!(atom!("none")); self.registers[4] = heap_loc_as_cell!(h); + + self.heap.push(heap_loc_as_cell!(h)); } &SystemClauseType::SetBall => { self.set_ball(); -- 2.54.0