diff --git a/C/dbase.c b/C/dbase.c index fd133db71..d50f7dcf1 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -4358,14 +4358,6 @@ EraseEntry(DBRef entryref) entryref->Flags |= ErasedMask; /* update FirstNEr */ p = entryref->Parent; - if (p->KindOfPE & LogUpdDBBit) { - LogUpdDBProp lup = (LogUpdDBProp)p; - lup->NOfEntries--; - if (lup->Index != NULL) { - clean_lu_index(lup->Index); - lup->Index = NULL; - } - } /* exit the db chain */ if (entryref->Next != NIL) { entryref->Next->Prev = entryref->Prev; @@ -4381,11 +4373,7 @@ EraseEntry(DBRef entryref) if (!DBREF_IN_USE(entryref)) { ErDBE(entryref); } else if ((entryref->Flags & DBCode) && entryref->Code) { - if (p->KindOfPE & LogUpdDBBit) { - PrepareToEraseLogUpdClause(ClauseCodeToLogUpdClause(entryref->Code), entryref); - } else { - PrepareToEraseClause(ClauseCodeToDynamicClause(entryref->Code), entryref); - } + PrepareToEraseClause(ClauseCodeToDynamicClause(entryref->Code), entryref); } } @@ -4465,14 +4453,6 @@ p_eraseall(void) return(TRUE); } WRITE_LOCK(p->DBRWLock); - if (p->KindOfPE & LogUpdDBBit) { - LogUpdDBProp lup = (LogUpdDBProp)p; - lup->NOfEntries = 0; - if (lup->Index != NULL) { - clean_lu_index(lup->Index); - lup->Index = NULL; - } - } entryref = FrstDBRef(p); do { DBRef next_entryref; diff --git a/C/heapgc.c b/C/heapgc.c index e0715435f..048702633 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -1230,11 +1230,10 @@ mark_variable(CELL_PTR current) if (ONCODE(next)) { if ((Functor)cnext == FunctorDBRef) { DBRef tref = DBRefOfTerm(ccur); + /* make sure the reference is marked as in use */ - if ((tref->Flags & ErasedMask) && - tref->Parent != NULL && - tref->Parent->KindOfPE & LogUpdDBBit) { - *current = MkDBRefTerm(DBErasedMarker); + if ((tref->Flags & (ErasedMask|LogUpdMask)) == (ErasedMask|LogUpdMask)) { + *current = MkDBRefTerm((DBRef)LogDBErasedMarker); MARK(current); } else { mark_ref_in_use(tref); @@ -1350,10 +1349,8 @@ mark_code(CELL_PTR ptr, CELL *next) if (IsApplTerm(reg) && (Functor)(*next) == FunctorDBRef) { DBRef tref = DBRefOfTerm(reg); /* make sure the reference is marked as in use */ - if ((tref->Flags & ErasedMask) && - tref->Parent != NULL && - tref->Parent->KindOfPE & LogUpdDBBit) { - *ptr = MkDBRefTerm(DBErasedMarker); + if ((tref->Flags & (LogUpdMask|ErasedMask)) == (LogUpdMask|ErasedMask)) { + *ptr = MkDBRefTerm((DBRef)LogDBErasedMarker); } else { mark_ref_in_use(tref); } diff --git a/C/init.c b/C/init.c index 4fb21ec79..8f21ee858 100644 --- a/C/init.c +++ b/C/init.c @@ -1218,8 +1218,20 @@ InitCodes(void) Yap_heap_regs->db_erased_marker->Code = NULL; Yap_heap_regs->db_erased_marker->DBT.DBRefs = NULL; Yap_heap_regs->db_erased_marker->Parent = NULL; - INIT_LOCK(Yap_heap_regs->db_erased_marker->lock); - INIT_DBREF_COUNT(Yap_heap_regs->db_erased_marker); + Yap_heap_regs->logdb_erased_marker = + (LogUpdClause *)Yap_AllocCodeSpace(sizeof(LogUpdClause)+(UInt)NEXTOP((yamop*)NULL,e)); + Yap_heap_regs->logdb_erased_marker->Id = FunctorDBRef; + Yap_heap_regs->logdb_erased_marker->ClFlags = ErasedMask|LogUpdMask; + Yap_heap_regs->logdb_erased_marker->ClSource = NULL; + Yap_heap_regs->logdb_erased_marker->ClRefCount = 0; + Yap_heap_regs->logdb_erased_marker->ClPred = RepPredProp(PredPropByFunc(Yap_MkFunctor(Yap_FullLookupAtom("$do_log_upd_clause"),5),PROLOG_MODULE)); + Yap_heap_regs->logdb_erased_marker->ClExt = NULL; + Yap_heap_regs->logdb_erased_marker->ClPrev = NULL; + Yap_heap_regs->logdb_erased_marker->ClNext = NULL; + Yap_heap_regs->logdb_erased_marker->ClSize = (UInt)NEXTOP(((LogUpdClause *)NULL)->ClCode,e); + Yap_heap_regs->logdb_erased_marker->ClCode->opc = Yap_opcode(_op_fail); + INIT_LOCK(Yap_heap_regs->logdb_erased_marker->ClLock); + INIT_CLREF_COUNT(Yap_heap_regs->logdb_erased_marker); Yap_heap_regs->yap_streams = NULL; #if DEBUG Yap_heap_regs->expand_clauses_sz = 0L; diff --git a/H/Heap.h b/H/Heap.h index 5726540b8..5e9bc6ee2 100644 --- a/H/Heap.h +++ b/H/Heap.h @@ -10,7 +10,7 @@ * File: Heap.h * * mods: * * comments: Heap Init Structure * -* version: $Id: Heap.h,v 1.90 2006-01-02 02:16:18 vsc Exp $ * +* version: $Id: Heap.h,v 1.91 2006-02-24 14:03:42 vsc Exp $ * *************************************************************************/ /* information that can be stored in Code Space */ @@ -453,6 +453,7 @@ typedef struct various_codes { struct pred_entry *pred_throw; struct pred_entry *pred_handle_throw; struct DB_STRUCT *db_erased_marker; + struct logic_upd_clause *logdb_erased_marker; struct logic_upd_clause *db_erased_list; struct logic_upd_index *db_erased_ilist; UInt expand_clauses_sz; @@ -720,6 +721,7 @@ struct various_codes *Yap_heap_regs; #define PredThrow Yap_heap_regs->pred_throw #define PredHandleThrow Yap_heap_regs->pred_handle_throw #define DBErasedMarker Yap_heap_regs->db_erased_marker +#define LogDBErasedMarker Yap_heap_regs->logdb_erased_marker #define DBErasedList Yap_heap_regs->db_erased_list #define DBErasedIList Yap_heap_regs->db_erased_ilist #define Yap_expand_clauses_sz Yap_heap_regs->expand_clauses_sz diff --git a/H/Yatom.h b/H/Yatom.h index b89038cca..1399c0e62 100644 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -788,11 +788,8 @@ typedef struct DBRef Index; /* age counter */ } LogUpdDBEntry; typedef LogUpdDBEntry *LogUpdDBProp; -#define LogUpdDBBit 0x1 #define CodeDBBit 0x2 -#define LogUpdDBProperty ((PropFlags)(0x8000|LogUpdDBBit)) -#define CodeLogUpdDBProperty (DBProperty|LogUpdDBBit|CodeDBBit) #define CodeDBProperty (DBProperty|CodeDBBit) @@ -801,7 +798,7 @@ inline EXTERN PropFlags IsDBProperty (int); inline EXTERN PropFlags IsDBProperty (int flags) { - return (PropFlags) (((flags & ~(LogUpdDBBit | CodeDBBit)) == DBProperty)); + return (PropFlags) ((flags & ~CodeDBBit) == DBProperty); } diff --git a/H/rheap.h b/H/rheap.h index 52e13026f..4517f6548 100644 --- a/H/rheap.h +++ b/H/rheap.h @@ -11,8 +11,13 @@ * File: rheap.h * * comments: walk through heap code * * * -* Last rev: $Date: 2006-01-02 02:16:18 $,$Author: vsc $ * +* Last rev: $Date: 2006-02-24 14:03:42 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.61 2006/01/02 02:16:18 vsc +* support new interface between YAP and GMP, so that we don't rely on our own +* allocation routines. +* Several big fixes. +* * Revision 1.60 2005/12/17 03:25:39 vsc * major changes to support online event-based profiling * improve error discovery and restart on scanner. @@ -509,6 +514,12 @@ restore_codes(void) Yap_heap_regs->last_wtime = (void *)PtoHeapCellAdjust((CELL *)(Yap_heap_regs->last_wtime)); Yap_heap_regs->db_erased_marker = DBRefAdjust(Yap_heap_regs->db_erased_marker); + Yap_heap_regs->logdb_erased_marker = + PtoLUCAdjust(Yap_heap_regs->logdb_erased_marker); + Yap_heap_regs->logdb_erased_marker->Id = FunctorDBRef; + Yap_heap_regs->logdb_erased_marker->ClCode->opc = Yap_opcode(_op_fail); + Yap_heap_regs->logdb_erased_marker->ClPred = + PtoPredAdjust(Yap_heap_regs->logdb_erased_marker->ClPred); Yap_heap_regs->hash_chain = (AtomHashEntry *)PtoHeapCellAdjust((CELL *)(Yap_heap_regs->hash_chain)); } @@ -622,29 +633,20 @@ RestoreDB(DBEntry *pp) pp->FunctorOfDB = FuncAdjust(pp->FunctorOfDB); else pp->FunctorOfDB = (Functor) AtomAdjust((Atom)(pp->FunctorOfDB)); - if (pp->KindOfPE & LogUpdDBBit) { - dbr = pp->First; - /* While we have something in the data base, restore it */ - while (dbr) { - RestoreDBEntry(dbr); - dbr = dbr->Next; - } - } else { - if (pp->F0 != NULL) - pp->F0 = DBRefAdjust(pp->F0); - if (pp->L0 != NULL) - pp->L0 = DBRefAdjust(pp->L0); - /* immediate update semantics */ - dbr = pp->F0; - /* While we have something in the data base, even if erased, restore it */ - while (dbr) { - RestoreDBEntry(dbr); - if (dbr->n != NULL) - dbr->n = DBRefAdjust(dbr->n); - if (dbr->p != NULL) - dbr->p = DBRefAdjust(dbr->p); - dbr = dbr->n; - } + if (pp->F0 != NULL) + pp->F0 = DBRefAdjust(pp->F0); + if (pp->L0 != NULL) + pp->L0 = DBRefAdjust(pp->L0); + /* immediate update semantics */ + dbr = pp->F0; + /* While we have something in the data base, even if erased, restore it */ + while (dbr) { + RestoreDBEntry(dbr); + if (dbr->n != NULL) + dbr->n = DBRefAdjust(dbr->n); + if (dbr->p != NULL) + dbr->p = DBRefAdjust(dbr->p); + dbr = dbr->n; } } @@ -1115,8 +1117,6 @@ RestoreEntries(PropEntry *pp) } break; case DBProperty: - case LogUpdDBProperty: - case CodeLogUpdDBProperty: case CodeDBProperty: #ifdef DEBUG_RESTORE2 fprintf(stderr, "Correcting data base clause at %p\n", pp); diff --git a/changes-5.1.html b/changes-5.1.html index cf9d6b116..869482912 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -16,6 +16,9 @@

Yap-5.1.0: