don't leave dangling pointers to switch tables, as they can be removed

easily.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@913 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-10-31 00:20:52 +00:00
parent 009452e075
commit a23c409540
4 changed files with 10 additions and 2 deletions

View File

@ -2099,7 +2099,7 @@ do_pass(void)
/* index code */ /* index code */
if (log_update) { if (log_update) {
if (pass_no) { if (pass_no) {
cl_u->lui.ClFlags = LogUpdMask|IndexedPredFlag|IndexMask; cl_u->lui.ClFlags = LogUpdMask|IndexedPredFlag|IndexMask|SwitchRootMask;
cl_u->lui.ChildIndex = NULL; cl_u->lui.ChildIndex = NULL;
cl_u->lui.SiblingIndex = NULL; cl_u->lui.SiblingIndex = NULL;
cl_u->lui.u.pred = CurrentPred; cl_u->lui.u.pred = CurrentPred;

View File

@ -423,6 +423,13 @@ kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *cl, PredEntry *ap)
Yap_FreeCodeSpace((CODEADDR)c); Yap_FreeCodeSpace((CODEADDR)c);
} else { } else {
c->ClFlags |= ErasedMask; c->ClFlags |= ErasedMask;
/* try to move up, so that we don't hold an index */
if (cl != NULL &&
cl->ClFlags & SwitchTableMask) {
c->u.ParentIndex = cl->u.ParentIndex;
cl->u.ParentIndex->ClRefCount++;
cl->ClRefCount--;
}
c->ChildIndex = NULL; c->ChildIndex = NULL;
} }
} }

View File

@ -4140,6 +4140,7 @@ ExpandIndex(PredEntry *ap) {
/* insert myself in the indexing code chain */ /* insert myself in the indexing code chain */
nic->SiblingIndex = ic->ChildIndex; nic->SiblingIndex = ic->ChildIndex;
nic->u.ParentIndex = ic; nic->u.ParentIndex = ic;
nic->ClFlags &= ~SwitchRootMask;
ic->ChildIndex = nic; ic->ChildIndex = nic;
ic->ClRefCount++; ic->ClRefCount++;
} else { } else {

View File

@ -102,7 +102,7 @@ check_trail_consistency(void) {
*/ */
static int vsc_xstop = FALSE; static int vsc_xstop = FALSE;
void void
low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)