]> Repositorios git - scryer-prolog.git/commitdiff
restore support for tabling and delimited continuations (#779)
authorMark Thom <[email protected]>
Wed, 17 Feb 2021 23:18:49 +0000 (16:18 -0700)
committerMark Thom <[email protected]>
Wed, 17 Feb 2021 23:18:49 +0000 (16:18 -0700)
src/forms.rs
src/lib/atts.pl
src/lib/cont.pl
src/lib/tabling.pl
src/lib/tabling/batched_worklist.pl
src/lib/tabling/global_worklist.pl
src/lib/tabling/table_data_structure.pl
src/lib/tabling/table_link_manager.pl
src/lib/tabling/trie.pl
src/lib/tabling/wrapper.pl
src/machine/compile.rs

index 9956c0581d3cbb2fab6ba5379471dc05dea445b3..3f0bd2887825579dd1d641cb727448ac8289001c 100644 (file)
@@ -673,7 +673,7 @@ impl PredicateInfo {
 
     #[inline]
     pub fn must_retract_local_clauses(&self) -> bool {
-        self.is_extensible && !self.is_discontiguous
+        self.is_extensible && self.has_clauses && !self.is_discontiguous
     }
 }
 
@@ -707,7 +707,7 @@ impl PredicateSkeleton {
             is_discontiguous: self.is_discontiguous,
             is_dynamic: self.is_dynamic,
             is_multifile: self.is_multifile,
-            has_clauses: !self.clauses.is_empty(),
+            has_clauses: !self.clause_clause_locs.is_empty(),
         }
     }
 
index fcd5b2c166a3ad20b78d55f540183bb6211e3a3b..afdebd71f72e2cf6798e3e49c8cc7d7da68b450c 100644 (file)
@@ -108,7 +108,7 @@ get_attrs_var_check -->
 
 put_attrs(Name/Arity, Module) -->
     put_attr(Name, Arity, Module),
-    [(put_atts(Var, Attr) :- lists:maplist(put_atts(Var), Attr), !)].
+    [(put_atts(Var, Attr) :- lists:maplist(Module:put_atts(Var), Attr), !)].
 put_attrs((Name/Arity, Atts), Module) -->
     { nonvar(Atts) },
     put_attr(Name, Arity, Module),
index 8dccdc5ec48c2d13f0bdf1e58c4058d4ea51dda0..a5125d96f17623aca122a38dd85d4b9afa11352f 100644 (file)
@@ -1,5 +1,7 @@
 :- module(cont, [reset/3, shift/1]).
 
+:- meta_predicate reset(0, ?, ?).
+
 reset(Goal, Ball, Cont) :-
     call(Goal),
     '$reset_cont_marker',
@@ -11,7 +13,7 @@ shift(Ball) :-
     get_chunks(E, P, L),
     (  L == [] ->
        Cont = cont(true)
-    ;  Cont = cont(call_continuation(L))
+    ;  Cont = cont(cont:call_continuation(L))
     ),
     '$write_cont_and_term'(_, _, Cont, Ball),
     '$unwind_environments'.
index 703da8e3dd5655ccea780d373b1ae708f2609398..2163c791ecda22b78f719af933fe6bfafa4f087f 100644 (file)
@@ -11,9 +11,9 @@
 :- use_module(library(tabling/double_linked_list)).
 :- use_module(library(tabling/table_data_structure)).
 :- use_module(library(tabling/batched_worklist)).
-:- use_module(library(tabling/wrapper)).
 :- use_module(library(tabling/global_worklist)).
 :- use_module(library(tabling/table_link_manager)).
+:- use_module(library(tabling/wrapper)).
 
 :- use_module(library(cont)).
 :- use_module(library(lists)).
@@ -66,6 +66,9 @@ table_and_status_for_variant(V,T,S) :-
   table_for_variant(V,T),
   tbd_table_status(T,S).
 
+
+:- meta_predicate start_tabling(?, 0).
+
 start_tabling(Wrapper,Worker) :-
   put_new_trie_table_link,
   put_new_global_worklist,
index 99f0619bee73f2b288377ce560d79769ae3ac992..8a8b411772dbcfe9a93fecd8e1e9a46e242084b9 100644 (file)
@@ -53,6 +53,8 @@
 
 :- attribute executing_all_work/1, worklist_presence/1, wkl_answer_cluster/1, wkl_suspension_cluster/1, wkl_answer_cluster_pointer_flag/1.
 
+verify_attributes(_, _, []).
+
 /** <module> Tabling Worklist management
 
 A batched worklist: a worklist that  clusters suspensions and answers as
index 19502a92ea52382dee9e8f9b03f6d610b59b5549..55c437f1c1994c59d81af5454f026556f2f181e7 100644 (file)
@@ -13,6 +13,8 @@
 
 :- attribute table_global_worklist/1.
 
+verify_attributes(_, _, []).
+
 put_new_global_worklist :-
   (  bb_get(table_global_worklist_initialized, _) ->
      true
index 0ce989daa06c641c2c34f755654ae59f53d445ea..69a057e69d62d500365be32d3f78c02d84eebeef 100644 (file)
@@ -61,6 +61,8 @@
 
 :- attribute table_status/1, newly_created_table_identifiers/1.
 
+verify_attributes(_, _, []).
+
 % This file defines the table datastructure.
 %
 % The table datastructure contains the following sub-structures:
index ec88f1057be10a6a2d3da2c0a27794e06d389e4a..c346ea1054028b28c91ceec9805c955df22d8b6d 100644 (file)
@@ -51,6 +51,8 @@
 
 :- attribute trie_table_link/1.
 
+verify_attributes(_, _, []).
+
 % This file defines a call pattern trie.
 %
 % This data structure keeps the relation between a variant and the
index 2e545524b4a6504fec06f5f9aa2fa5839ba4ea5e..cd855b9243badd605e89a0f212970bdcdb83ff2e 100644 (file)
@@ -47,6 +47,8 @@
 
 :- attribute maybe_just/1, children/1.
 
+verify_attributes(_, _, []).
+
 % Implementation of a prefix tree, a.k.a. trie %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
index 4c902e84ac2277f01d7ba4038a0c7c3d8ba32037..d2d13901e03e352a81f5043acb58ee97978c584d 100644 (file)
@@ -40,6 +40,8 @@
 :- use_module(library(dcgs)).
 :- use_module(library(error)).
 
+:- multifile(tabled/2).
+
 %%:- multifile
 %%     system:term_expansion/2,
 %%     tabled/2.
index 3c7f9eb8fcc500b1ff0cee7cb24388dc3f63c2b0..9364d176685b315b522203955663854a46fe3eee 100644 (file)
@@ -1754,7 +1754,7 @@ impl<'a, TS: TermStream> Loader<'a, TS> {
             .map(|skeleton| skeleton.predicate_info())
             .unwrap_or_default();
 
-        if predicate_info.must_retract_local_clauses() {
+        if local_predicate_info.must_retract_local_clauses() {
             self.retract_local_clauses(&key, predicate_info.is_dynamic);
         }