speed up search for DB terms

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@903 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2003-10-19 00:33:10 +00:00
parent 526ec2e50f
commit e8a8177196
2 changed files with 13 additions and 5 deletions

View File

@ -12,7 +12,7 @@
* Last rev: *
* mods: *
* comments: allocating space *
* version:$Id: alloc.c,v 1.35 2003-10-14 13:10:26 vsc Exp $ *
* version:$Id: alloc.c,v 1.36 2003-10-19 00:33:10 vsc Exp $ *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
@ -237,8 +237,6 @@ AllocHeap(unsigned int size)
#if SIZEOF_INT_P==8
size = (((size + 7) & 0xfffffffffffffff8LL) >> 3) + 2; /* size in dwords + 2 */
#endif
if (size < 6)
size = 6;
LOCK(FreeBlocksLock);
if ((b = GetBlock(size))) {
if (b->b_size >= size + 6 + 1) {

View File

@ -481,10 +481,13 @@ count_cells_marked(void)
/* straightforward binary tree scheme that, given a key, finds a
matching dbref */
#define XOR_BIT 32
typedef enum {
db_entry,
cl_entry,
lcl_entry,
li_entry,
dcl_entry
} db_entry_type;
@ -546,7 +549,7 @@ find_ref_in_dbtable(CODEADDR entry)
if (current->val < entry && current->lim > entry) {
return(current);
}
if (entry < current->val)
if (((CELL)entry ^ (CELL)(current->val)) & XOR_BIT)
current = current->right;
else
current = current->left;
@ -570,6 +573,9 @@ mark_db_fixed(CELL *ptr) {
case lcl_entry:
((LogUpdClause *)(el->val))->ClFlags |= GcFoundMask;
break;
case li_entry:
((LogUpdIndex *)(el->val))->ClFlags |= GcFoundMask;
break;
case dcl_entry:
((DeadClause *)(el->val))->ClFlags |= GcFoundMask;
break;
@ -613,7 +619,11 @@ init_dbtable(tr_fr_ptr trail_ptr) {
if (FlagOn(DBClMask, flags)) {
store_in_dbtable((CODEADDR)DBStructFlagsToDBStruct(pt0), db_entry);
} else if (flags & LogUpdMask) {
store_in_dbtable((CODEADDR)ClauseFlagsToLogUpdClause(pt0), lcl_entry);
if (flags & IndexMask) {
store_in_dbtable((CODEADDR)ClauseFlagsToLogUpdIndex(pt0), li_entry);
} else {
store_in_dbtable((CODEADDR)ClauseFlagsToLogUpdClause(pt0), lcl_entry);
}
} else {
store_in_dbtable((CODEADDR)ClauseFlagsToDynamicClause(pt0), cl_entry);
}