bad ref counting with trust_log/threads

This commit is contained in:
Vitor Santos Costa 2012-10-17 17:23:47 +01:00
parent 474c088baf
commit 3917a19ab9

View File

@ -6300,9 +6300,9 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
newpc = ipc->u.OtILl.d;
}
#if MULTIPLE_STACKS
DEC_CLREF_COUNT(cl);
B->cp_tr--;
TR--;
DEC_CLREF_COUNT(cl);
/* actually get rid of the code */
if (cl->ClRefCount == 0 && cl->ClFlags & (ErasedMask|DirtyMask)) {
/* I am the last one using this clause, hence I don't need a lock
@ -6311,22 +6311,19 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y
*/
LogUpdClause *lcl = ipc->u.OtILl.d;
if (newpc) {
/* I am the last one using this clause, hence I don't need a lock
to dispose of it
*/
/* make sure the clause isn't destroyed */
/* always add an extra reference */
INC_CLREF_COUNT(lcl);
TRAIL_CLREF(lcl);
if (lcl->ClRefCount == 1) {
/* make sure the clause isn't destroyed */
/* always add an extra reference */
INC_CLREF_COUNT(lcl);
TRAIL_CLREF(lcl);
B->cp_tr = TR;
}
}
if (cl->ClFlags & ErasedMask) {
Yap_ErLogUpdIndex(cl);
} else {
Yap_CleanUpIndex(cl);
}
if (newpc) {
DEC_CLREF_COUNT(lcl);
}
}
#else
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) &&