thread support updates

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1006 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-02-26 13:37:24 +00:00
parent 58e306b815
commit c90c3b7b34
5 changed files with 9 additions and 17 deletions

View File

@ -1083,6 +1083,7 @@ Yap_absmi(int inp)
READ_LOCK(PP->PRWLock); READ_LOCK(PP->PRWLock);
if (PP->cs.p_code.TrueCodeOfPred != PREG) { if (PP->cs.p_code.TrueCodeOfPred != PREG) {
PREG = PP->cs.p_code.TrueCodeOfPred; PREG = PP->cs.p_code.TrueCodeOfPred;
PP = NULL;
READ_UNLOCK(PP->PRWLock); READ_UNLOCK(PP->PRWLock);
GONext(); GONext();
} }
@ -6377,10 +6378,6 @@ Yap_absmi(int inp)
#endif #endif
saveregs(); saveregs();
pt0 = Yap_ExpandIndex(pe); pt0 = Yap_ExpandIndex(pe);
if (PP == NULL) {
READ_UNLOCK(pe->PRWLock);
PP = pe;
}
/* restart index */ /* restart index */
setregs(); setregs();
UNLOCK(pe->PELock); UNLOCK(pe->PELock);

View File

@ -3146,8 +3146,8 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
#endif #endif
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
if (PP == pe) { if (PP == pe) {
PP = NULL;
READ_UNLOCK(pe->PRWLock); READ_UNLOCK(pe->PRWLock);
PP = NULL;
} }
#endif #endif
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
@ -3172,9 +3172,7 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
YENV = ASP; YENV = ASP;
YENV[E_CB] = (CELL) B; YENV[E_CB] = (CELL) B;
} }
READ_LOCK(pe->PRWLock);
P = cl->ClCode; P = cl->ClCode;
READ_UNLOCK(pe->PRWLock);
} }
return TRUE; return TRUE;
} else { } else {
@ -3242,8 +3240,8 @@ fetch_next_lu_clause0(PredEntry *pe, yamop *i_code, Term th, Term tb, yamop *cp_
cl = Yap_FollowIndexingCode(pe, i_code, th, tb, TermNil, NEXTOP(PredLogUpdClause0->CodeOfPred,ld), cp_ptr); cl = Yap_FollowIndexingCode(pe, i_code, th, tb, TermNil, NEXTOP(PredLogUpdClause0->CodeOfPred,ld), cp_ptr);
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
if (PP == pe) { if (PP == pe) {
PP = NULL;
READ_UNLOCK(pe->PRWLock); READ_UNLOCK(pe->PRWLock);
PP = NULL;
} }
#endif #endif
if (cl == NULL) { if (cl == NULL) {
@ -3267,9 +3265,7 @@ fetch_next_lu_clause0(PredEntry *pe, yamop *i_code, Term th, Term tb, yamop *cp_
YENV = ASP; YENV = ASP;
YENV[E_CB] = (CELL) B; YENV[E_CB] = (CELL) B;
} }
READ_LOCK(pe->PRWLock);
P = cl->ClCode; P = cl->ClCode;
READ_UNLOCK(pe->PRWLock);
} }
return TRUE; return TRUE;
} else { } else {

View File

@ -3280,6 +3280,7 @@ c_recorded(int flags)
static Int static Int
lu_recorded(PredEntry *pe) { lu_recorded(PredEntry *pe) {
op_numbers opc = Yap_op_from_opcode(P->opc); op_numbers opc = Yap_op_from_opcode(P->opc);
if (opc == _procceed) { if (opc == _procceed) {
P = pe->CodeOfPred; P = pe->CodeOfPred;
} else { } else {

View File

@ -1349,16 +1349,13 @@ Yap_RunTopGoal(Term t)
return(FALSE); return(FALSE);
} }
ppe = RepPredProp(pe); ppe = RepPredProp(pe);
if (pe != NIL) { if (pe == NIL) {
READ_LOCK(ppe->PRWLock);
} else if (pe == NIL) {
/* we must always start the emulator with Prolog code */ /* we must always start the emulator with Prolog code */
return(FALSE); return FALSE;
} }
READ_LOCK(ppe->PRWLock);
CodeAdr = ppe->CodeOfPred; CodeAdr = ppe->CodeOfPred;
if (pe != NIL) { READ_UNLOCK(ppe->PRWLock);
READ_UNLOCK(ppe->PRWLock);
}
if (Yap_TrailTop - HeapTop < 2048) { if (Yap_TrailTop - HeapTop < 2048) {
Yap_PrologMode = BootMode; Yap_PrologMode = BootMode;
Yap_Error(SYSTEM_ERROR,TermNil, Yap_Error(SYSTEM_ERROR,TermNil,

View File

@ -293,3 +293,4 @@ Yap_InitLowLevelTrace(void)
#endif #endif