From: Mark Thom Date: Sun, 21 Nov 2021 20:25:24 +0000 (-0700) Subject: fix arg/3 bug X-Git-Tag: v0.9.0^2~125 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=073f281f1e2d22b8de4be1051a24cead776eec56;p=scryer-prolog.git fix arg/3 bug --- 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();