From c90c3b7b349dd7449aefc3e69a593c242d6ba9cb Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 26 Feb 2004 13:37:24 +0000 Subject: [PATCH] thread support updates git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1006 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/absmi.c | 5 +---- C/cdmgr.c | 8 ++------ C/dbase.c | 1 + C/exec.c | 11 ++++------- C/tracer.c | 1 + 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 34892283e..8074bd799 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -1083,6 +1083,7 @@ Yap_absmi(int inp) READ_LOCK(PP->PRWLock); if (PP->cs.p_code.TrueCodeOfPred != PREG) { PREG = PP->cs.p_code.TrueCodeOfPred; + PP = NULL; READ_UNLOCK(PP->PRWLock); GONext(); } @@ -6377,10 +6378,6 @@ Yap_absmi(int inp) #endif saveregs(); pt0 = Yap_ExpandIndex(pe); - if (PP == NULL) { - READ_UNLOCK(pe->PRWLock); - PP = pe; - } /* restart index */ setregs(); UNLOCK(pe->PELock); diff --git a/C/cdmgr.c b/C/cdmgr.c index 776006a3a..0b990c938 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -3146,8 +3146,8 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya #endif #if defined(YAPOR) || defined(THREADS) if (PP == pe) { - PP = NULL; READ_UNLOCK(pe->PRWLock); + PP = NULL; } #endif #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[E_CB] = (CELL) B; } - READ_LOCK(pe->PRWLock); P = cl->ClCode; - READ_UNLOCK(pe->PRWLock); } return TRUE; } 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); #if defined(YAPOR) || defined(THREADS) if (PP == pe) { - PP = NULL; READ_UNLOCK(pe->PRWLock); + PP = NULL; } #endif 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[E_CB] = (CELL) B; } - READ_LOCK(pe->PRWLock); P = cl->ClCode; - READ_UNLOCK(pe->PRWLock); } return TRUE; } else { diff --git a/C/dbase.c b/C/dbase.c index 8e8d0a603..530dfe889 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -3280,6 +3280,7 @@ c_recorded(int flags) static Int lu_recorded(PredEntry *pe) { op_numbers opc = Yap_op_from_opcode(P->opc); + if (opc == _procceed) { P = pe->CodeOfPred; } else { diff --git a/C/exec.c b/C/exec.c index cf40d569a..7f4843615 100644 --- a/C/exec.c +++ b/C/exec.c @@ -1349,16 +1349,13 @@ Yap_RunTopGoal(Term t) return(FALSE); } ppe = RepPredProp(pe); - if (pe != NIL) { - READ_LOCK(ppe->PRWLock); - } else if (pe == NIL) { + if (pe == NIL) { /* we must always start the emulator with Prolog code */ - return(FALSE); + return FALSE; } + READ_LOCK(ppe->PRWLock); CodeAdr = ppe->CodeOfPred; - if (pe != NIL) { - READ_UNLOCK(ppe->PRWLock); - } + READ_UNLOCK(ppe->PRWLock); if (Yap_TrailTop - HeapTop < 2048) { Yap_PrologMode = BootMode; Yap_Error(SYSTEM_ERROR,TermNil, diff --git a/C/tracer.c b/C/tracer.c index dc72e17b0..b3c579ecf 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -293,3 +293,4 @@ Yap_InitLowLevelTrace(void) #endif +