diff --git a/C/cdmgr.c b/C/cdmgr.c index c521f21b0..41e6c309e 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -432,14 +432,14 @@ kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap) LOCK(c->ClLock); ncl = c->ChildIndex; } - c->ClRefCount--; + UNLOCK(c->ClLock); /* check if we are still the main index */ if (parent == NULL && ap->cs.p_code.TrueCodeOfPred == c->ClCode) { RemoveMainIndex(ap); } - /* decrease refs */ - decrease_log_indices(c, (yamop *)&(ap->cs.p_code.ExpandCode)); + LOCK(c->ClLock); + c->ClRefCount--; #ifdef DEBUG { LogUpdIndex *parent = DBErasedIList, *c0 = NULL; @@ -456,6 +456,8 @@ kill_first_log_iblock(LogUpdIndex *c, LogUpdIndex *parent, PredEntry *ap) if (!((c->ClFlags & InUseMask) || c->ClRefCount)) { if (parent != NULL) { /* sat bye bye */ + /* decrease refs */ + decrease_log_indices(c, (yamop *)&(ap->cs.p_code.ExpandCode)); LOCK(parent->ClLock); parent->ClRefCount--; if (parent->ClFlags & ErasedMask && diff --git a/C/dbase.c b/C/dbase.c index 684296605..9810fffbb 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -3854,7 +3854,6 @@ EraseLogUpdCl(LogUpdClause *clau) ap = clau->ClPred; /* no need to erase what has been erased */ if (!(clau->ClFlags & ErasedMask)) { - /* get ourselves out of the list */ if (clau->ClNext != NULL) { LOCK(clau->ClNext->ClLock); @@ -3881,9 +3880,9 @@ EraseLogUpdCl(LogUpdClause *clau) ap->cs.p_code.LastClause = clau->ClPrev->ClCode; } } - clau->ClFlags |= ErasedMask; ap->cs.p_code.NOfClauses--; WRITE_UNLOCK(ap->PRWLock); + clau->ClFlags |= ErasedMask; #ifdef DEBUG { LogUpdClause *er_head = DBErasedList; diff --git a/C/index.c b/C/index.c index 613fb151f..197cc4873 100644 --- a/C/index.c +++ b/C/index.c @@ -4274,6 +4274,9 @@ Yap_ExpandIndex(PredEntry *ap) { static path_stack_entry * push_path(path_stack_entry *sp, yamop **pipc, ClauseDef *clp) { + if (Yap_Option['i' - 'a' + 1]) { + printf("+ %p=>%p\n",sp,sp+1); + } sp->flag = pc_entry; sp->u.pce.pi_pc = pipc; sp->u.pce.code = clp->Code; @@ -4352,6 +4355,9 @@ pop_path(path_stack_entry **spp, ClauseDef *clp, PredEntry *ap) path_stack_entry *sp = *spp; yamop *nipc; + if (Yap_Option['i' - 'a' + 1]) { + printf("- %p-->",sp+1); + } while ((--sp)->flag != pc_entry); *spp = sp; clp->Code = sp->u.pce.code; @@ -4360,10 +4366,16 @@ pop_path(path_stack_entry **spp, ClauseDef *clp, PredEntry *ap) clp->Tag = sp->u.pce.tag; if (sp->u.pce.pi_pc == NULL) { *spp = sp; + if (Yap_Option['i' - 'a' + 1]) { + printf("%p\n", sp); + } return NULL; } nipc = *(sp->u.pce.pi_pc); *spp = cross_block(sp, sp->u.pce.pi_pc, ap); + if (Yap_Option['i' - 'a' + 1]) { + printf("%p\n",*spp); + } return nipc; } diff --git a/C/tracer.c b/C/tracer.c index 0acc31a75..9aaa282e1 100644 --- a/C/tracer.c +++ b/C/tracer.c @@ -116,11 +116,9 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) LOCK(heap_regs->low_level_trace_lock); vsc_count++; - if (vsc_count == 213471) vsc_xstop = 1; - if (vsc_count < 1200000) { - UNLOCK(heap_regs->low_level_trace_lock); - return; - } + if (vsc_count == 52404) vsc_xstop = 1; + UNLOCK(heap_regs->low_level_trace_lock); + return; #ifdef COMMENTED // if (vsc_count == 218280) // vsc_xstop = 1;