restore support for tabling and delimited continuations (#779)

This commit is contained in:
Mark Thom
2021-02-17 16:18:49 -07:00
parent 396c589743
commit 2a70ca375c
11 changed files with 23 additions and 6 deletions

View 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(),
}
}

View 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),

View 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'.

View 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,

View 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

View File

@@ -13,6 +13,8 @@
:- attribute table_global_worklist/1.
verify_attributes(_, _, []).
put_new_global_worklist :-
( bb_get(table_global_worklist_initialized, _) ->
true

View 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:

View 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

View File

@@ -47,6 +47,8 @@
:- attribute maybe_just/1, children/1.
verify_attributes(_, _, []).
% Implementation of a prefix tree, a.k.a. trie %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@@ -40,6 +40,8 @@
:- use_module(library(dcgs)).
:- use_module(library(error)).
:- multifile(tabled/2).
%%:- multifile
%% system:term_expansion/2,
%% tabled/2.

View 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);
}