]> Repositorios git - scryer-prolog.git/commitdiff
replace call with $call in more meta-predicates
authorMark Thom <[email protected]>
Mon, 6 Jun 2022 02:53:07 +0000 (20:53 -0600)
committerMark Thom <[email protected]>
Mon, 6 Jun 2022 15:28:03 +0000 (09:28 -0600)
src/lib/builtins.pl
src/machine/system_calls.rs

index 9907b85c1b2efe8f916bad28268b29401730478a..3106a7b0982f48d97c1f3bebb1ea796d7e260f0c 100644 (file)
@@ -185,7 +185,7 @@ fail :- '$fail'.
 
 :- meta_predicate \+(0).
 
-\+ G :- call(G), !, false.
+\+ G :- '$call'(G), !, false.
 \+ _.
 
 
@@ -195,7 +195,7 @@ _ \= _.
 
 :- meta_predicate once(0).
 
-once(G) :- call(G), !.
+once(G) :- '$call'(G), !.
 
 
 repeat.
@@ -216,17 +216,17 @@ G1 -> G2 :- control_entry_point((G1 -> G2)).
 
 staggered_if_then(G1, G2) :-
     '$get_staggered_cp'(B),
-    call('$call'(G1)),
+    '$call'(G1),
     '$set_cp'(B),
-    call('$call'(G2)).
+    '$call'(G2).
 
 G1 ; G2 :- control_entry_point((G1 ; G2)).
 
 
 :- non_counted_backtracking staggered_sc/2.
 
-staggered_sc(G, _) :- call('$call'(G)).
-staggered_sc(_, G) :- call('$call'(G)).
+staggered_sc(G, _) :- '$call'(G).
+staggered_sc(_, G) :- '$call'(G).
 
 
 !.
@@ -622,10 +622,13 @@ catch(G,C,R) :-
     '$get_current_block'(Bb),
     '$call_with_default_policy'(catch(G,C,R,Bb)).
 
+:- meta_predicate catch(0, ?, 0, ?).
+
 :- non_counted_backtracking catch/4.
+
 catch(G,C,R,Bb) :-
     '$install_new_block'(NBb),
-    call(G),
+    '$call'(G),
     '$call_with_default_policy'(end_block(Bb, NBb)).
 catch(G,C,R,Bb) :-
     '$reset_block'(Bb),
@@ -634,6 +637,7 @@ catch(G,C,R,Bb) :-
 
 
 :- non_counted_backtracking end_block/2.
+
 end_block(Bb, NBb) :-
     '$clean_up_block'(NBb),
     '$reset_block'(Bb).
@@ -642,10 +646,11 @@ end_block(Bb, NBb) :-
     '$fail'.
 
 :- non_counted_backtracking handle_ball/3.
+
 handle_ball(C, C, R) :-
     !,
     '$erase_ball',
-    call(R).
+    '$call'(R).
 handle_ball(_, _, _) :-
     '$unwind_stack'.
 
@@ -685,7 +690,7 @@ findall(Template, Goal, Solutions) :-
 :- non_counted_backtracking '$iterate_find_all_diff'/5.
 
 '$iterate_find_all_diff'(Template, Goal, _, _, LhOffset) :-
-    call(Goal),
+    '$call'(Goal),
     '$copy_to_lh'(LhOffset, Template),
     '$fail'.
 '$iterate_find_all_diff'(_, _, Solutions0, Solutions1, LhOffset) :-
index 61f40e0a29209b3a33d29fdbfe29b98a97f99348..6e9e7a1a3035904fbded1250fb00a016c256153c 100644 (file)
@@ -627,6 +627,8 @@ impl MachineState {
 
     #[inline]
     pub(crate) fn install_new_block(&mut self, value: HeapCellValue) -> usize {
+        let value = self.store(self.deref(value));
+
         self.block = self.b;
         self.unify_fixnum(Fixnum::build_with(self.block as i64), value);
 
@@ -4004,7 +4006,7 @@ impl Machine {
 
     #[inline(always)]
     pub(crate) fn inference_level(&mut self) {
-        let a1 = self.machine_st.registers[1];
+        let a1 = self.machine_st.store(self.machine_st.deref(self.machine_st.registers[1]));
         let a2 = self.machine_st.store(self.machine_st.deref(self.machine_st.registers[2]));
 
         let bp = cell_as_fixnum!(a2).get_num() as usize;