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