fix locking for YapOr
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@173 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
a543874856
commit
418fb0680a
@ -274,7 +274,6 @@ UnlockedFunctorGetPredProp(Functor f, Term cur_mod)
|
||||
while (p0 && (/* p->KindOfPE != PEProp || only preds in here */
|
||||
(p->ModuleOfPred != cur_mod && p->ModuleOfPred)))
|
||||
p = RepPredProp(p0 = p->NextOfPE);
|
||||
READ_UNLOCK(fe->FRWLock);
|
||||
return (p0);
|
||||
}
|
||||
|
||||
@ -322,8 +321,8 @@ GetPredProp(Atom ap, unsigned int arity)
|
||||
return(GetPredPropByAtom(ap, *CurrentModulePtr));
|
||||
WRITE_LOCK(ae->ARWLock);
|
||||
f = InlinedUnlockedMkFunctor(ae, arity);
|
||||
WRITE_UNLOCK(ae->FRWLock);
|
||||
READ_LOCK(f->ARWLock);
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
READ_LOCK(f->FRWLock);
|
||||
p0 = UnlockedFunctorGetPredProp(f, *CurrentModulePtr);
|
||||
READ_UNLOCK(f->FRWLock);
|
||||
return (p0);
|
||||
@ -335,7 +334,7 @@ GetPredPropByFunc(Functor f, Term t)
|
||||
{
|
||||
Prop p0;
|
||||
|
||||
READ_LOCK(f->ARWLock);
|
||||
READ_LOCK(f->FRWLock);
|
||||
p0 = UnlockedFunctorGetPredProp(f, t);
|
||||
READ_UNLOCK(f->FRWLock);
|
||||
return (p0);
|
||||
@ -353,7 +352,7 @@ GetPredPropHavingLock(Atom ap, unsigned int arity)
|
||||
GetPredPropByAtomHavingLock(ae, *CurrentModulePtr);
|
||||
}
|
||||
f = InlinedUnlockedMkFunctor(ae, arity);
|
||||
READ_LOCK(f->ARWLock);
|
||||
READ_LOCK(f->FRWLock);
|
||||
p0 = UnlockedFunctorGetPredProp(f, *CurrentModulePtr);
|
||||
READ_UNLOCK(f->FRWLock);
|
||||
return (p0);
|
||||
|
@ -754,7 +754,6 @@ p_create_static_array(void)
|
||||
|
||||
WRITE_LOCK(ae->ARWLock);
|
||||
pp = RepStaticArrayProp(ae->PropsOfAE);
|
||||
WRITE_LOCK(pp->ArRWLock);
|
||||
while (!EndOfPAEntr(pp) && pp->KindOfPE != ArrayProperty)
|
||||
pp = RepStaticArrayProp(pp->NextOfPE);
|
||||
if (EndOfPAEntr(pp) || pp->ValueOfVE.ints == NULL) {
|
||||
|
@ -677,7 +677,7 @@ YapInit(yap_init_args *yap_init)
|
||||
InitYaamRegs();
|
||||
#endif
|
||||
/* slaves, waiting for work */
|
||||
CurrentModule = 1;
|
||||
*CurrentModulePtr = MkIntTerm(1);
|
||||
P = GETWORK_FIRST_TIME;
|
||||
exec_absmi(FALSE);
|
||||
abort_optyap("abstract machine unexpected exit");
|
||||
|
@ -1367,7 +1367,7 @@ p_find_dynamic(void)
|
||||
{
|
||||
Clause *cl = ClauseCodeToClause(q);
|
||||
LOCK(cl->ClLock);
|
||||
TRAIL_CLREF(cl->ClFlags);
|
||||
TRAIL_CLREF(cl);
|
||||
INC_CLREF_COUNT(cl);
|
||||
UNLOCK(cl->ClLock);
|
||||
}
|
||||
|
@ -3034,7 +3034,7 @@ find_next_clause(DBRef ref0)
|
||||
Clause *cl = ClauseCodeToClause(newp);
|
||||
|
||||
LOCK(cl->ClLock);
|
||||
TRAIL_CLREF(cl));
|
||||
TRAIL_CLREF(cl);
|
||||
INC_DBREF_COUNT(cl);
|
||||
UNLOCK(cl->ClLock);
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ unsigned int gc_calls = 0; /* number of times GC has been called */
|
||||
|
||||
static Int tot_gc_time = 0; /* total time spent in GC */
|
||||
|
||||
static Int tot_gc_recovered = 0; /* number of heap objects in all garbage collections */
|
||||
|
||||
/* in a single gc */
|
||||
UInt total_marked; /* number of heap objects marked */
|
||||
|
||||
@ -77,8 +79,6 @@ STATIC_PROTO(choiceptr update_B_H, (choiceptr, CELL *, CELL *, CELL *));
|
||||
STATIC_PROTO(void compact_heap, (void));
|
||||
STATIC_PROTO(void update_relocation_chain, (CELL *, CELL *));
|
||||
|
||||
static Int tot_gc_recovered = 0; /* number of heap objects in all garbage collections */
|
||||
|
||||
#include "heapgc.h"
|
||||
|
||||
static int discard_trail_entries = 0;
|
||||
|
4
C/init.c
4
C/init.c
@ -722,7 +722,7 @@ InitFlags(void)
|
||||
yap_flags[SOURCE_MODE_FLAG] = FALSE;
|
||||
yap_flags[CHARACTER_ESCAPE_FLAG] = ISO_CHARACTER_ESCAPES;
|
||||
yap_flags[WRITE_QUOTED_STRING_FLAG] = FALSE;
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
#if (defined(YAPOR) || defined(THREADS)) && VSC_FOR_YAPOR
|
||||
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = FALSE;
|
||||
#else
|
||||
yap_flags[ALLOW_ASSERTING_STATIC_FLAG] = TRUE;
|
||||
@ -809,7 +809,7 @@ InitCodes(void)
|
||||
heap_regs->clausecode.clause = NIL;
|
||||
heap_regs->clausecode.func = NIL;
|
||||
|
||||
heap_regs->invisiblechain.Entry = 0;
|
||||
heap_regs->invisiblechain.Entry = NIL;
|
||||
INIT_RWLOCK(heap_regs->invisiblechain.AERWLock);
|
||||
|
||||
heap_regs->consultlow = (consult_obj *)AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
|
||||
|
@ -1659,9 +1659,9 @@ p_hidden(void)
|
||||
return (FALSE);
|
||||
READ_LOCK(INVISIBLECHAIN.AERWLock);
|
||||
chain = RepAtom(INVISIBLECHAIN.Entry);
|
||||
READ_LOCK(INVISIBLECHAIN.AERWLock);
|
||||
while (!EndOfPAEntr(chain) && AbsAtom(chain) != at)
|
||||
chain = RepAtom(chain->NextOfAE);
|
||||
READ_UNLOCK(INVISIBLECHAIN.AERWLock);
|
||||
if (EndOfPAEntr(chain))
|
||||
return (FALSE);
|
||||
return (TRUE);
|
||||
|
@ -15,7 +15,6 @@
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
%
|
||||
% This one should come first so that disjunctions and long distance
|
||||
% cuts are compiled right with co-routining.
|
||||
%
|
||||
|
@ -86,7 +86,7 @@ consult(Fs) :-
|
||||
'$consult'(Fs).
|
||||
|
||||
reconsult(Fs) :-
|
||||
'$has_yap_or',
|
||||
'$has_yap_or', fail,
|
||||
throw(error(context_error(reconsult(Fs),clause),query)).
|
||||
reconsult(Fs) :-
|
||||
'$reconsult'(Fs).
|
||||
|
Reference in New Issue
Block a user