should not use PP for thread private

more lock tracing aids.
This commit is contained in:
Vitor Santos Costa 2010-07-28 11:26:20 +01:00
parent 431ceadc50
commit ccb7991a56
3 changed files with 96 additions and 89 deletions

View File

@ -1502,7 +1502,7 @@ Yap_absmi(int inp)
/* lock logical updates predicate. */
Op(unlock_lu, e);
#if defined(YAPOR) || defined(THREADS)
UNLOCK(PP->PELock);
UNLOCKPE(1,PP);
PP = NULL;
#endif
PREG = NEXTOP(PREG, e);
@ -1523,7 +1523,7 @@ Yap_absmi(int inp)
/* always add an extra reference */
INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl);
UNLOCK(ap->PELock);
UNLOCKPE(2,ap);
PP = NULL;
}
#else
@ -1555,7 +1555,7 @@ Yap_absmi(int inp)
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
UNLOCK(PP->PELock);
UNLOCKPE(3,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
@ -1565,7 +1565,7 @@ Yap_absmi(int inp)
} else {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gc(3, ENV, CP)) {
UNLOCK(PP->PELock);
UNLOCKPE(4,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
@ -1576,7 +1576,7 @@ Yap_absmi(int inp)
}
if (!Yap_IUnify(ARG2, t)) {
setregs();
UNLOCK(PP->PELock);
UNLOCKPE(5,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
@ -1584,7 +1584,7 @@ Yap_absmi(int inp)
}
if (!Yap_IUnify(ARG3, MkDBRefTerm((DBRef)cl))) {
setregs();
UNLOCK(PP->PELock);
UNLOCKPE(6,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
@ -1596,7 +1596,7 @@ Yap_absmi(int inp)
/* always add an extra reference */
INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl);
UNLOCK(PP->PELock);
UNLOCKPE(7,PP);
PP = NULL;
#else
if (!(cl->ClFlags & InUseMask)) {
@ -1626,7 +1626,7 @@ Yap_absmi(int inp)
saveregs();
if (!Yap_IUnify(ARG2, cl->ClSource->Entry)) {
setregs();
UNLOCK(PP->PELock);
UNLOCKPE(8,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
@ -1634,7 +1634,7 @@ Yap_absmi(int inp)
}
if (!Yap_IUnify(ARG3, MkDBRefTerm((DBRef)cl))) {
setregs();
UNLOCK(PP->PELock);
UNLOCKPE(9,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
@ -1648,7 +1648,7 @@ Yap_absmi(int inp)
/* always add an extra reference */
INC_CLREF_COUNT(cl);
TRAIL_CLREF(cl);
UNLOCK(PP->PELock);
UNLOCKPE(10,PP);
PP = NULL;
#else
if (!(cl->ClFlags & InUseMask)) {
@ -1678,7 +1678,7 @@ Yap_absmi(int inp)
BOp(spy_or_trymark, Otapl);
PELOCK(5, ((PredEntry *)(PREG->u.Otapl.p)));
PREG = (yamop *)(&(((PredEntry *)(PREG->u.Otapl.p))->OpcodeOfPred));
UNLOCK(((PredEntry *)(PREG->u.Otapl.p))->PELock);
UNLOCKPE(11,(PredEntry *)(PREG->u.Otapl.p));
goto dospy;
ENDBOp();
@ -1700,7 +1700,7 @@ Yap_absmi(int inp)
anything yet */
PP = NULL;
PREG = PREG->u.Otapl.p->CodeOfPred;
UNLOCK(PREG->u.Otapl.p->PELock);
UNLOCKPE(12,PREG->u.Otapl.p);
/* for profiler */
save_pc();
JMPNext();
@ -1714,7 +1714,7 @@ Yap_absmi(int inp)
*/
LOCK(DynamicLock(PREG));
/* one can now mess around with the predicate */
UNLOCK(((PredEntry *)(PREG->u.Otapl.p))->PELock);
UNLOCKPE(13,((PredEntry *)(PREG->u.Otapl.p)));
BEGD(d1);
d1 = PREG->u.Otapl.s;
store_args(d1);
@ -7881,7 +7881,7 @@ Yap_absmi(int inp)
#if defined(YAPOR) || defined(THREADS)
if (!PP)
#endif
UNLOCK(ap->PELock);
UNLOCKPE(14,ap);
}
JMPNext();
@ -7917,7 +7917,7 @@ Yap_absmi(int inp)
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
if (!PP) {
UNLOCK(pe->PELock);
UNLOCKPE(15,pe);
}
JMPNext();
}
@ -7959,7 +7959,7 @@ Yap_absmi(int inp)
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
if (!PP) {
UNLOCK(pe->PELock);
UNLOCKPE(16,pe);
}
JMPNext();
}
@ -7968,11 +7968,11 @@ Yap_absmi(int inp)
pt0 = Yap_ExpandIndex(pe, 0);
/* restart index */
setregs();
UNLOCK(pe->PELock);
UNLOCKPE(17,pe);
PREG = pt0;
#if defined(YAPOR) || defined(THREADS)
if (!PP) {
UNLOCK(pe->PELock);
UNLOCKPE(18,pe);
}
#endif
JMPNext();
@ -7990,11 +7990,11 @@ Yap_absmi(int inp)
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
UNLOCK(pe->PELock);
UNLOCKPE(19,pe);
FAIL();
}
d0 = pe->ArityOfPE;
UNLOCK(pe->PELock);
UNLOCKPE(19,pe);
if (d0 == 0) {
H[1] = MkAtomTerm((Atom)(pe->FunctorOfPred));
}
@ -8073,7 +8073,7 @@ Yap_absmi(int inp)
UNLOCK(pe->StatisticsForPred.lock);
ReductionsCounter--;
if (ReductionsCounter == 0 && ReductionsCounterOn) {
UNLOCK(pe->PELock);
UNLOCKPE(20,pe);
saveregs();
Yap_Error(CALL_COUNTER_UNDERFLOW,TermNil,"");
setregs();
@ -8081,7 +8081,7 @@ Yap_absmi(int inp)
}
PredEntriesCounter--;
if (PredEntriesCounter == 0 && PredEntriesCounterOn) {
UNLOCK(pe->PELock);
UNLOCKPE(21,pe);
saveregs();
Yap_Error(PRED_ENTRY_COUNTER_UNDERFLOW,TermNil,"");
setregs();
@ -8090,7 +8090,7 @@ Yap_absmi(int inp)
if ((pe->PredFlags & (CountPredFlag|ProfiledPredFlag|SpiedPredFlag)) ==
CountPredFlag) {
PREG = pe->cs.p_code.TrueCodeOfPred;
UNLOCK(pe->PELock);
UNLOCKPE(22,pe);
JMPNext();
}
}
@ -8101,16 +8101,16 @@ Yap_absmi(int inp)
UNLOCK(pe->StatisticsForPred.lock);
if (!(pe->PredFlags & SpiedPredFlag)) {
PREG = pe->cs.p_code.TrueCodeOfPred;
UNLOCK(pe->PELock);
UNLOCKPE(23,pe);
JMPNext();
}
}
if (!DebugOn) {
PREG = pe->cs.p_code.TrueCodeOfPred;
UNLOCK(pe->PELock);
UNLOCKPE(24,pe);
JMPNext();
}
UNLOCK(pe->PELock);
UNLOCKPE(25,pe);
d0 = pe->ArityOfPE;
/* save S for ModuleName */
@ -8582,7 +8582,7 @@ Yap_absmi(int inp)
ENDCACHE_Y();
#if defined(YAPOR) || defined(THREADS)
if (PREG == FAILCODE) {
UNLOCK(PP->PELock);
UNLOCKPE(26,PP);
PP = NULL;
}
#endif

129
C/cdmgr.c
View File

@ -2119,7 +2119,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
(p->ModuleOfPred == PROLOG_MODULE &&
mod != TermProlog && mod) ) {
addcl_permission_error(RepAtom(at), Arity, FALSE);
UNLOCK(p->PELock);
UNLOCKPE(30,p);
return TermNil;
}
/* we are redefining a prolog module predicate */
@ -2195,7 +2195,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
not_was_reconsulted(p, t, TRUE);
/* always check if we have a valid error first */
if (Yap_ErrorMessage && Yap_Error_TYPE == PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE) {
UNLOCK(p->PELock);
UNLOCKPE(31,p);
return TermNil;
}
if (pflags & UDIPredFlag) {
@ -2263,7 +2263,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
}
#endif
}
UNLOCK(p->PELock);
UNLOCKPE(32,p);
if (pflags & LogUpdatePredFlag) {
LogUpdClause *cl = (LogUpdClause *)ClauseCodeToLogUpdClause(cp);
tf = MkDBRefTerm((DBRef)cl);
@ -2733,12 +2733,12 @@ p_purge_clauses(void)
return (FALSE);
PELOCK(21,pred);
if (pred->PredFlags & StandardPredFlag) {
UNLOCK(pred->PELock);
UNLOCKPE(33,pred);
Yap_Error(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, t, "assert/1");
return (FALSE);
}
purge_clauses(pred);
UNLOCK(pred->PELock);
UNLOCKPE(34,pred);
return (TRUE);
}
@ -2777,12 +2777,12 @@ p_setspy(void)
PELOCK(22,pred);
restart_spy:
if (pred->PredFlags & (CPredFlag | SafePredFlag)) {
UNLOCK(pred->PELock);
UNLOCKPE(35,pred);
return FALSE;
}
if (pred->OpcodeOfPred == UNDEF_OPCODE ||
pred->OpcodeOfPred == FAIL_OPCODE) {
UNLOCK(pred->PELock);
UNLOCKPE(36,pred);
return FALSE;
}
if (pred->OpcodeOfPred == INDEX_OPCODE) {
@ -2803,7 +2803,7 @@ p_setspy(void)
pred->CodeOfPred = (yamop *)(&(pred->OpcodeOfPred));
}
pred->PredFlags |= SpiedPredFlag;
UNLOCK(pred->PELock);
UNLOCKPE(37,pred);
return TRUE;
}
@ -2831,14 +2831,14 @@ p_rmspy(void)
return FALSE;
PELOCK(23,pred);
if (!(pred->PredFlags & SpiedPredFlag)) {
UNLOCK(pred->PELock);
UNLOCKPE(38,pred);
return FALSE;
}
#if THREADS
if (!(pred->PredFlags & ThreadLocalPredFlag)) {
pred->OpcodeOfPred = Yap_opcode(_thread_local);
pred->PredFlags ^= SpiedPredFlag;
UNLOCK(pred->PELock);
UNLOCKPE(39,pred);
return TRUE;
}
#endif
@ -2859,12 +2859,12 @@ p_rmspy(void)
} else if (pred->OpcodeOfPred == Yap_opcode(_spy_or_trymark)) {
pred->OpcodeOfPred = Yap_opcode(_try_and_mark);
} else {
UNLOCK(pred->PELock);
UNLOCKPE(39,pred);
return FALSE;
}
}
pred->PredFlags ^= SpiedPredFlag;
UNLOCK(pred->PELock);
UNLOCKPE(40,pred);
return (TRUE);
}
@ -2899,7 +2899,7 @@ p_number_of_clauses(void)
return FALSE;
PELOCK(24,RepPredProp(pe));
ncl = RepPredProp(pe)->cs.p_code.NOfClauses;
UNLOCK(RepPredProp(pe)->PELock);
UNLOCKPE(41,RepPredProp(pe));
return (Yap_unify_constant(ARG3, MkIntegerTerm(ncl)));
}
@ -2914,7 +2914,7 @@ p_in_use(void)
return FALSE;
PELOCK(25,pe);
out = static_in_use(pe,TRUE);
UNLOCK(pe->PELock);
UNLOCKPE(42,pe);
return(out);
}
@ -2952,7 +2952,7 @@ p_new_multifile(void)
/* static */
pe->PredFlags |= (SourcePredFlag|CompiledPredFlag);
}
UNLOCK(pe->PELock);
UNLOCKPE(43,pe);
return (TRUE);
}
@ -2968,7 +2968,7 @@ p_is_multifile(void)
return FALSE;
PELOCK(27,pe);
out = (pe->PredFlags & MultiFileFlag);
UNLOCK(pe->PELock);
UNLOCKPE(44,pe);
return(out);
}
@ -2981,9 +2981,9 @@ p_is_log_updatable(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_log_updatable");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(27,pe);
out = (pe->PredFlags & LogUpdatePredFlag);
UNLOCK(pe->PELock);
UNLOCKPE(45,pe);
return(out);
}
@ -2996,9 +2996,9 @@ p_is_source(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_source");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(28,pe);
out = (pe->PredFlags & SourcePredFlag);
UNLOCK(pe->PELock);
UNLOCKPE(46,pe);
return(out);
}
@ -3011,17 +3011,17 @@ p_owner_file(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_source");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(29,pe);
if (pe->ModuleOfPred == IDB_MODULE) {
UNLOCK(pe->PELock);
UNLOCKPE(47,pe);
return FALSE;
}
if (pe->PredFlags & MultiFileFlag) {
UNLOCK(pe->PELock);
UNLOCKPE(48,pe);
return FALSE;
}
owner = pe->src.OwnerFile;
UNLOCK(pe->PELock);
UNLOCKPE(49,pe);
return Yap_unify(ARG3, MkAtomTerm(owner));
}
@ -3033,11 +3033,11 @@ p_mk_d(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_source");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(30,pe);
if (pe->OpcodeOfPred == UNDEF_OPCODE) {
pe->OpcodeOfPred = FAIL_OPCODE;
}
UNLOCK(pe->PELock);
UNLOCKPE(50,pe);
return TRUE;
}
@ -3050,9 +3050,9 @@ p_is_dynamic(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_dynamic");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(31,pe);
out = (pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag));
UNLOCK(pe->PELock);
UNLOCKPE(51,pe);
return(out);
}
@ -3065,9 +3065,9 @@ p_is_metapredicate(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_meta");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(32,pe);
out = (pe->PredFlags & MetaPredFlag);
UNLOCK(pe->PELock);
UNLOCKPE(52,pe);
return out;
}
@ -3128,9 +3128,9 @@ p_is_expandgoalormetapredicate(void)
return FALSE;
}
LOCK(pe->PELock);
PELOCK(33,pe);
out = (pe->PredFlags & (GoalExPredFlag|MetaPredFlag));
UNLOCK(pe->PELock);
UNLOCKPE(53,pe);
return(out);
}
@ -3143,13 +3143,13 @@ p_pred_exists(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "$exists");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(34,pe);
if (pe->PredFlags & HiddenPredFlag){
UNLOCK(pe->PELock);
UNLOCKPE(54,pe);
return FALSE;
}
out = (pe->OpcodeOfPred != UNDEF_OPCODE);
UNLOCK(pe->PELock);
UNLOCKPE(55,pe);
return out;
}
@ -3161,9 +3161,9 @@ p_set_pred_module(void)
pe = get_pred(Deref(ARG1), CurrentModule, "set_pred_module/1");
if (EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(35,pe);
pe->ModuleOfPred = Deref(ARG2);
UNLOCK(pe->PELock);
UNLOCKPE(56,pe);
return(TRUE);
}
@ -3175,16 +3175,16 @@ p_undefined(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "undefined/1");
if (EndOfPAEntr(pe))
return TRUE;
LOCK(pe->PELock);
PELOCK(36,pe);
if (pe->PredFlags & (CPredFlag|UserCPredFlag|TestPredFlag|AsmPredFlag|DynamicPredFlag|LogUpdatePredFlag)) {
UNLOCK(pe->PELock);
UNLOCKPE(57,pe);
return FALSE;
}
if (pe->OpcodeOfPred == UNDEF_OPCODE) {
UNLOCK(pe->PELock);
UNLOCKPE(58,pe);
return TRUE;
}
UNLOCK(pe->PELock);
UNLOCKPE(59,pe);
return FALSE;
}
@ -3201,20 +3201,20 @@ p_kill_dynamic(void)
pe = get_pred(Deref(ARG1), Deref(ARG2), "kill_dynamic/1");
if (EndOfPAEntr(pe))
return TRUE;
LOCK(pe->PELock);
PELOCK(37,pe);
if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
UNLOCK(pe->PELock);
UNLOCKPE(60,pe);
return FALSE;
}
if (pe->cs.p_code.LastClause != pe->cs.p_code.FirstClause) {
UNLOCK(pe->PELock);
UNLOCKPE(61,pe);
return (FALSE);
}
pe->cs.p_code.LastClause = pe->cs.p_code.FirstClause = NULL;
pe->OpcodeOfPred = UNDEF_OPCODE;
pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = (yamop *)(&(pe->OpcodeOfPred));
pe->PredFlags = pe->PredFlags & GoalExPredFlag;
UNLOCK(pe->PELock);
UNLOCKPE(62,pe);
return (TRUE);
}
@ -3317,7 +3317,7 @@ search_for_static_predicate_in_use(PredEntry *p, int check_everything)
if (pe == p) {
if (check_everything)
return TRUE;
LOCK(pe->PELock);
PELOCK(38,p);
if (p->PredFlags & IndexedPredFlag) {
yamop *code_p = b_ptr->cp_ap;
yamop *code_beg = p->cs.p_code.TrueCodeOfPred;
@ -3340,7 +3340,7 @@ search_for_static_predicate_in_use(PredEntry *p, int check_everything)
}
}
}
UNLOCK(pe->PELock);
UNLOCKPE(63,pe);
}
env_ptr = b_ptr->cp_env;
b_ptr = b_ptr->cp_b;
@ -3353,7 +3353,7 @@ mark_pred(int mark, PredEntry *pe)
{
/* if the predicate is static mark it */
if (pe->ModuleOfPred) {
LOCK(pe->PELock);
PELOCK(39,p);
if (mark) {
pe->PredFlags |= InUsePredFlag;
} else {
@ -3746,7 +3746,7 @@ static int
cl_code_in_pred(PredEntry *pp, yamop *codeptr, CODEADDR *startp, CODEADDR *endp) {
Int out;
LOCK(pp->PELock);
PELOCK(39,pp);
/* check if the codeptr comes from the indexing code */
if (pp->PredFlags & IndexedPredFlag) {
if (pp->PredFlags & LogUpdatePredFlag) {
@ -3786,7 +3786,7 @@ static Int
code_in_pred(PredEntry *pp, Atom *pat, UInt *parity, yamop *codeptr) {
Int out;
LOCK(pp->PELock);
PELOCK(40,pp);
/* check if the codeptr comes from the indexing code */
if (pp->PredFlags & IndexedPredFlag) {
if (pp->PredFlags & LogUpdatePredFlag) {
@ -4535,7 +4535,12 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
}
P = cl->ClCode;
#if defined(YAPOR) || defined(THREADS)
PP = pe;
if (pe->PredFlags & ThreadLocalPredFlag) {
/* we don't actually need to execute code */
UNLOCK(pe->PELock);
} else {
PP = pe;
}
#endif
} else {
/* we don't actually need to execute code */
@ -4597,6 +4602,8 @@ p_log_update_clause(void)
Int ret;
yamop *new_cp;
if (vscx==444)
jmp_deb(1);
if (P->opc == EXECUTE_CPRED_OP_CODE) {
new_cp = CP;
} else {
@ -4605,7 +4612,7 @@ p_log_update_clause(void)
pe = get_pred(t1, Deref(ARG2), "clause/3");
if (pe == NULL || EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(41,pe);
ret = fetch_next_lu_clause(pe, pe->CodeOfPred, t1, ARG3, ARG4, new_cp, TRUE);
return ret;
}
@ -4616,7 +4623,7 @@ p_continue_log_update_clause(void)
PredEntry *pe = (PredEntry *)IntegerOfTerm(Deref(ARG1));
yamop *ipc = (yamop *)IntegerOfTerm(ARG2);
LOCK(pe->PELock);
PELOCK(42,pe);
return fetch_next_lu_clause(pe, ipc, Deref(ARG3), ARG4, ARG5, B->cp_cp, FALSE);
}
@ -4750,7 +4757,7 @@ p_log_update_clause_erase(void)
pe = get_pred(t1, Deref(ARG2), "clause/3");
if (pe == NULL || EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(43,pe);
ret = fetch_next_lu_clause_erase(pe, pe->CodeOfPred, t1, ARG3, ARG4, new_cp, TRUE);
return ret;
}
@ -4761,7 +4768,7 @@ p_continue_log_update_clause_erase(void)
PredEntry *pe = (PredEntry *)IntegerOfTerm(Deref(ARG1));
yamop *ipc = (yamop *)IntegerOfTerm(ARG2);
LOCK(pe->PELock);
PELOCK(44,pe);
return fetch_next_lu_clause_erase(pe, ipc, Deref(ARG3), ARG4, ARG5, B->cp_cp, FALSE);
}
@ -4946,7 +4953,7 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
Terms[1] = tb;
Terms[2] = tr;
cl = (StaticClause *)Yap_FollowIndexingCode(pe, i_code, Terms, NEXTOP(PredStaticClause->CodeOfPred,Otapl), cp_ptr);
UNLOCK(pe->PELock);
PELOCK(45,pe);
th = Deref(Terms[0]);
tb = Deref(Terms[1]);
tr = Deref(Terms[2]);
@ -5081,7 +5088,7 @@ p_static_clause(void)
pe = get_pred(t1, Deref(ARG2), "clause/3");
if (pe == NULL || EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(46,pe);
return fetch_next_static_clause(pe, pe->CodeOfPred, ARG1, ARG3, ARG4, new_cp, TRUE);
}
@ -5100,7 +5107,7 @@ p_nth_clause(void)
pe = get_pred(t1, Deref(ARG2), "clause/3");
if (pe == NULL || EndOfPAEntr(pe))
return FALSE;
LOCK(pe->PELock);
PELOCK(47,pe);
if (!(pe->PredFlags & (SourcePredFlag|LogUpdatePredFlag))) {
return FALSE;
}
@ -5149,7 +5156,7 @@ p_continue_static_clause(void)
PredEntry *pe = (PredEntry *)IntegerOfTerm(Deref(ARG1));
yamop *ipc = (yamop *)IntegerOfTerm(ARG2);
LOCK(pe->PELock);
PELOCK(48,pe);
return fetch_next_static_clause(pe, ipc, Deref(ARG3), ARG4, ARG5, B->cp_ap, FALSE);
}
@ -5159,7 +5166,7 @@ static void
add_code_in_pred(PredEntry *pp) {
yamop *clcode;
LOCK(pp->PELock);
PELOCK(49,pp);
/* check if the codeptr comes from the indexing code */
/* highly likely this is used for indexing */
@ -5308,7 +5315,7 @@ p_static_pred_statistics(void)
pe = get_pred( Deref(ARG1), Deref(ARG2), "predicate_statistics");
if (pe == NIL)
return (FALSE);
LOCK(pe->PELock);
PELOCK(50,pe);
if (pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag|UserCPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) {
/* should use '$recordedp' in this case */
UNLOCK(pe->PELock);

View File

@ -1522,7 +1522,7 @@ PredPropByAtom (Atom at, Term cur_mod)
#if DEBUG_PELOCKING
#define PELOCK(I,Z) \
{ LOCK((Z)->PELock); (Z)->StatisticsForPred.NOfEntries=(I),(Z)->StatisticsForPred.NOfHeadSuccesses=pthread_self(); }
{ LOCK((Z)->PELock); (Z)->StatisticsForPred.NOfEntries=(I);(Z)->StatisticsForPred.NOfHeadSuccesses=pthread_self(); }
#define UNLOCKPE(I,Z) \
( (Z)->StatisticsForPred.NOfRetries=(I), UNLOCK((Z)->PELock) )
#else