Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3
This commit is contained in:
commit
4a50cfa853
@ -3225,7 +3225,7 @@ compact_heap( USES_REGS1 )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (depfr != NULL && gc_B >= DepFr_cons_cp(depfr)) {
|
if (depfr && gc_B >= DepFr_cons_cp(depfr)) {
|
||||||
gc_B = DepFr_cons_cp(depfr);
|
gc_B = DepFr_cons_cp(depfr);
|
||||||
depfr = DepFr_next(depfr);
|
depfr = DepFr_next(depfr);
|
||||||
}
|
}
|
||||||
@ -3408,7 +3408,7 @@ icompact_heap( USES_REGS1 )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
if (depfr != NULL && gc_B >= DepFr_cons_cp(depfr)) {
|
if (depfr && gc_B >= DepFr_cons_cp(depfr)) {
|
||||||
gc_B = DepFr_cons_cp(depfr);
|
gc_B = DepFr_cons_cp(depfr);
|
||||||
depfr = DepFr_next(depfr);
|
depfr = DepFr_next(depfr);
|
||||||
}
|
}
|
||||||
|
4
C/init.c
4
C/init.c
@ -1205,9 +1205,11 @@ InitCodes(void)
|
|||||||
#include "ihstruct.h"
|
#include "ihstruct.h"
|
||||||
#if THREADS
|
#if THREADS
|
||||||
Yap_InitThread(0);
|
Yap_InitThread(0);
|
||||||
#endif
|
#endif /* THREADS */
|
||||||
InitGlobal();
|
InitGlobal();
|
||||||
|
#if !THREADS
|
||||||
InitWorker(0);
|
InitWorker(0);
|
||||||
|
#endif /* THREADS */
|
||||||
InitFirstWorkerThreadHandle();
|
InitFirstWorkerThreadHandle();
|
||||||
/* make sure no one else can use these two atoms */
|
/* make sure no one else can use these two atoms */
|
||||||
CurrentModule = 0;
|
CurrentModule = 0;
|
||||||
|
@ -191,6 +191,9 @@ setup_engine(int myworker_id, int init_thread)
|
|||||||
GLOBAL_NOfThreadsCreated++;
|
GLOBAL_NOfThreadsCreated++;
|
||||||
DEBUG_TLOCK_ACCESS(2, myworker_id);
|
DEBUG_TLOCK_ACCESS(2, myworker_id);
|
||||||
pthread_mutex_unlock(&(REMOTE_ThreadHandle(myworker_id).tlock));
|
pthread_mutex_unlock(&(REMOTE_ThreadHandle(myworker_id).tlock));
|
||||||
|
#ifdef TABLING
|
||||||
|
DepFr_cons_cp(LOCAL_top_dep_fr) = B; /* same as in Yap_init_root_frames() */
|
||||||
|
#endif /* TABLING */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -140,7 +140,9 @@ void Yap_init_global_optyap_data(int max_table_size, int n_workers, int sch_loop
|
|||||||
GLOBAL_last_sg_fr = NULL;
|
GLOBAL_last_sg_fr = NULL;
|
||||||
GLOBAL_check_sg_fr = NULL;
|
GLOBAL_check_sg_fr = NULL;
|
||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
|
#ifdef YAPOR
|
||||||
new_dependency_frame(GLOBAL_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
|
new_dependency_frame(GLOBAL_root_dep_fr, FALSE, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
#endif /* YAPOR */
|
||||||
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
for (i = 0; i < MAX_TABLE_VARS; i++) {
|
||||||
CELL *pt = GLOBAL_table_var_enumerator_addr(i);
|
CELL *pt = GLOBAL_table_var_enumerator_addr(i);
|
||||||
RESET_VARIABLE(pt);
|
RESET_VARIABLE(pt);
|
||||||
@ -175,10 +177,12 @@ void Yap_init_local_optyap_data(int wid) {
|
|||||||
/* local data related to tabling */
|
/* local data related to tabling */
|
||||||
REMOTE_next_free_ans_node(wid) = NULL;
|
REMOTE_next_free_ans_node(wid) = NULL;
|
||||||
REMOTE_top_sg_fr(wid) = NULL;
|
REMOTE_top_sg_fr(wid) = NULL;
|
||||||
REMOTE_top_dep_fr(wid) = GLOBAL_root_dep_fr;
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
|
REMOTE_top_dep_fr(wid) = GLOBAL_root_dep_fr;
|
||||||
Set_REMOTE_top_cp_on_stack(wid, (choiceptr) LOCAL_LocalBase); /* ??? */
|
Set_REMOTE_top_cp_on_stack(wid, (choiceptr) LOCAL_LocalBase); /* ??? */
|
||||||
REMOTE_top_susp_or_fr(wid) = GLOBAL_root_or_fr;
|
REMOTE_top_susp_or_fr(wid) = GLOBAL_root_or_fr;
|
||||||
|
#else
|
||||||
|
new_dependency_frame(REMOTE_top_dep_fr(wid), FALSE, NULL, NULL, NULL, NULL, NULL);
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
return;
|
return;
|
||||||
@ -214,7 +218,11 @@ void Yap_init_root_frames(void) {
|
|||||||
|
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
/* root dependency frame */
|
/* root dependency frame */
|
||||||
|
#ifdef YAPOR
|
||||||
DepFr_cons_cp(GLOBAL_root_dep_fr) = B;
|
DepFr_cons_cp(GLOBAL_root_dep_fr) = B;
|
||||||
|
#else
|
||||||
|
DepFr_cons_cp(LOCAL_top_dep_fr) = B;
|
||||||
|
#endif /* YAPOR */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,17 +393,17 @@ static Int p_show_tabled_predicates( USES_REGS1 ) {
|
|||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
tab_ent_ptr tab_ent;
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
tab_ent = GLOBAL_root_tab_ent;
|
tab_ent = GLOBAL_root_tab_ent;
|
||||||
Sfprintf(out, "Tabled predicates\n");
|
Sfprintf(out, "Tabled predicates\n");
|
||||||
if (tab_ent == NULL)
|
if (tab_ent == NULL)
|
||||||
Sfprintf(out, " NONE\n");
|
Sfprintf(out, " NONE\n");
|
||||||
else
|
else while(tab_ent) {
|
||||||
while(tab_ent) {
|
Sfprintf(out, " %s/%d\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent));
|
||||||
Sfprintf(out, " %s/%d\n", AtomName(TabEnt_atom(tab_ent)), TabEnt_arity(tab_ent));
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
}
|
||||||
}
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ static Int p_show_table( USES_REGS1 ) {
|
|||||||
Term mod, t;
|
Term mod, t;
|
||||||
tab_ent_ptr tab_ent;
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
mod = Deref(ARG2);
|
mod = Deref(ARG2);
|
||||||
t = Deref(ARG3);
|
t = Deref(ARG3);
|
||||||
@ -421,9 +421,12 @@ static Int p_show_table( USES_REGS1 ) {
|
|||||||
tab_ent = RepPredProp(PredPropByAtom(AtomOfTerm(t), mod))->TableOfPred;
|
tab_ent = RepPredProp(PredPropByAtom(AtomOfTerm(t), mod))->TableOfPred;
|
||||||
else if (IsApplTerm(t))
|
else if (IsApplTerm(t))
|
||||||
tab_ent = RepPredProp(PredPropByFunc(FunctorOfTerm(t), mod))->TableOfPred;
|
tab_ent = RepPredProp(PredPropByFunc(FunctorOfTerm(t), mod))->TableOfPred;
|
||||||
else
|
else {
|
||||||
|
PL_release_stream(out);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
}
|
||||||
show_table(tab_ent, SHOW_MODE_STRUCTURE, out);
|
show_table(tab_ent, SHOW_MODE_STRUCTURE, out);
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,20 +435,31 @@ static Int p_show_all_tables( USES_REGS1 ) {
|
|||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
tab_ent_ptr tab_ent;
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
tab_ent = GLOBAL_root_tab_ent;
|
tab_ent = GLOBAL_root_tab_ent;
|
||||||
while(tab_ent) {
|
while(tab_ent) {
|
||||||
show_table(tab_ent, SHOW_MODE_STRUCTURE, out);
|
show_table(tab_ent, SHOW_MODE_STRUCTURE, out);
|
||||||
tab_ent = TabEnt_next(tab_ent);
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
}
|
}
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Int p_show_all_local_tables( USES_REGS1 ) {
|
static Int p_show_all_local_tables( USES_REGS1 ) {
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
|
IOSTREAM *out;
|
||||||
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
|
return (FALSE);
|
||||||
|
tab_ent = GLOBAL_root_tab_ent;
|
||||||
|
while(tab_ent) {
|
||||||
|
show_table(tab_ent, SHOW_MODE_STRUCTURE, out);
|
||||||
|
tab_ent = TabEnt_next(tab_ent);
|
||||||
|
}
|
||||||
|
PL_release_stream(out);
|
||||||
#else
|
#else
|
||||||
p_show_all_tables();
|
p_show_all_tables();
|
||||||
#endif /* THREADS */
|
#endif /* THREADS */
|
||||||
@ -456,9 +470,10 @@ static Int p_show_all_local_tables( USES_REGS1 ) {
|
|||||||
static Int p_show_global_trie( USES_REGS1 ) {
|
static Int p_show_global_trie( USES_REGS1 ) {
|
||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
show_global_trie(SHOW_MODE_STRUCTURE, out);
|
show_global_trie(SHOW_MODE_STRUCTURE, out);
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +483,7 @@ static Int p_show_statistics_table( USES_REGS1 ) {
|
|||||||
Term mod, t;
|
Term mod, t;
|
||||||
tab_ent_ptr tab_ent;
|
tab_ent_ptr tab_ent;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
mod = Deref(ARG2);
|
mod = Deref(ARG2);
|
||||||
t = Deref(ARG3);
|
t = Deref(ARG3);
|
||||||
@ -476,9 +491,12 @@ static Int p_show_statistics_table( USES_REGS1 ) {
|
|||||||
tab_ent = RepPredProp(PredPropByAtom(AtomOfTerm(t), mod))->TableOfPred;
|
tab_ent = RepPredProp(PredPropByAtom(AtomOfTerm(t), mod))->TableOfPred;
|
||||||
else if (IsApplTerm(t))
|
else if (IsApplTerm(t))
|
||||||
tab_ent = RepPredProp(PredPropByFunc(FunctorOfTerm(t), mod))->TableOfPred;
|
tab_ent = RepPredProp(PredPropByFunc(FunctorOfTerm(t), mod))->TableOfPred;
|
||||||
else
|
else {
|
||||||
|
PL_release_stream(out);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
}
|
||||||
show_table(tab_ent, SHOW_MODE_STATISTICS, out);
|
show_table(tab_ent, SHOW_MODE_STATISTICS, out);
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +505,7 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
|
|||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
long total_bytes = 0, aux_bytes;
|
long total_bytes = 0, aux_bytes;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
aux_bytes = 0;
|
aux_bytes = 0;
|
||||||
Sfprintf(out, "Execution data structures\n");
|
Sfprintf(out, "Execution data structures\n");
|
||||||
@ -518,15 +536,17 @@ static Int p_show_statistics_tabling( USES_REGS1 ) {
|
|||||||
#else
|
#else
|
||||||
Sfprintf(out, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
Sfprintf(out, "Total memory in use (I+II+III): %10ld bytes\n", total_bytes);
|
||||||
#endif /* USE_PAGES_MALLOC */
|
#endif /* USE_PAGES_MALLOC */
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int p_show_statistics_global_trie( USES_REGS1 ) {
|
static Int p_show_statistics_global_trie( USES_REGS1 ) {
|
||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
show_global_trie(SHOW_MODE_STATISTICS, out);
|
show_global_trie(SHOW_MODE_STATISTICS, out);
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
@ -592,7 +612,7 @@ static Int p_yapor_workers( USES_REGS1 ) {
|
|||||||
return Yap_unify(MkIntegerTerm(GLOBAL_number_workers),ARG1);
|
return Yap_unify(MkIntegerTerm(GLOBAL_number_workers),ARG1);
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif /* YAPOR_THREADS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -628,7 +648,7 @@ static Int p_show_statistics_or( USES_REGS1 ) {
|
|||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
long total_bytes = 0, aux_bytes;
|
long total_bytes = 0, aux_bytes;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
aux_bytes = 0;
|
aux_bytes = 0;
|
||||||
Sfprintf(out, "Execution data structures\n");
|
Sfprintf(out, "Execution data structures\n");
|
||||||
@ -649,6 +669,7 @@ static Int p_show_statistics_or( USES_REGS1 ) {
|
|||||||
#else
|
#else
|
||||||
Sfprintf(out, "Total memory in use (I+II): %10ld bytes\n", total_bytes);
|
Sfprintf(out, "Total memory in use (I+II): %10ld bytes\n", total_bytes);
|
||||||
#endif /* USE_PAGES_MALLOC */
|
#endif /* USE_PAGES_MALLOC */
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
@ -664,7 +685,7 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
|
|||||||
IOSTREAM *out;
|
IOSTREAM *out;
|
||||||
long total_bytes = 0, aux_bytes;
|
long total_bytes = 0, aux_bytes;
|
||||||
|
|
||||||
if ((out = YAP_TermToStream(Deref(ARG1))) == NULL)
|
if (!PL_get_stream_handle(Yap_InitSlot(Deref(ARG1) PASS_REGS), &out))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
aux_bytes = 0;
|
aux_bytes = 0;
|
||||||
Sfprintf(out, "Execution data structures\n");
|
Sfprintf(out, "Execution data structures\n");
|
||||||
@ -707,6 +728,7 @@ static Int p_show_statistics_opt( USES_REGS1 ) {
|
|||||||
#else
|
#else
|
||||||
Sfprintf(out, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
|
Sfprintf(out, "Total memory in use (I+II+III+IV): %10ld bytes\n", total_bytes);
|
||||||
#endif /* USE_PAGES_MALLOC */
|
#endif /* USE_PAGES_MALLOC */
|
||||||
|
PL_release_stream(out);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
#endif /* YAPOR && TABLING */
|
#endif /* YAPOR && TABLING */
|
||||||
|
@ -209,7 +209,9 @@ struct global_optyap_data {
|
|||||||
struct subgoal_frame *last_subgoal_frame;
|
struct subgoal_frame *last_subgoal_frame;
|
||||||
struct subgoal_frame *check_subgoal_frame;
|
struct subgoal_frame *check_subgoal_frame;
|
||||||
#endif /* LIMIT_TABLING */
|
#endif /* LIMIT_TABLING */
|
||||||
|
#ifdef YAPOR
|
||||||
struct dependency_frame *root_dependency_frame;
|
struct dependency_frame *root_dependency_frame;
|
||||||
|
#endif /* YAPOR */
|
||||||
CELL table_var_enumerator[MAX_TABLE_VARS];
|
CELL table_var_enumerator[MAX_TABLE_VARS];
|
||||||
#ifdef TABLE_LOCK_AT_WRITE_LEVEL
|
#ifdef TABLE_LOCK_AT_WRITE_LEVEL
|
||||||
lockvar table_lock[TABLE_LOCK_BUCKETS];
|
lockvar table_lock[TABLE_LOCK_BUCKETS];
|
||||||
|
Reference in New Issue
Block a user