restore support for tabling and delimited continuations (#779)
This commit is contained in:
@@ -673,7 +673,7 @@ impl PredicateInfo {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn must_retract_local_clauses(&self) -> bool {
|
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_discontiguous: self.is_discontiguous,
|
||||||
is_dynamic: self.is_dynamic,
|
is_dynamic: self.is_dynamic,
|
||||||
is_multifile: self.is_multifile,
|
is_multifile: self.is_multifile,
|
||||||
has_clauses: !self.clauses.is_empty(),
|
has_clauses: !self.clause_clause_locs.is_empty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ get_attrs_var_check -->
|
|||||||
|
|
||||||
put_attrs(Name/Arity, Module) -->
|
put_attrs(Name/Arity, Module) -->
|
||||||
put_attr(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) -->
|
put_attrs((Name/Arity, Atts), Module) -->
|
||||||
{ nonvar(Atts) },
|
{ nonvar(Atts) },
|
||||||
put_attr(Name, Arity, Module),
|
put_attr(Name, Arity, Module),
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
:- module(cont, [reset/3, shift/1]).
|
:- module(cont, [reset/3, shift/1]).
|
||||||
|
|
||||||
|
:- meta_predicate reset(0, ?, ?).
|
||||||
|
|
||||||
reset(Goal, Ball, Cont) :-
|
reset(Goal, Ball, Cont) :-
|
||||||
call(Goal),
|
call(Goal),
|
||||||
'$reset_cont_marker',
|
'$reset_cont_marker',
|
||||||
@@ -11,7 +13,7 @@ shift(Ball) :-
|
|||||||
get_chunks(E, P, L),
|
get_chunks(E, P, L),
|
||||||
( L == [] ->
|
( L == [] ->
|
||||||
Cont = cont(true)
|
Cont = cont(true)
|
||||||
; Cont = cont(call_continuation(L))
|
; Cont = cont(cont:call_continuation(L))
|
||||||
),
|
),
|
||||||
'$write_cont_and_term'(_, _, Cont, Ball),
|
'$write_cont_and_term'(_, _, Cont, Ball),
|
||||||
'$unwind_environments'.
|
'$unwind_environments'.
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
:- use_module(library(tabling/double_linked_list)).
|
:- use_module(library(tabling/double_linked_list)).
|
||||||
:- use_module(library(tabling/table_data_structure)).
|
:- use_module(library(tabling/table_data_structure)).
|
||||||
:- use_module(library(tabling/batched_worklist)).
|
:- use_module(library(tabling/batched_worklist)).
|
||||||
:- use_module(library(tabling/wrapper)).
|
|
||||||
:- use_module(library(tabling/global_worklist)).
|
:- use_module(library(tabling/global_worklist)).
|
||||||
:- use_module(library(tabling/table_link_manager)).
|
:- use_module(library(tabling/table_link_manager)).
|
||||||
|
:- use_module(library(tabling/wrapper)).
|
||||||
|
|
||||||
:- use_module(library(cont)).
|
:- use_module(library(cont)).
|
||||||
:- use_module(library(lists)).
|
:- use_module(library(lists)).
|
||||||
@@ -66,6 +66,9 @@ table_and_status_for_variant(V,T,S) :-
|
|||||||
table_for_variant(V,T),
|
table_for_variant(V,T),
|
||||||
tbd_table_status(T,S).
|
tbd_table_status(T,S).
|
||||||
|
|
||||||
|
|
||||||
|
:- meta_predicate start_tabling(?, 0).
|
||||||
|
|
||||||
start_tabling(Wrapper,Worker) :-
|
start_tabling(Wrapper,Worker) :-
|
||||||
put_new_trie_table_link,
|
put_new_trie_table_link,
|
||||||
put_new_global_worklist,
|
put_new_global_worklist,
|
||||||
|
|||||||
@@ -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.
|
:- 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
|
/** <module> Tabling Worklist management
|
||||||
|
|
||||||
A batched worklist: a worklist that clusters suspensions and answers as
|
A batched worklist: a worklist that clusters suspensions and answers as
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
:- attribute table_global_worklist/1.
|
:- attribute table_global_worklist/1.
|
||||||
|
|
||||||
|
verify_attributes(_, _, []).
|
||||||
|
|
||||||
put_new_global_worklist :-
|
put_new_global_worklist :-
|
||||||
( bb_get(table_global_worklist_initialized, _) ->
|
( bb_get(table_global_worklist_initialized, _) ->
|
||||||
true
|
true
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
|
|
||||||
:- attribute table_status/1, newly_created_table_identifiers/1.
|
:- attribute table_status/1, newly_created_table_identifiers/1.
|
||||||
|
|
||||||
|
verify_attributes(_, _, []).
|
||||||
|
|
||||||
% This file defines the table datastructure.
|
% This file defines the table datastructure.
|
||||||
%
|
%
|
||||||
% The table datastructure contains the following sub-structures:
|
% The table datastructure contains the following sub-structures:
|
||||||
|
|||||||
@@ -51,6 +51,8 @@
|
|||||||
|
|
||||||
:- attribute trie_table_link/1.
|
:- attribute trie_table_link/1.
|
||||||
|
|
||||||
|
verify_attributes(_, _, []).
|
||||||
|
|
||||||
% This file defines a call pattern trie.
|
% This file defines a call pattern trie.
|
||||||
%
|
%
|
||||||
% This data structure keeps the relation between a variant and the
|
% This data structure keeps the relation between a variant and the
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
|
|
||||||
:- attribute maybe_just/1, children/1.
|
:- attribute maybe_just/1, children/1.
|
||||||
|
|
||||||
|
verify_attributes(_, _, []).
|
||||||
|
|
||||||
% Implementation of a prefix tree, a.k.a. trie %
|
% Implementation of a prefix tree, a.k.a. trie %
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
:- use_module(library(dcgs)).
|
:- use_module(library(dcgs)).
|
||||||
:- use_module(library(error)).
|
:- use_module(library(error)).
|
||||||
|
|
||||||
|
:- multifile(tabled/2).
|
||||||
|
|
||||||
%%:- multifile
|
%%:- multifile
|
||||||
%% system:term_expansion/2,
|
%% system:term_expansion/2,
|
||||||
%% tabled/2.
|
%% tabled/2.
|
||||||
|
|||||||
@@ -1754,7 +1754,7 @@ impl<'a, TS: TermStream> Loader<'a, TS> {
|
|||||||
.map(|skeleton| skeleton.predicate_info())
|
.map(|skeleton| skeleton.predicate_info())
|
||||||
.unwrap_or_default();
|
.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);
|
self.retract_local_clauses(&key, predicate_info.is_dynamic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user