fix non-tabling version
fix compilation with THREADS git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@952 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
221665bab8
commit
e7ab7b4c8a
18
C/absmi.c
18
C/absmi.c
@ -1129,7 +1129,7 @@ Yap_absmi(int inp)
|
|||||||
/* clear the entry from the trail */
|
/* clear the entry from the trail */
|
||||||
TR = --(B->cp_tr);
|
TR = --(B->cp_tr);
|
||||||
/* actually get rid of the code */
|
/* actually get rid of the code */
|
||||||
if (cl->ref_count == 0 && cl->ClFlags & ErasedMask) {
|
if (cl->ClRefCount == 0 && cl->ClFlags & ErasedMask) {
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
/* I am the last one using this clause, hence I don't need a lock
|
/* I am the last one using this clause, hence I don't need a lock
|
||||||
to dispose of it
|
to dispose of it
|
||||||
@ -1208,7 +1208,6 @@ Yap_absmi(int inp)
|
|||||||
setregs();
|
setregs();
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
/* always add an extra reference */
|
/* always add an extra reference */
|
||||||
INC_CLREF_COUNT(cl);
|
INC_CLREF_COUNT(cl);
|
||||||
@ -1253,7 +1252,6 @@ 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 defined(YAPOR) || defined(THREADS)
|
||||||
|
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
/* always add an extra reference */
|
/* always add an extra reference */
|
||||||
INC_CLREF_COUNT(cl);
|
INC_CLREF_COUNT(cl);
|
||||||
@ -1619,7 +1617,7 @@ Yap_absmi(int inp)
|
|||||||
int erase;
|
int erase;
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
DEC_CLREF_COUNT(cl);
|
DEC_CLREF_COUNT(cl);
|
||||||
erase = (cl->ClFlags & ErasedMask) && (cl->ref_count == 0);
|
erase = (cl->ClFlags & ErasedMask) && !(cl->ClRefCount);
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
if (erase) {
|
if (erase) {
|
||||||
saveregs();
|
saveregs();
|
||||||
@ -1628,12 +1626,13 @@ Yap_absmi(int inp)
|
|||||||
hence we don't need to have a lock it */
|
hence we don't need to have a lock it */
|
||||||
Yap_ErLogUpdCl(cl);
|
Yap_ErLogUpdCl(cl);
|
||||||
setregs();
|
setregs();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DynamicClause *cl = ClauseFlagsToDynamicClause(pt1);
|
DynamicClause *cl = ClauseFlagsToDynamicClause(pt1);
|
||||||
int erase;
|
int erase;
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
DEC_CLREF_COUNT(cl);
|
DEC_CLREF_COUNT(cl);
|
||||||
erase = (cl->ClFlags & ErasedMask) && (cl->ref_count == 0);
|
erase = (cl->ClFlags & ErasedMask) && !(cl->ClRefCount);
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
if (erase) {
|
if (erase) {
|
||||||
saveregs();
|
saveregs();
|
||||||
@ -6359,17 +6358,10 @@ Yap_absmi(int inp)
|
|||||||
we do not lock access to the predicate,
|
we do not lock access to the predicate,
|
||||||
we must take extra care here
|
we must take extra care here
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
Ideally, this code should only be executed by
|
|
||||||
dynamic procedures in YAPOR. Unfortunately, it also seems
|
|
||||||
to be executed when
|
|
||||||
running a procedure from within the file that defines it.
|
|
||||||
*/
|
|
||||||
/* THIS SHOULD BE AN ERROR !!!!! */
|
|
||||||
if (PredFromDefCode(PREG)->OpcodeOfPred != INDEX_OPCODE) {
|
if (PredFromDefCode(PREG)->OpcodeOfPred != INDEX_OPCODE) {
|
||||||
/* someone was here before we were */
|
/* someone was here before we were */
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,"Bad locking");
|
Yap_Error(SYSTEM_ERROR,TermNil,"Bad locking");
|
||||||
PREG = FAILCODE;
|
PREG = PredFromDefCode(PREG)->CodeOfPred;
|
||||||
WRITE_UNLOCK(PredFromDefCode(PREG)->PRWLock);
|
WRITE_UNLOCK(PredFromDefCode(PREG)->PRWLock);
|
||||||
JMPNext();
|
JMPNext();
|
||||||
}
|
}
|
||||||
|
@ -2067,8 +2067,8 @@ do_pass(void)
|
|||||||
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 defined(YAPOR) || defined(THREADS)
|
||||||
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
|
||||||
}
|
}
|
||||||
code_p = cl_u->luc.ClCode;
|
code_p = cl_u->luc.ClCode;
|
||||||
@ -2080,8 +2080,8 @@ do_pass(void)
|
|||||||
}
|
}
|
||||||
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);
|
||||||
INIT_CLREF_COUNT(cl_u.ic);
|
INIT_CLREF_COUNT(&(cl_u->ic));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
code_p = cl_u->ic.ClCode;
|
code_p = cl_u->ic.ClCode;
|
||||||
|
@ -3049,10 +3049,10 @@ 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(OR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
TRAIL_CLREF(cl); /* So that fail will erase it */
|
TRAIL_CLREF(cl); /* So that fail will erase it */
|
||||||
INC_DBREF_COUNT(cl);
|
INC_CLREF_COUNT(cl);
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
#else
|
#else
|
||||||
if (!(cl->ClFlags & InUseMask)) {
|
if (!(cl->ClFlags & InUseMask)) {
|
||||||
@ -3325,7 +3325,7 @@ p_nth_clause(void)
|
|||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
TRAIL_CLREF(cl); /* So that fail will erase it */
|
TRAIL_CLREF(cl); /* So that fail will erase it */
|
||||||
INC_DBREF_COUNT(cl);
|
INC_CLREF_COUNT(cl);
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
#else
|
#else
|
||||||
if (!(cl->ClFlags & InUseMask)) {
|
if (!(cl->ClFlags & InUseMask)) {
|
||||||
|
@ -2606,7 +2606,7 @@ new_lu_entry(Term t)
|
|||||||
WRITE_LOCK(RepAtom(at)->ARWLock);
|
WRITE_LOCK(RepAtom(at)->ARWLock);
|
||||||
p0 = Yap_NewPredPropByAtom(at,2);
|
p0 = Yap_NewPredPropByAtom(at,2);
|
||||||
} else {
|
} else {
|
||||||
WRITE_LOCK(f->FRWLock);
|
WRITE_LOCK(FunctorList->FRWLock);
|
||||||
p0 = Yap_NewPredPropByFunctor(FunctorList,2);
|
p0 = Yap_NewPredPropByFunctor(FunctorList,2);
|
||||||
}
|
}
|
||||||
pe = RepPredProp(p0);
|
pe = RepPredProp(p0);
|
||||||
@ -3729,7 +3729,7 @@ find_next_clause(DBRef ref0)
|
|||||||
|
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
TRAIL_CLREF(cl);
|
TRAIL_CLREF(cl);
|
||||||
INC_DBREF_COUNT(cl);
|
INC_CLREF_COUNT(cl);
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
2
C/exec.c
2
C/exec.c
@ -156,7 +156,7 @@ CallClause(PredEntry *pen, Int position)
|
|||||||
|
|
||||||
LOCK(cl->ClLock);
|
LOCK(cl->ClLock);
|
||||||
TRAIL_CLREF(cl);
|
TRAIL_CLREF(cl);
|
||||||
INC_DBREF_COUNT(cl);
|
INC_CLREF_COUNT(cl);
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -1949,7 +1949,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
indx->ClFlags &= ~InUseMask;
|
indx->ClFlags &= ~InUseMask;
|
||||||
erase = (indx->ClFlags & ErasedMask)
|
erase = (indx->ClFlags & ErasedMask)
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
&& (indx->ref_count == 0)
|
&& (indx->ClRefCount == 0)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
if (erase) {
|
if (erase) {
|
||||||
@ -1964,7 +1964,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
cl->ClFlags &= ~InUseMask;
|
cl->ClFlags &= ~InUseMask;
|
||||||
erase = (cl->ClFlags & ErasedMask)
|
erase = (cl->ClFlags & ErasedMask)
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
&& (cl->ref_count == 0)
|
&& (cl->ClRefCount == 0)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
if (erase) {
|
if (erase) {
|
||||||
@ -1980,7 +1980,7 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
cl->ClFlags &= ~InUseMask;
|
cl->ClFlags &= ~InUseMask;
|
||||||
erase = (cl->ClFlags & ErasedMask)
|
erase = (cl->ClFlags & ErasedMask)
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
&& (cl->ref_count == 0)
|
&& (cl->ClRefCount == 0)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
if (erase) {
|
if (erase) {
|
||||||
|
@ -2351,10 +2351,13 @@ emit_optry(int var_group, int first, int clauses, int clleft, PredEntry *ap)
|
|||||||
return trust_op;
|
return trust_op;
|
||||||
}
|
}
|
||||||
} else if (clleft == 0) {
|
} else if (clleft == 0) {
|
||||||
|
#ifdef TABLING
|
||||||
if (ap->PredFlags & TabledPredFlag && !first) {
|
if (ap->PredFlags & TabledPredFlag && !first) {
|
||||||
/* we never actually get to remove the last choice-point in this case */
|
/* we never actually get to remove the last choice-point in this case */
|
||||||
return retry_op;
|
return retry_op;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
/* last group */
|
/* last group */
|
||||||
return try_op;
|
return try_op;
|
||||||
}
|
}
|
||||||
@ -2862,6 +2865,7 @@ emit_protection_choicepoint(int first, int clleft, UInt nxtlbl, PredEntry *ap)
|
|||||||
/* !first */
|
/* !first */
|
||||||
if (clleft) {
|
if (clleft) {
|
||||||
Yap_emit(retryme_op, nxtlbl, (clleft << 1));
|
Yap_emit(retryme_op, nxtlbl, (clleft << 1));
|
||||||
|
#ifdef TABLING
|
||||||
} else if ((ap->PredFlags & TabledPredFlag)) {
|
} else if ((ap->PredFlags & TabledPredFlag)) {
|
||||||
/*
|
/*
|
||||||
we cannot get rid of the choice-point for tabled predicates, all
|
we cannot get rid of the choice-point for tabled predicates, all
|
||||||
@ -2870,6 +2874,7 @@ emit_protection_choicepoint(int first, int clleft, UInt nxtlbl, PredEntry *ap)
|
|||||||
*/
|
*/
|
||||||
Yap_emit(retryme_op, (CELL)TRUSTFAILCODE, 0);
|
Yap_emit(retryme_op, (CELL)TRUSTFAILCODE, 0);
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
Yap_emit(trustme_op, 0, 0);
|
Yap_emit(trustme_op, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6203,7 +6208,7 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term t1, Term tb, Term tr, yam
|
|||||||
/* clear the entry from the trail */
|
/* clear the entry from the trail */
|
||||||
TR = --(B->cp_tr);
|
TR = --(B->cp_tr);
|
||||||
/* actually get rid of the code */
|
/* actually get rid of the code */
|
||||||
if (cl->ref_count == 0 && cl->ClFlags & ErasedMask) {
|
if (cl->ClRefCount == 0 && cl->ClFlags & ErasedMask) {
|
||||||
UNLOCK(cl->ClLock);
|
UNLOCK(cl->ClLock);
|
||||||
/* I am the last one using this clause, hence I don't need a lock
|
/* I am the last one using this clause, hence I don't need a lock
|
||||||
to dispose of it
|
to dispose of it
|
||||||
|
2
C/init.c
2
C/init.c
@ -1105,7 +1105,7 @@ Yap_InitStacks(int Heap,
|
|||||||
#endif /* PUSH_REGS */
|
#endif /* PUSH_REGS */
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
regp->worker_id_ = 0;
|
Yap_regp->worker_id_ = 0;
|
||||||
#endif
|
#endif
|
||||||
/* Init signal handling and time */
|
/* Init signal handling and time */
|
||||||
/* also init memory page size, required by later functions */
|
/* also init memory page size, required by later functions */
|
||||||
|
Reference in New Issue
Block a user