From 9d64f1d2d1732cc38325d350fb0adbbe1c8d61bd Mon Sep 17 00:00:00 2001 From: vsc Date: Tue, 14 Oct 2003 13:10:26 +0000 Subject: [PATCH] get rid of ClUse in logupdindices git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@895 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/absmi.c | 8 +++----- C/alloc.c | 6 +----- C/amasm.c | 2 -- C/index.c | 9 +++------ H/clause.h | 1 - 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 84ceff789..dc586d83d 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -1103,7 +1103,6 @@ Yap_absmi(int inp) if (!(cl->ClFlags & InUseMask)) { cl->ClFlags |= InUseMask; TRAIL_CLREF(cl); - cl->ClUse = TR-(tr_fr_ptr)(Yap_TrailBase); } #endif UNLOCK(cl->ClLock); @@ -1135,11 +1134,10 @@ Yap_absmi(int inp) UNLOCK(cl->ClLock); } #else - if (cl->ClUse == TR-(tr_fr_ptr)(Yap_TrailBase)) { - cl->ClUse = 0; + if (B->cp_tr[-1] == CLREF_TO_TRENTRY(cl) && + B->cp_tr > B->cp_b->cp_tr) { cl->ClFlags &= ~InUseMask; - /* clear the entry from the trail */ - TR = --(B->cp_tr); + TR = --B->cp_tr; /* next, recover space for the indexing code if it was erased */ if (cl->ClFlags & ErasedMask) { Yap_RemoveLogUpdIndex(cl); diff --git a/C/alloc.c b/C/alloc.c index 879cd7472..ab71de2e7 100644 --- a/C/alloc.c +++ b/C/alloc.c @@ -12,7 +12,7 @@ * Last rev: * * mods: * * comments: allocating space * -* version:$Id: alloc.c,v 1.34 2003-10-14 00:53:10 vsc Exp $ * +* version:$Id: alloc.c,v 1.35 2003-10-14 13:10:26 vsc Exp $ * *************************************************************************/ #ifdef SCCS static char SccsId[] = "%W% %G%"; @@ -375,10 +375,6 @@ AllocCodeSpace(unsigned int size) char * Yap_AllocCodeSpace(unsigned int size) { - if (size == 768) { - printf("vsc: Here I go\n"); - } - return AllocCodeSpace(size); } diff --git a/C/amasm.c b/C/amasm.c index 97940001f..5f8f86a53 100644 --- a/C/amasm.c +++ b/C/amasm.c @@ -1119,7 +1119,6 @@ init_log_upd_table(LogUpdIndex *ic, union clause_obj *cl_u) ic->SiblingIndex = cl_u->lui.ChildIndex; ic->ChildIndex = NULL; ic->ClRefCount = 0; - ic->ClUse = 0L; ic->u.ParentIndex = (LogUpdIndex *)cl_u; cl_u->lui.ChildIndex = ic; cl_u->lui.ClRefCount++; @@ -2083,7 +2082,6 @@ do_pass(void) cl_u->lui.ChildIndex = NULL; cl_u->lui.SiblingIndex = NULL; cl_u->lui.u.pred = CurrentPred; - cl_u->lui.ClUse = 0; cl_u->lui.ClRefCount = 0; } code_p = cl_u->lui.ClCode; diff --git a/C/index.c b/C/index.c index 76b006800..7972b55a9 100644 --- a/C/index.c +++ b/C/index.c @@ -4307,7 +4307,6 @@ replace_index_block(ClauseUnion *parent_block, yamop *cod, yamop *ncod, PredEntr *c = parent_block->lui.ChildIndex; ncl->SiblingIndex = cl->SiblingIndex; ncl->ClRefCount = cl->ClRefCount; - ncl->ClUse = 0L; ncl->ChildIndex = cl->ChildIndex; ncl->u.ParentIndex = cl->u.ParentIndex; if (c == cl) { @@ -4696,7 +4695,6 @@ replace_lu_block(LogUpdIndex *blk, int flag, PredEntry *ap, yamop *code, int has return NULL; ncl->ClFlags = LogUpdMask|IndexedPredFlag|IndexMask; ncl->ClRefCount = 0; - ncl->ClUse = 0; ncl->u.ParentIndex = blk->u.ParentIndex; ncl->ChildIndex = NULL; codep = start = ncl->ClCode; @@ -6091,8 +6089,8 @@ Yap_follow_lu_indexing_code(PredEntry *ap, yamop *ipc, Term t1, Term tb, Term tr UNLOCK(cl->ClLock); } #else - if (cl->ClUse == TR-(tr_fr_ptr)(Yap_TrailBase)) { - cl->ClUse = 0; + if (B->cp_tr[-1] == CLREF_TO_TRENTRY(cl) && + B->cp_tr > B->cp_b->cp_tr) { cl->ClFlags &= ~InUseMask; /* clear the entry from the trail */ TR = --(B->cp_tr); @@ -6121,8 +6119,7 @@ Yap_follow_lu_indexing_code(PredEntry *ap, yamop *ipc, Term t1, Term tb, Term tr if (!(cl->ClFlags & InUseMask)) { cl->ClFlags |= InUseMask; TRAIL_CLREF(cl); - cl->ClUse = TR-(tr_fr_ptr)(Yap_TrailBase); - } + } #endif UNLOCK(cl->ClLock); } diff --git a/H/clause.h b/H/clause.h index be42ecbde..9d6ef945d 100644 --- a/H/clause.h +++ b/H/clause.h @@ -45,7 +45,6 @@ typedef struct logic_upd_index { /* A lock for manipulating the clause */ lockvar ClLock; #endif - UInt ClUse; union { PredEntry *pred; struct logic_upd_index *ParentIndex;