avoid self-locking in garbage collector.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2060 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
42c88eddff
commit
82508f287b
30
C/heapgc.c
30
C/heapgc.c
@ -2405,7 +2405,15 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
if (flags & IndexMask) {
|
if (flags & IndexMask) {
|
||||||
LogUpdIndex *indx = ClauseFlagsToLogUpdIndex(pt0);
|
LogUpdIndex *indx = ClauseFlagsToLogUpdIndex(pt0);
|
||||||
int erase;
|
int erase;
|
||||||
LOCK(indx->ClPred->PELock);
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
/*
|
||||||
|
gc may be called when executing a dynamic goal,
|
||||||
|
check PP to avoid deadlock
|
||||||
|
*/
|
||||||
|
PredEntry *ap = cl->ClPred;
|
||||||
|
if (ap != PP)
|
||||||
|
LOCK(ap->PELock);
|
||||||
|
#endif
|
||||||
DEC_CLREF_COUNT(indx);
|
DEC_CLREF_COUNT(indx);
|
||||||
indx->ClFlags &= ~InUseMask;
|
indx->ClFlags &= ~InUseMask;
|
||||||
erase = (indx->ClFlags & ErasedMask
|
erase = (indx->ClFlags & ErasedMask
|
||||||
@ -2415,12 +2423,21 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
no one is accessing the clause */
|
no one is accessing the clause */
|
||||||
Yap_ErLogUpdIndex(indx);
|
Yap_ErLogUpdIndex(indx);
|
||||||
}
|
}
|
||||||
UNLOCK(indx->ClPred->PELock);
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
if (ap != PP)
|
||||||
|
UNLOCK(ap->PELock);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
LogUpdClause *cl = ClauseFlagsToLogUpdClause(pt0);
|
LogUpdClause *cl = ClauseFlagsToLogUpdClause(pt0);
|
||||||
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
PredEntry *ap = cl->ClPred;
|
||||||
|
#endif
|
||||||
int erase;
|
int erase;
|
||||||
|
|
||||||
LOCK(cl->ClPred->PELock);
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
if (ap != PP)
|
||||||
|
LOCK(ap->PELock);
|
||||||
|
#endif
|
||||||
DEC_CLREF_COUNT(cl);
|
DEC_CLREF_COUNT(cl);
|
||||||
cl->ClFlags &= ~InUseMask;
|
cl->ClFlags &= ~InUseMask;
|
||||||
erase = ((cl->ClFlags & ErasedMask) && !cl->ClRefCount);
|
erase = ((cl->ClFlags & ErasedMask) && !cl->ClRefCount);
|
||||||
@ -2429,7 +2446,10 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR)
|
|||||||
no one is accessing the clause */
|
no one is accessing the clause */
|
||||||
Yap_ErLogUpdCl(cl);
|
Yap_ErLogUpdCl(cl);
|
||||||
}
|
}
|
||||||
UNLOCK(cl->ClPred->PELock);
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
|
if (ap != PP)
|
||||||
|
UNLOCK(ap->PELock);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DynamicClause *cl = ClauseFlagsToDynamicClause(pt0);
|
DynamicClause *cl = ClauseFlagsToDynamicClause(pt0);
|
||||||
@ -3867,8 +3887,6 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop)
|
|||||||
/* expand the stack if effectiveness is less than 20 % */
|
/* expand the stack if effectiveness is less than 20 % */
|
||||||
if (ASP - H < gc_margin/sizeof(CELL) ||
|
if (ASP - H < gc_margin/sizeof(CELL) ||
|
||||||
effectiveness < 20) {
|
effectiveness < 20) {
|
||||||
UInt sz;
|
|
||||||
|
|
||||||
LeaveGCMode();
|
LeaveGCMode();
|
||||||
return Yap_growstack(gc_margin);
|
return Yap_growstack(gc_margin);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<h2>Yap-5.1.3:</h2>
|
<h2>Yap-5.1.3:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> FIXED: do not access erased code (obs from Paulo Moura).</li>
|
||||||
<li> FIXED: clause/3 should not follow fail.</li>
|
<li> FIXED: clause/3 should not follow fail.</li>
|
||||||
<li> FIXED: make sure we don't ask for 0-sized blocks, minimal 64K.</li>
|
<li> FIXED: make sure we don't ask for 0-sized blocks, minimal 64K.</li>
|
||||||
<li> FIXED: Aux reallocation should always increase aux size.</li>
|
<li> FIXED: Aux reallocation should always increase aux size.</li>
|
||||||
|
Reference in New Issue
Block a user