Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

Conflicts:
	H/Yap.h
	packages/YapR
This commit is contained in:
Joao 2011-04-14 20:00:35 +01:00
commit 4d537f1536
20 changed files with 179 additions and 103 deletions

View File

@ -1086,7 +1086,7 @@ Yap_absmi(int inp)
} }
/* HEY, leave indexing block alone!! */ /* HEY, leave indexing block alone!! */
/* check if we are the ones using this code */ /* check if we are the ones using this code */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
PELOCK(1, ap); PELOCK(1, ap);
PP = ap; PP = ap;
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);
@ -1387,7 +1387,7 @@ Yap_absmi(int inp)
} }
/* HEY, leave indexing block alone!! */ /* HEY, leave indexing block alone!! */
/* check if we are the ones using this code */ /* check if we are the ones using this code */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
PELOCK(2, ap); PELOCK(2, ap);
PP = ap; PP = ap;
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);
@ -1480,7 +1480,7 @@ Yap_absmi(int inp)
/* only meaningful with THREADS on! */ /* only meaningful with THREADS on! */
/* lock logical updates predicate. */ /* lock logical updates predicate. */
Op(lock_lu, p); Op(lock_lu, p);
#if defined(YAPOR) || defined(THREADS) #if PARALLEL_YAP
if (PP) { if (PP) {
GONext(); GONext();
} }
@ -1508,10 +1508,12 @@ Yap_absmi(int inp)
check_trail(TR); check_trail(TR);
/* say that an environment is using this clause */ /* say that an environment is using this clause */
/* we have our own copy for the clause */ /* we have our own copy for the clause */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
{ {
LogUpdClause *cl = PREG->u.L.ClBase; LogUpdClause *cl = PREG->u.L.ClBase;
#if PARALLEL_YAP
PredEntry *ap = cl->ClPred; PredEntry *ap = cl->ClPred;
#endif
/* always add an extra reference */ /* always add an extra reference */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
@ -1581,7 +1583,7 @@ Yap_absmi(int inp)
} }
setregs(); setregs();
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
/* always add an extra reference */ /* always add an extra reference */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl); TRAIL_CLREF(cl);
@ -1633,7 +1635,7 @@ Yap_absmi(int inp)
/* say that an environment is using this clause */ /* say that an environment is using this clause */
/* we have our own copy for the clause */ /* we have our own copy for the clause */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
/* always add an extra reference */ /* always add an extra reference */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl); TRAIL_CLREF(cl);
@ -1746,7 +1748,7 @@ Yap_absmi(int inp)
#endif /* YAPOR */ #endif /* YAPOR */
SET_BB(B_YREG); SET_BB(B_YREG);
ENDCACHE_Y(); ENDCACHE_Y();
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
INC_CLREF_COUNT(ClauseCodeToDynamicClause(PREG)); INC_CLREF_COUNT(ClauseCodeToDynamicClause(PREG));
UNLOCK(DynamicLock(PREG)); UNLOCK(DynamicLock(PREG));
TRAIL_CLREF(ClauseCodeToDynamicClause(PREG)); TRAIL_CLREF(ClauseCodeToDynamicClause(PREG));
@ -1808,7 +1810,7 @@ Yap_absmi(int inp)
#endif /* FROZEN_STACKS */ #endif /* FROZEN_STACKS */
SET_BB(B_YREG); SET_BB(B_YREG);
ENDCACHE_Y(); ENDCACHE_Y();
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
INC_CLREF_COUNT(ClauseCodeToDynamicClause(PREG)); INC_CLREF_COUNT(ClauseCodeToDynamicClause(PREG));
TRAIL_CLREF(ClauseCodeToDynamicClause(PREG)); TRAIL_CLREF(ClauseCodeToDynamicClause(PREG));
UNLOCK(DynamicLock(PREG)); UNLOCK(DynamicLock(PREG));
@ -2067,7 +2069,7 @@ Yap_absmi(int inp)
if (IN_BETWEEN(H0,pt1,H) && IsAttVar(pt1)) if (IN_BETWEEN(H0,pt1,H) && IsAttVar(pt1))
goto failloop; goto failloop;
flags = *pt1; flags = *pt1;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
if (FlagOn(DBClMask, flags)) { if (FlagOn(DBClMask, flags)) {
DBRef dbr = DBStructFlagsToDBStruct(pt1); DBRef dbr = DBStructFlagsToDBStruct(pt1);
int erase; int erase;
@ -2086,7 +2088,9 @@ Yap_absmi(int inp)
if (flags & IndexMask) { if (flags & IndexMask) {
LogUpdIndex *cl = ClauseFlagsToLogUpdIndex(pt1); LogUpdIndex *cl = ClauseFlagsToLogUpdIndex(pt1);
int erase; int erase;
#if PARALLEL_YAP
PredEntry *ap = cl->ClPred; PredEntry *ap = cl->ClPred;
#endif
PELOCK(8,ap); PELOCK(8,ap);
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);
@ -2110,7 +2114,9 @@ Yap_absmi(int inp)
} else { } else {
LogUpdClause *cl = ClauseFlagsToLogUpdClause(pt1); LogUpdClause *cl = ClauseFlagsToLogUpdClause(pt1);
int erase; int erase;
#if PARALLEL_YAP
PredEntry *ap = cl->ClPred; PredEntry *ap = cl->ClPred;
#endif
PELOCK(9,ap); PELOCK(9,ap);
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);
@ -7926,7 +7932,7 @@ Yap_absmi(int inp)
/* fprintf(stderr,"> %p/%p %d %d\n",cl,ap,ap->TimeStampOfPred,PREG->u.Ills.s);*/ /* fprintf(stderr,"> %p/%p %d %d\n",cl,ap,ap->TimeStampOfPred,PREG->u.Ills.s);*/
PREG = PREG->u.Ills.l1; PREG = PREG->u.Ills.l1;
/* indicate the indexing code is being used */ /* indicate the indexing code is being used */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
/* just store a reference */ /* just store a reference */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl); TRAIL_CLREF(cl);
@ -8032,7 +8038,7 @@ Yap_absmi(int inp)
} }
/* HEY, leave indexing block alone!! */ /* HEY, leave indexing block alone!! */
/* check if we are the ones using this code */ /* check if we are the ones using this code */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);
/* clear the entry from the trail */ /* clear the entry from the trail */
B->cp_tr--; B->cp_tr--;

View File

@ -3052,7 +3052,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
} }
cl_u->luc.ClExt = NULL; cl_u->luc.ClExt = NULL;
cl_u->luc.ClPrev = cl_u->luc.ClNext = NULL; cl_u->luc.ClPrev = cl_u->luc.ClNext = NULL;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
//INIT_LOCK(cl_u->luc.ClLock); //INIT_LOCK(cl_u->luc.ClLock);
INIT_CLREF_COUNT(&(cl_u->luc)); INIT_CLREF_COUNT(&(cl_u->luc));
#endif #endif
@ -3071,6 +3071,8 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
cl_u->ic.ClRefCount = 0; cl_u->ic.ClRefCount = 0;
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
INIT_LOCK(cl_u->ic.ClLock); INIT_LOCK(cl_u->ic.ClLock);
#endif
#ifdef MULTIPLE_STACKS
INIT_CLREF_COUNT(&(cl_u->ic)); INIT_CLREF_COUNT(&(cl_u->ic));
#endif #endif
} }
@ -3122,7 +3124,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
cl_u->lui.ClSize = size; cl_u->lui.ClSize = size;
cl_u->lui.ClRefCount = 0; cl_u->lui.ClRefCount = 0;
// INIT_LOCK(cl_u->lui.ClLock); // INIT_LOCK(cl_u->lui.ClLock);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
INIT_CLREF_COUNT(&(cl_u->lui)); INIT_CLREF_COUNT(&(cl_u->lui));
#endif #endif
} }

View File

@ -392,7 +392,7 @@ AccessNamedArray(Atom a, Int indx USES_REGS)
if (TRef != 0L) { if (TRef != 0L) {
DBRef ref = DBRefOfTerm(TRef); DBRef ref = DBRefOfTerm(TRef);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
LOCK(ref->lock); LOCK(ref->lock);
INC_DBREF_COUNT(ref); INC_DBREF_COUNT(ref);
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
@ -2305,17 +2305,17 @@ p_static_array_to_term( USES_REGS1 )
if (TRef != 0L) { if (TRef != 0L) {
DBRef ref = DBRefOfTerm(TRef); DBRef ref = DBRefOfTerm(TRef);
#if defined(YAPOR) || defined(THREADS)
LOCK(ref->lock); LOCK(ref->lock);
#if MULTIPLE_STACKS
INC_DBREF_COUNT(ref); INC_DBREF_COUNT(ref);
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
UNLOCK(ref->lock);
#else #else
if (!(ref->Flags & InUseMask)) { if (!(ref->Flags & InUseMask)) {
ref->Flags |= InUseMask; ref->Flags |= InUseMask;
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
} }
#endif #endif
UNLOCK(ref->lock);
} else { } else {
TRef = TermNil; TRef = TermNil;
} }

View File

@ -1451,12 +1451,12 @@ Yap_kill_iblock(ClauseUnion *blk, ClauseUnion *parent_blk, PredEntry *ap)
LogUpdIndex *c = (LogUpdIndex *)blk; LogUpdIndex *c = (LogUpdIndex *)blk;
if (parent_blk != NULL) { if (parent_blk != NULL) {
LogUpdIndex *cl = (LogUpdIndex *)parent_blk; LogUpdIndex *cl = (LogUpdIndex *)parent_blk;
#if defined(THREADS) || defined(YAPOR) #if MULTIPLE_STACKS
/* protect against attempts at erasing */ /* protect against attempts at erasing */
cl->ClRefCount++; cl->ClRefCount++;
#endif #endif
kill_first_log_iblock(c, cl, ap); kill_first_log_iblock(c, cl, ap);
#if defined(THREADS) || defined(YAPOR) #if MULTIPLE_STACKS
cl->ClRefCount--; cl->ClRefCount--;
#endif #endif
} else { } else {
@ -1501,12 +1501,12 @@ Yap_ErLogUpdIndex(LogUpdIndex *clau)
if (clau->ClFlags & SwitchRootMask) { if (clau->ClFlags & SwitchRootMask) {
kill_first_log_iblock(clau, NULL, clau->ClPred); kill_first_log_iblock(clau, NULL, clau->ClPred);
} else { } else {
#if defined(THREADS) || defined(YAPOR) #if MULTIPLE_STACKS
/* protect against attempts at erasing */ /* protect against attempts at erasing */
clau->ClRefCount++; clau->ClRefCount++;
#endif #endif
kill_first_log_iblock(clau, clau->ParentIndex, clau->ClPred); kill_first_log_iblock(clau, clau->ParentIndex, clau->ClPred);
#if defined(THREADS) || defined(YAPOR) #if MULTIPLE_STACKS
/* protect against attempts at erasing */ /* protect against attempts at erasing */
clau->ClRefCount--; clau->ClRefCount--;
#endif #endif
@ -2274,7 +2274,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
if (pflags & LogUpdatePredFlag) { if (pflags & LogUpdatePredFlag) {
LogUpdClause *cl = (LogUpdClause *)ClauseCodeToLogUpdClause(cp); LogUpdClause *cl = (LogUpdClause *)ClauseCodeToLogUpdClause(cp);
tf = MkDBRefTerm((DBRef)cl); tf = MkDBRefTerm((DBRef)cl);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
TRAIL_CLREF(cl); /* So that fail will erase it */ TRAIL_CLREF(cl); /* So that fail will erase it */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
#else #else
@ -4428,7 +4428,7 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
return FALSE; return FALSE;
} }
rtn = MkDBRefTerm((DBRef)cl); rtn = MkDBRefTerm((DBRef)cl);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
TRAIL_CLREF(cl); /* So that fail will erase it */ TRAIL_CLREF(cl); /* So that fail will erase it */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
#else #else
@ -4575,7 +4575,7 @@ fetch_next_lu_clause_erase(PredEntry *pe, yamop *i_code, Term th, Term tb, Term
return FALSE; return FALSE;
} }
rtn = MkDBRefTerm((DBRef)cl); rtn = MkDBRefTerm((DBRef)cl);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
TRAIL_CLREF(cl); /* So that fail will erase it */ TRAIL_CLREF(cl); /* So that fail will erase it */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
#else #else
@ -5071,7 +5071,7 @@ p_nth_clause( USES_REGS1 )
return FALSE; return FALSE;
} }
if (pe->PredFlags & LogUpdatePredFlag) { if (pe->PredFlags & LogUpdatePredFlag) {
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
TRAIL_CLREF(cl); /* So that fail will erase it */ TRAIL_CLREF(cl); /* So that fail will erase it */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
#else #else

View File

@ -113,7 +113,7 @@ typedef struct idb_queue
{ {
Functor id; /* identify this as being pointed to by a DBRef */ Functor id; /* identify this as being pointed to by a DBRef */
SMALLUNSGN Flags; /* always required */ SMALLUNSGN Flags; /* always required */
#if defined(YAPOR) || defined(THREADS) #if PARALLEL_YAP
rwlock_t QRWLock; /* a simple lock to protect this entry */ rwlock_t QRWLock; /* a simple lock to protect this entry */
#endif #endif
QueueEntry *FirstInQueue, *LastInQueue; QueueEntry *FirstInQueue, *LastInQueue;
@ -1670,7 +1670,7 @@ record(int Flag, Term key, Term t_data, Term t_code USES_REGS)
else else
x->Flags |= DBNoCode; x->Flags |= DBNoCode;
x->Parent = p; x->Parent = p;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
x->Flags |= DBClMask; x->Flags |= DBClMask;
x->ref_count = 1; x->ref_count = 1;
#else #else
@ -1742,7 +1742,7 @@ record_at(int Flag, DBRef r0, Term t_data, Term t_code USES_REGS)
else else
x->Flags |= DBNoCode; x->Flags |= DBNoCode;
x->Parent = p; x->Parent = p;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
x->Flags |= DBClMask; x->Flags |= DBClMask;
x->ref_count = 1; x->ref_count = 1;
#else #else
@ -1806,7 +1806,7 @@ new_lu_db_entry(Term t, PredEntry *pe)
struct db_globs dbg; struct db_globs dbg;
int d_flag = 0; int d_flag = 0;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
/* we cannot allow sharing between threads (for now) */ /* we cannot allow sharing between threads (for now) */
if (!(pe->PredFlags & ThreadLocalPredFlag)) if (!(pe->PredFlags & ThreadLocalPredFlag))
d_flag |= InQueue; d_flag |= InQueue;
@ -1838,7 +1838,7 @@ new_lu_db_entry(Term t, PredEntry *pe)
cl->ClTimeStart = 0L; cl->ClTimeStart = 0L;
} }
cl->ClTimeEnd = TIMESTAMP_EOT; cl->ClTimeEnd = TIMESTAMP_EOT;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
// INIT_LOCK(cl->ClLock); // INIT_LOCK(cl->ClLock);
INIT_CLREF_COUNT(cl); INIT_CLREF_COUNT(cl);
ipc->opc = Yap_opcode(_copy_idb_term); ipc->opc = Yap_opcode(_copy_idb_term);
@ -1960,7 +1960,7 @@ p_rcda( USES_REGS1 )
cl = record_lu(pe, Deref(ARG2), MkFirst); cl = record_lu(pe, Deref(ARG2), MkFirst);
if (cl != NULL) { if (cl != NULL) {
TRAIL_CLREF(cl); TRAIL_CLREF(cl);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
#else #else
cl->ClFlags |= InUseMask; cl->ClFlags |= InUseMask;
@ -2070,7 +2070,7 @@ p_rcdz( USES_REGS1 )
cl = record_lu(pe, t2, MkLast); cl = record_lu(pe, t2, MkLast);
if (cl != NULL) { if (cl != NULL) {
TRAIL_CLREF(cl); TRAIL_CLREF(cl);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
#else #else
cl->ClFlags |= InUseMask; cl->ClFlags |= InUseMask;
@ -2917,7 +2917,7 @@ lu_nth_recorded(PredEntry *pe, Int Count USES_REGS)
cl = Yap_NthClause(pe, Count); cl = Yap_NthClause(pe, Count);
if (cl == NULL) if (cl == NULL)
return FALSE; return FALSE;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
PELOCK(65,pe); PELOCK(65,pe);
TRAIL_CLREF(cl); /* So that fail will erase it */ TRAIL_CLREF(cl); /* So that fail will erase it */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
@ -2959,7 +2959,7 @@ nth_recorded(DBProp AtProp, Int Count USES_REGS)
return FALSE; return FALSE;
} }
} }
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
LOCK(ref->lock); LOCK(ref->lock);
READ_UNLOCK(AtProp->DBRWLock); READ_UNLOCK(AtProp->DBRWLock);
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
@ -3276,7 +3276,7 @@ i_recorded(DBProp AtProp, Term t3 USES_REGS)
/* This should be after any non-tagged terms, because the routines in grow.c /* This should be after any non-tagged terms, because the routines in grow.c
go from upper to lower addresses */ go from upper to lower addresses */
TRef = MkDBRefTerm(ref); TRef = MkDBRefTerm(ref);
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
LOCK(ref->lock); LOCK(ref->lock);
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
INC_DBREF_COUNT(ref); INC_DBREF_COUNT(ref);
@ -3421,7 +3421,7 @@ c_recorded(int flags USES_REGS)
READ_UNLOCK(ref0->Parent->DBRWLock); READ_UNLOCK(ref0->Parent->DBRWLock);
TRef = MkDBRefTerm(ref); TRef = MkDBRefTerm(ref);
EXTRA_CBACK_ARG(3,1) = (CELL)ref; EXTRA_CBACK_ARG(3,1) = (CELL)ref;
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
LOCK(ref->lock); LOCK(ref->lock);
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
INC_DBREF_COUNT(ref); INC_DBREF_COUNT(ref);
@ -3664,17 +3664,17 @@ p_first_instance( USES_REGS1 )
} }
TRef = MkDBRefTerm(ref); TRef = MkDBRefTerm(ref);
/* we have a pointer to the term available */ /* we have a pointer to the term available */
#if defined(YAPOR) || defined(THREADS)
LOCK(ref->lock); LOCK(ref->lock);
#if MULTIPLE_STACKS
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
INC_DBREF_COUNT(ref); INC_DBREF_COUNT(ref);
UNLOCK(ref->lock);
#else #else
if (!(ref->Flags & InUseMask)) { if (!(ref->Flags & InUseMask)) {
ref->Flags |= InUseMask; ref->Flags |= InUseMask;
TRAIL_REF(ref); /* So that fail will erase it */ TRAIL_REF(ref); /* So that fail will erase it */
} }
#endif #endif
UNLOCK(ref->lock);
while ((TermDB = GetDBTermFromDBEntry(ref PASS_REGS)) == (CELL)0) { while ((TermDB = GetDBTermFromDBEntry(ref PASS_REGS)) == (CELL)0) {
/* oops, we are in trouble, not enough stack space */ /* oops, we are in trouble, not enough stack space */
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) { if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
@ -3942,7 +3942,7 @@ RemoveDBEntry(DBRef entryref USES_REGS)
|| B->cp_ap == RETRY_C_RECORDEDP_CODE) && || B->cp_ap == RETRY_C_RECORDEDP_CODE) &&
EXTRA_CBACK_ARG(3,1) == (CELL)entryref) { EXTRA_CBACK_ARG(3,1) == (CELL)entryref) {
/* make it clear the entry has been released */ /* make it clear the entry has been released */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
DEC_DBREF_COUNT(entryref); DEC_DBREF_COUNT(entryref);
#else #else
entryref->Flags &= ~InUseMask; entryref->Flags &= ~InUseMask;
@ -3993,7 +3993,7 @@ find_next_clause(DBRef ref0 USES_REGS)
newp = ref->Code; newp = ref->Code;
/* and next let's tell the world this clause is being used, just /* and next let's tell the world this clause is being used, just
like if we were executing a standard retry_and_mark */ like if we were executing a standard retry_and_mark */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
{ {
DynamicClause *cl = ClauseCodeToDynamicClause(newp); DynamicClause *cl = ClauseCodeToDynamicClause(newp);
@ -4805,7 +4805,7 @@ Yap_LUInstance(LogUpdClause *cl, UInt arity)
} }
} }
} }
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
cl->ClRefCount++; cl->ClRefCount++;
TRAIL_CLREF(cl); /* So that fail will erase it */ TRAIL_CLREF(cl); /* So that fail will erase it */
#else #else
@ -5427,17 +5427,17 @@ p_fetch_reference_from_index( USES_REGS1 )
return FALSE; return FALSE;
pos = IntOfTerm(t2); pos = IntOfTerm(t2);
el = (DBRef)(table->DBT.Contents[pos]); el = (DBRef)(table->DBT.Contents[pos]);
#if defined(YAPOR) || defined(THREADS)
LOCK(el->lock); LOCK(el->lock);
#if MULTIPLE_STACKS
TRAIL_REF(el); /* So that fail will erase it */ TRAIL_REF(el); /* So that fail will erase it */
INC_DBREF_COUNT(el); INC_DBREF_COUNT(el);
UNLOCK(el->lock);
#else #else
if (!(el->Flags & InUseMask)) { if (!(el->Flags & InUseMask)) {
el->Flags |= InUseMask; el->Flags |= InUseMask;
TRAIL_REF(el); TRAIL_REF(el);
} }
#endif #endif
UNLOCK(el->lock);
return Yap_unify(ARG3, MkDBRefTerm(el)); return Yap_unify(ARG3, MkDBRefTerm(el));
} }

View File

@ -1024,7 +1024,7 @@ p_nb_linkval( USES_REGS1 )
static Int static Int
p_nb_create_accumulator(void) p_nb_create_accumulator( USES_REGS1 )
{ {
Term t = Deref(ARG1), acct, to; Term t = Deref(ARG1), acct, to;
CELL *destp; CELL *destp;
@ -1041,7 +1041,7 @@ p_nb_create_accumulator(void)
if (!Yap_unify(ARG2, acct)) { if (!Yap_unify(ARG2, acct)) {
return FALSE; return FALSE;
} }
to = CopyTermToArena(t, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena))); to = CopyTermToArena(t, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
if (to == 0L) if (to == 0L)
return FALSE; return FALSE;
destp = RepAppl(Deref(ARG2)); destp = RepAppl(Deref(ARG2));
@ -1050,7 +1050,7 @@ p_nb_create_accumulator(void)
} }
static Int static Int
p_nb_add_to_accumulator(void) p_nb_add_to_accumulator( USES_REGS1 )
{ {
Term t = Deref(ARG1), t0, tadd; Term t = Deref(ARG1), t0, tadd;
Functor f; Functor f;
@ -1091,7 +1091,7 @@ p_nb_add_to_accumulator(void)
target[1] = source[1]; target[1] = source[1];
} else { } else {
/* we need to create a new long int */ /* we need to create a new long int */
new = CopyTermToArena(new, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena))); new = CopyTermToArena(new, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
destp = RepAppl(Deref(ARG1)); destp = RepAppl(Deref(ARG1));
destp[1] = new; destp[1] = new;
} }
@ -1118,7 +1118,7 @@ p_nb_add_to_accumulator(void)
new = Yap_MkApplTerm(FunctorPlus, 2, t2); new = Yap_MkApplTerm(FunctorPlus, 2, t2);
new = Yap_Eval(new); new = Yap_Eval(new);
new = CopyTermToArena(new, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena))); new = CopyTermToArena(new, GlobalArena, TRUE, TRUE, 2, &GlobalArena, garena_overflow_size(ArenaPt(GlobalArena) PASS_REGS) PASS_REGS);
destp = RepAppl(Deref(ARG1)); destp = RepAppl(Deref(ARG1));
destp[1] = new; destp[1] = new;
@ -1129,7 +1129,7 @@ p_nb_add_to_accumulator(void)
static Int static Int
p_nb_accumulator_value(void) p_nb_accumulator_value( USES_REGS1 )
{ {
Term t = Deref(ARG1), to; Term t = Deref(ARG1), to;
Functor f; Functor f;

View File

@ -214,7 +214,7 @@ MoveLocalAndTrail( USES_REGS1 )
#endif #endif
} }
#ifdef THREADS #ifdef YAPOR_THREADS
static void static void
CopyLocalAndTrail( USES_REGS1 ) CopyLocalAndTrail( USES_REGS1 )
@ -401,14 +401,14 @@ AdjustTrail(int adjusting_heap, int thread_copying USES_REGS)
{ {
volatile tr_fr_ptr ptt, tr_base = (tr_fr_ptr)Yap_TrailBase; volatile tr_fr_ptr ptt, tr_base = (tr_fr_ptr)Yap_TrailBase;
#if defined(YAPOR) && defined(THREADS) #if defined(YAPOR_THREADS)
if (thread_copying == STACK_INCREMENTAL_COPYING) { if (thread_copying == STACK_INCREMENTAL_COPYING) {
ptt = (tr_fr_ptr)(LOCAL_end_trail_copy); ptt = (tr_fr_ptr)(LOCAL_end_trail_copy);
tr_base = (tr_fr_ptr)(LOCAL_start_trail_copy); tr_base = (tr_fr_ptr)(LOCAL_start_trail_copy);
} else { } else {
#endif #endif
ptt = TR; ptt = TR;
#if defined(YAPOR) && defined(THREADS) #if defined(YAPOR_THREADS)
} }
#endif #endif
/* moving the trail is simple */ /* moving the trail is simple */
@ -462,7 +462,7 @@ AdjustLocal(int thread_copying USES_REGS)
register CELL reg, *pt, *pt_bot; register CELL reg, *pt, *pt_bot;
/* Adjusting the local */ /* Adjusting the local */
#if defined(YAPOR) && defined(THREADS) #if defined(YAPOR_THREADS)
if (thread_copying == STACK_INCREMENTAL_COPYING) { if (thread_copying == STACK_INCREMENTAL_COPYING) {
pt = (CELL *) (LOCAL_end_local_copy); pt = (CELL *) (LOCAL_end_local_copy);
pt_bot = (CELL *) (LOCAL_start_local_copy); pt_bot = (CELL *) (LOCAL_start_local_copy);
@ -470,7 +470,7 @@ AdjustLocal(int thread_copying USES_REGS)
#endif #endif
pt = LCL0; pt = LCL0;
pt_bot = ASP; pt_bot = ASP;
#if defined(YAPOR) && defined(THREADS) #if defined(YAPOR_THREADS)
} }
#endif #endif
while (pt > pt_bot) { while (pt > pt_bot) {
@ -551,7 +551,7 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
* to clean the global now that functors are just variables pointing to * to clean the global now that functors are just variables pointing to
* the code * the code
*/ */
#if defined(YAPOR) && defined(THREADS) #if defined(YAPOR_THREADS)
if (thread_copying == STACK_INCREMENTAL_COPYING) { if (thread_copying == STACK_INCREMENTAL_COPYING) {
pt = (CELL *) (LOCAL_start_global_copy); pt = (CELL *) (LOCAL_start_global_copy);
pt_max = (CELL *) (LOCAL_end_global_copy); pt_max = (CELL *) (LOCAL_end_global_copy);
@ -559,7 +559,7 @@ AdjustGlobal(long sz, int thread_copying USES_REGS)
#endif #endif
pt = H0; pt = H0;
pt_max = (H-sz/CellSize); pt_max = (H-sz/CellSize);
#if defined(YAPOR) && defined(THREADS) #if defined(YAPOR_THREADS)
} }
#endif #endif
pt = H0; pt = H0;
@ -790,7 +790,7 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
gc_verbose = Yap_is_gc_verbose(); gc_verbose = Yap_is_gc_verbose();
heap_overflows++; heap_overflows++;
if (gc_verbose) { if (gc_verbose) {
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR_THREADS)
fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id);
#endif #endif
fprintf(Yap_stderr, "%% Database Overflow %d\n", heap_overflows); fprintf(Yap_stderr, "%% Database Overflow %d\n", heap_overflows);
@ -936,7 +936,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS)
vb_msg1 = 'D'; vb_msg1 = 'D';
vb_msg2 = "Delay"; vb_msg2 = "Delay";
} }
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR_THREADS)
fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id);
#endif #endif
fprintf(Yap_stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, delay_overflows); fprintf(Yap_stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, delay_overflows);
@ -1357,7 +1357,7 @@ growatomtable( USES_REGS1 )
} }
atom_table_overflows++; atom_table_overflows++;
if (gc_verbose) { if (gc_verbose) {
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR_THREADS)
fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id); fprintf(Yap_stderr, "%% Worker Id %d:\n", worker_id);
#endif #endif
fprintf(Yap_stderr, "%% Atom Table Overflow %d\n", atom_table_overflows); fprintf(Yap_stderr, "%% Atom Table Overflow %d\n", atom_table_overflows);
@ -1441,7 +1441,7 @@ Yap_growglobal(CELL **ptr)
CACHE_REGS CACHE_REGS
unsigned long sz = sizeof(CELL) * K16; unsigned long sz = sizeof(CELL) * K16;
#if defined(YAPOR) && !defined(THREADS) #if defined(YAPOR_THREADS)
if (Yap_number_workers != 1) { if (Yap_number_workers != 1) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running"); Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
return(FALSE); return(FALSE);
@ -1837,7 +1837,7 @@ p_inform_heap_overflows( USES_REGS1 )
return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2)); return(Yap_unify(tn, ARG1) && Yap_unify(tt, ARG2));
} }
#if defined(THREADS) && defined(YAPOR) #if defined(YAPOR_THREADS)
void void
Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental) Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental)
{ {

View File

@ -839,6 +839,7 @@ sort_group(GroupDef *grp, CELL *top, struct intermediates *cint)
base = top; base = top;
while (top+2*max > (CELL *)Yap_TrailTop) { while (top+2*max > (CELL *)Yap_TrailTop) {
if (!Yap_growtrail(2*max*CellSize, TRUE)) { if (!Yap_growtrail(2*max*CellSize, TRUE)) {
Yap_Error_Size = 2*max*CellSize;
save_machine_regs(); save_machine_regs();
siglongjmp(cint->CompilerBotch,4); siglongjmp(cint->CompilerBotch,4);
return; return;
@ -2066,6 +2067,7 @@ groups_in(ClauseDef *min, ClauseDef *max, GroupDef *grp, struct intermediates *c
siglongjmp(cint->CompilerBotch,4); siglongjmp(cint->CompilerBotch,4);
#else #else
if (!Yap_growtrail(sz, TRUE)) { if (!Yap_growtrail(sz, TRUE)) {
Yap_Error_Size = sz;
save_machine_regs(); save_machine_regs();
siglongjmp(cint->CompilerBotch,4); siglongjmp(cint->CompilerBotch,4);
return 0; return 0;
@ -2188,12 +2190,14 @@ emit_type_switch(compiler_vm_op op, struct intermediates *cint)
static yamop * static yamop *
emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_mask) emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_mask)
{ {
CACHE_REGS
PredEntry *ap = cint->CurrentPred; PredEntry *ap = cint->CurrentPred;
if (ap->PredFlags & LogUpdatePredFlag) { if (ap->PredFlags & LogUpdatePredFlag) {
UInt sz = sizeof(LogUpdIndex)+n*item_size; UInt sz = sizeof(LogUpdIndex)+n*item_size;
LogUpdIndex *cl = (LogUpdIndex *)Yap_AllocCodeSpace(sz); LogUpdIndex *cl = (LogUpdIndex *)Yap_AllocCodeSpace(sz);
if (cl == NULL) { if (cl == NULL) {
Yap_Error_Size = sz;
/* grow stack */ /* grow stack */
save_machine_regs(); save_machine_regs();
siglongjmp(cint->CompilerBotch,2); siglongjmp(cint->CompilerBotch,2);
@ -2214,6 +2218,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_
UInt sz = sizeof(StaticIndex)+n*item_size; UInt sz = sizeof(StaticIndex)+n*item_size;
StaticIndex *cl = (StaticIndex *)Yap_AllocCodeSpace(sz); StaticIndex *cl = (StaticIndex *)Yap_AllocCodeSpace(sz);
if (cl == NULL) { if (cl == NULL) {
Yap_Error_Size = sz;
/* grow stack */ /* grow stack */
save_machine_regs(); save_machine_regs();
siglongjmp(cint->CompilerBotch,2); siglongjmp(cint->CompilerBotch,2);
@ -5214,7 +5219,7 @@ kill_clause(yamop *ipc, yamop *bg, yamop *lt, path_stack_entry *sp0, PredEntry *
return sp; return sp;
} else { } else {
if ( if (
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
blk->ClRefCount == 0 blk->ClRefCount == 0
#else #else
!(blk->ClFlags & InUseMask) !(blk->ClFlags & InUseMask)
@ -6817,7 +6822,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
} }
*--ASP = MkIntegerTerm(ap->TimeStampOfPred); *--ASP = MkIntegerTerm(ap->TimeStampOfPred);
/* indicate the indexing code is being used */ /* indicate the indexing code is being used */
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
/* just store a reference */ /* just store a reference */
INC_CLREF_COUNT(cl); INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl); TRAIL_CLREF(cl);
@ -6879,7 +6884,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
} else { } else {
newpc = ipc->u.OtILl.d; newpc = ipc->u.OtILl.d;
} }
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
B->cp_tr--; B->cp_tr--;
TR--; TR--;
DEC_CLREF_COUNT(cl); DEC_CLREF_COUNT(cl);

View File

@ -163,6 +163,10 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
LOCK(Yap_heap_regs->low_level_trace_lock); LOCK(Yap_heap_regs->low_level_trace_lock);
sc = Yap_heap_regs; sc = Yap_heap_regs;
vsc_count++; vsc_count++;
if (vsc_count < 45000LL)
return;
if (vsc_count == 47456LL)
jmp_deb(1);
#ifdef THREADS #ifdef THREADS
MY_ThreadHandle.thread_inst_count++; MY_ThreadHandle.thread_inst_count++;
#endif #endif

View File

@ -146,7 +146,7 @@ copy_complex_term(CELL *pt0, CELL *pt0_end, int share, int newattvs, CELL *ptf,
f = (Functor)(*ap2); f = (Functor)(*ap2);
if (IsExtensionFunctor(f)) { if (IsExtensionFunctor(f)) {
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
if (f == FunctorDBRef) { if (f == FunctorDBRef) {
DBRef entryref = DBRefOfTerm(d0); DBRef entryref = DBRefOfTerm(d0);
if (entryref->Flags & LogUpdMask) { if (entryref->Flags & LogUpdMask) {

18
H/Yap.h
View File

@ -20,17 +20,17 @@
#error Do not explicitly define YAPOR #error Do not explicitly define YAPOR
#endif /* YAPOR */ #endif /* YAPOR */
#if (defined(YAPOR_COPY) && (defined(YAPOR_COW) || defined(YAPOR_SBA))) || (defined(YAPOR_COW) && defined(YAPOR_SBA)) #if (defined(YAPOR_COPY) && (defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS))) || (defined(YAPOR_COW) && (defined(YAPOR_SBA) || defined(YAPOR_THREADS))) || (defined(YAPOR_SBA) && defined(YAPOR_THREADS))
#error Do not define multiple or-parallel models #error Do not define multiple or-parallel models
#endif /* (YAPOR_COPY && (YAPOR_COW || YAPOR_SBA)) || (YAPOR_COW && YAPOR_SBA) */ #endif /* (YAPOR_COPY && (YAPOR_COW || YAPOR_SBA)) || (YAPOR_COW && YAPOR_SBA) */
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(THREADS) #if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS)
#define YAPOR 1 #define YAPOR 1
#endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */ #endif /* YAPOR_COPY || YAPOR_COW || YAPOR_SBA */
#if defined(TABLING) && (defined(YAPOR_COW) || defined(YAPOR_SBA)) #if defined(TABLING) && (defined(YAPOR_COW) || defined(YAPOR_SBA) || defined(YAPOR_THREADS))
#error Currently TABLING only works with YAPOR_COPY #error Currently TABLING only works with YAPOR_COPY
#endif /* TABLING && (YAPOR_COW || YAPOR_SBA) */ #endif /* TABLING && (YAPOR_COW || YAPOR_SBA || YAPOR_THREADS) */
#include "config.h" #include "config.h"
#if defined(YAPOR) || defined(TABLING) || defined(THREADS) #if defined(YAPOR) || defined(TABLING) || defined(THREADS)
@ -60,6 +60,14 @@
#endif #endif
#endif /* YAPOR */ #endif /* YAPOR */
#if defined(YAPOR) || defined(THREADS) || defined(TABLING)
#define MULTIPLE_STACKS 1
#endif
#if defined(YAPOR) || defined(THREADS)
#define PARALLEL_YAP 1
#endif
#if defined(YAPOR) || defined(TABLING) #if defined(YAPOR) || defined(TABLING)
#undef TRAILING_REQUIRES_BRANCH #undef TRAILING_REQUIRES_BRANCH
#endif /* YAPOR || TABLING */ #endif /* YAPOR || TABLING */
@ -76,7 +84,7 @@
#endif #endif
#endif #endif
#if defined(SUPPORT_THREADS) || defined(SUPPORT_CONDOR) #if defined(THREADS) || defined(SUPPORT_CONDOR)
#define USE_SYSTEM_MALLOC 1 #define USE_SYSTEM_MALLOC 1
#endif #endif

View File

@ -863,6 +863,8 @@ typedef struct DB_STRUCT
CELL Flags; /* Term Flags */ CELL Flags; /* Term Flags */
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
lockvar lock; /* a simple lock to protect this entry */ lockvar lock; /* a simple lock to protect this entry */
#endif
#if MULTIPLE_STACKS
Int ref_count; /* how many branches are using this entry */ Int ref_count; /* how many branches are using this entry */
#endif #endif
CELL NOfRefsTo; /* Number of references pointing here */ CELL NOfRefsTo; /* Number of references pointing here */
@ -880,7 +882,7 @@ typedef struct DB_STRUCT
#define DBStructFlagsToDBStruct(X) ((DBRef)((char *)(X) - (CELL) &(((DBRef) NULL)->Flags))) #define DBStructFlagsToDBStruct(X) ((DBRef)((char *)(X) - (CELL) &(((DBRef) NULL)->Flags)))
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STAACKS
#define INIT_DBREF_COUNT(X) (X)->ref_count = 0 #define INIT_DBREF_COUNT(X) (X)->ref_count = 0
#define INC_DBREF_COUNT(X) (X)->ref_count++ #define INC_DBREF_COUNT(X) (X)->ref_count++
#define DEC_DBREF_COUNT(X) (X)->ref_count-- #define DEC_DBREF_COUNT(X) (X)->ref_count--

View File

@ -267,9 +267,15 @@ Binding Macros for Multiple Assignment Variables.
#define REF_TO_TRENTRY(REF) AbsPair(((CELL *)&((REF)->Flags))) #define REF_TO_TRENTRY(REF) AbsPair(((CELL *)&((REF)->Flags)))
#define CLREF_TO_TRENTRY(REF) AbsPair(((CELL *)&((REF)->ClFlags))) #define CLREF_TO_TRENTRY(REF) AbsPair(((CELL *)&((REF)->ClFlags)))
#if FROZEN_STACKS
#define TRAIL_REF(REF) RESET_VARIABLE(&TrailVal(TR)), TrailTerm(TR++) = REF_TO_TRENTRY(REF)
#define TRAIL_CLREF(REF) RESET_VARIABLE(&TrailVal(TR)), TrailTerm(TR++) = CLREF_TO_TRENTRY(REF)
#define TRAIL_LINK(REF) RESET_VARIABLE(&TrailVal(TR)), TrailTerm(TR++) = AbsPair((CELL *)(REF))
#else
#define TRAIL_REF(REF) TrailTerm(TR++) = REF_TO_TRENTRY(REF) #define TRAIL_REF(REF) TrailTerm(TR++) = REF_TO_TRENTRY(REF)
#define TRAIL_CLREF(REF) TrailTerm(TR++) = CLREF_TO_TRENTRY(REF) #define TRAIL_CLREF(REF) TrailTerm(TR++) = CLREF_TO_TRENTRY(REF)
#define TRAIL_LINK(REF) TrailTerm(TR++) = AbsPair((CELL *)(REF)) #define TRAIL_LINK(REF) TrailTerm(TR++) = AbsPair((CELL *)(REF))
#endif
#define TRAIL_FRAME(FR) DO_TRAIL(AbsPair((CELL *)(Yap_TrailBase)), FR) #define TRAIL_FRAME(FR) DO_TRAIL(AbsPair((CELL *)(Yap_TrailBase)), FR)
extern void Yap_WakeUp(CELL *v); extern void Yap_WakeUp(CELL *v);

View File

@ -182,7 +182,7 @@ typedef struct dbterm_list {
#define DynamicLock(X) (ClauseCodeToDynamicClause(X)->ClLock) #define DynamicLock(X) (ClauseCodeToDynamicClause(X)->ClLock)
#if defined(YAPOR) || defined(THREADS) #if MULTIPLE_STACKS
#define INIT_CLREF_COUNT(X) (X)->ClRefCount = 0 #define INIT_CLREF_COUNT(X) (X)->ClRefCount = 0
#define INC_CLREF_COUNT(X) (X)->ClRefCount++ #define INC_CLREF_COUNT(X) (X)->ClRefCount++
#define DEC_CLREF_COUNT(X) (X)->ClRefCount-- #define DEC_CLREF_COUNT(X) (X)->ClRefCount--

View File

@ -83,7 +83,7 @@
int size; int size;
pt0++; pt0++;
size = TR - pt0; size = TR - pt0;
memcpy(pbase, pt0, size * sizeof(struct trail_frame)); memmove(pbase, pt0, size * sizeof(struct trail_frame));
TR = pbase + size; TR = pbase + size;
} }
} }

View File

@ -48,7 +48,6 @@
#undef HOST_ALIAS #undef HOST_ALIAS
#undef SUPPORT_CONDOR #undef SUPPORT_CONDOR
#undef SUPPORT_THREADS
#undef USE_PTHREAD_LOCKING #undef USE_PTHREAD_LOCKING
#undef HAVE_SYS_WAIT_H #undef HAVE_SYS_WAIT_H

37
configure vendored
View File

@ -1425,7 +1425,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-tabling support tabling --enable-tabling support tabling
--enable-or-parallelism support or-parallelism as: env-copy,sba,a-cow --enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads
--enable-rational-trees support infinite rational trees --enable-rational-trees support infinite rational trees
--enable-coroutining support co-routining, attributed variables and constraints --enable-coroutining support co-routining, attributed variables and constraints
--enable-depth-limit support depth-bound computation --enable-depth-limit support depth-bound computation
@ -5962,8 +5962,6 @@ fi
if test "$threads" = yes if test "$threads" = yes
then then
$as_echo "#define SUPPORT_THREADS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; } $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
@ -7488,8 +7486,30 @@ if test "$threads" = "yes"
then then
YAP_EXTRAS="$YAP_EXTRAS -D_GNU_SOURCE" YAP_EXTRAS="$YAP_EXTRAS -D_GNU_SOURCE"
fi fi
fi case "$orparallelism" in
sba)
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--or-parallelism=sba incompatible with threads
;;
a-cow
See \`config.log' for more details" "$LINENO" 5 ; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--or-parallelism=a-cow incompatible with threads
;;
copy
See \`config.log' for more details" "$LINENO" 5 ; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--or-parallelism=copy incompatible with threads
;;
yes|threads
See \`config.log' for more details" "$LINENO" 5 ; }
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
;;
esac
else
case "$orparallelism" in case "$orparallelism" in
sba) sba)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1" YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1"
@ -7497,10 +7517,15 @@ case "$orparallelism" in
a-cow) a-cow)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1" YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1"
;; ;;
yes|env-copy) threads)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
;;
yes|copy)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1" YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1"
;; ;;
esac esac
fi
if test "$cutc" = "yes" if test "$cutc" = "yes"
then then

View File

@ -60,7 +60,7 @@ AC_ARG_ENABLE(tabling,
[ --enable-tabling support tabling ], [ --enable-tabling support tabling ],
tabling="$enableval", tabling=no) tabling="$enableval", tabling=no)
AC_ARG_ENABLE(or-parallelism, AC_ARG_ENABLE(or-parallelism,
[ --enable-or-parallelism support or-parallelism as: env-copy,sba,a-cow ], [ --enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads ],
orparallelism="$enableval", orparallelism=no) orparallelism="$enableval", orparallelism=no)
AC_ARG_ENABLE(rational-trees, AC_ARG_ENABLE(rational-trees,
[ --enable-rational-trees support infinite rational trees ], [ --enable-rational-trees support infinite rational trees ],
@ -733,7 +733,6 @@ fi
if test "$threads" = yes if test "$threads" = yes
then then
AC_DEFINE(SUPPORT_THREADS, 1)
AC_CHECK_LIB(pthread,pthread_create) AC_CHECK_LIB(pthread,pthread_create)
AC_CHECK_HEADERS(pthread.h) AC_CHECK_HEADERS(pthread.h)
AC_CHECK_FUNCS(pthread_mutexattr_setkind_np pthread_mutexattr_settype) AC_CHECK_FUNCS(pthread_mutexattr_setkind_np pthread_mutexattr_settype)
@ -1272,8 +1271,24 @@ if test "$threads" = "yes"
then then
YAP_EXTRAS="$YAP_EXTRAS -D_GNU_SOURCE" YAP_EXTRAS="$YAP_EXTRAS -D_GNU_SOURCE"
fi fi
fi case "$orparallelism" in
sba)
AC_MSG_FAILURE(
[--or-parallelism=sba incompatible with threads]
;;
a-cow)
AC_MSG_FAILURE(
[--or-parallelism=a-cow incompatible with threads]
;;
copy)
AC_MSG_FAILURE(
[--or-parallelism=copy incompatible with threads]
;;
yes|threads)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
;;
esac
else
case "$orparallelism" in case "$orparallelism" in
sba) sba)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1" YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_SBA=1"
@ -1281,10 +1296,15 @@ case "$orparallelism" in
a-cow) a-cow)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1" YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COW=1"
;; ;;
yes|env-copy) threads)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1"
;;
yes|copy)
YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1" YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_COPY=1"
;; ;;
esac esac
fi
if test "$cutc" = "yes" if test "$cutc" = "yes"
then then

View File

@ -149,7 +149,7 @@ struct PL_local_data *Yap_ld_ PL_local_data_p =Yap_InitThreadIO(wid)
struct open_query_struct* _execution execution =NULL struct open_query_struct* _execution execution =NULL
// Ricardo's stuff // Ricardo's stuff
#if (defined(YAPOR) || defined(TABLING)) && defined(THREADS) #if MULTIPLE_STACKS
struct worker worker WORKER void struct worker worker WORKER void
#endif #endif

@ -1 +0,0 @@
Subproject commit c9d945820be9d1a9d6bc3e216721668f6b311feb