src/gchtfind.c
/************************************************************************/
/*									*/
/*			r e c _ h t f i n d				*/
/*									*/
/*	Version of HTFIND used during reclaims (part of GC process)	*/
/*	Same purpose, but doesn't increment the GC count-down, and	*/
/*	DELREF can add 0-refcount entries to the table.			*/
/*									*/
/************************************************************************/
r e c _ h t f i n d

Version of HTFIND used during reclaims (part of GC process)
Same purpose, but doesn't increment the GC count-down, and
DELREF can add 0-refcount entries to the table.
r e c _ h t f i n d Version of HTFIND used during reclaims ( part of GC process ) Same purpose but doesn ' t increment the GC count - down and DELREF can add 0 - refcount entries to the table .
LispPTR rec_htfind(LispPTR ptr, int casep) {
  register GCENTRY *entry, *link, *prev;
  register GCENTRY entry_contents, hiptr;
  hiptr = (((unsigned int)ptr) >> (16 - HTHISHIFT)) & HTHIMASK;
  entry = HTmain + (LOLOC(ptr) >> 1);
  entry_contents = GETGC(entry);
  if (entry_contents == 0) RecNewEntry(entry, hiptr, casep, ptr);
  if (entry_contents & 1) { 
    link = HTcoll + (entry_contents - 1);
    prev = 0;
    goto newlink;
  }
  if (hiptr == (entry_contents & HTHIMASK)) {
    RecModEntry(entry, entry_contents, ptr, casep, delentry);
  }
  GetLink(link);
  GetLink(prev);
  GETGC((GCENTRY *)prev + 1) = 0;
  GETGC((GCENTRY *)prev) = entry_contents;
  GETGC((GCENTRY *)link + 1) = prev - HTcoll;
  GETGC((GCENTRY *)entry) = (link - HTcoll) + 1;
  RecNewEntry(link, hiptr, casep, ptr);
delentry:
  GETGC(entry) = 0;
  return NIL;
newlink:
  entry_contents = GETGC(link);
  if (hiptr == (entry_contents & HTHIMASK)) {
    RecModEntry(link, entry_contents, ptr, casep, dellink);
  }
  entry_contents = GETGC(link + 1);
  if (entry_contents == 0) { goto nolink; }
  prev = link;
  link = HTcoll + entry_contents;
  goto newlink;
dellink:
  if (prev)
    GETGC((GCENTRY *)prev + 1) = GETGC((GCENTRY *)link + 1);
  else
    GETGC((GCENTRY *)entry) = (GETGC((GCENTRY *)link + 1)) | 1;
  FreeLink(link);
  link = HTcoll + ((GETGC((GCENTRY *)entry)) - 1);
  if (GETGC((GCENTRY *)link + 1) == 0) {
    GETGC((GCENTRY *)entry) = GETGC((GCENTRY *)link);
    FreeLink(link);
  }
  return NIL;
nolink: 
  GetLink(link);
  GETGC((GCENTRY *)link + 1) = GETGC((GCENTRY *)entry) - 1;
  GETGC((GCENTRY *)entry) = (link - HTcoll) + 1;
  RecNewEntry(link, hiptr, casep, ptr);
}
LispPTR rec_htfind ( LispPTR ptr , int casep ) { register GCENTRY * entry , * link , * prev ; register GCENTRY entry_contents , hiptr ; hiptr = ( ( ( unsigned int ) ptr ) >> ( 16 - HTHISHIFT ) ) & HTHIMASK ; entry = HTmain + ( LOLOC ( ptr ) >> 1 ) ; entry_contents = GETGC ( entry ) ; if ( entry_contents == 0 ) RecNewEntry ( entry , hiptr , casep , ptr ) ; if ( entry_contents & 1 ) { link = HTcoll + ( entry_contents - 1 ) ; prev = 0 ; goto newlink ; } if ( hiptr == ( entry_contents & HTHIMASK ) ) { RecModEntry ( entry , entry_contents , ptr , casep , delentry ) ; } GetLink ( link ) ; GetLink ( prev ) ; GETGC ( ( GCENTRY * ) prev + 1 ) = 0 ; GETGC ( ( GCENTRY * ) prev ) = entry_contents ; GETGC ( ( GCENTRY * ) link + 1 ) = prev - HTcoll ; GETGC ( ( GCENTRY * ) entry ) = ( link - HTcoll ) + 1 ; RecNewEntry ( link , hiptr , casep , ptr ) ; delentry : GETGC ( entry ) = 0 ; return NIL ; newlink : entry_contents = GETGC ( link ) ; if ( hiptr == ( entry_contents & HTHIMASK ) ) { RecModEntry ( link , entry_contents , ptr , casep , dellink ) ; } entry_contents = GETGC ( link + 1 ) ; if ( entry_contents == 0 ) { goto nolink ; } prev = link ; link = HTcoll + entry_contents ; goto newlink ; dellink : if ( prev ) GETGC ( ( GCENTRY * ) prev + 1 ) = GETGC ( ( GCENTRY * ) link + 1 ) ; else GETGC ( ( GCENTRY * ) entry ) = ( GETGC ( ( GCENTRY * ) link + 1 ) ) | 1 ; FreeLink ( link ) ; link = HTcoll + ( ( GETGC ( ( GCENTRY * ) entry ) ) - 1 ) ; if ( GETGC ( ( GCENTRY * ) link + 1 ) == 0 ) { GETGC ( ( GCENTRY * ) entry ) = GETGC ( ( GCENTRY * ) link ) ; FreeLink ( link ) ; } return NIL ; nolink : GetLink ( link ) ; GETGC ( ( GCENTRY * ) link + 1 ) = GETGC ( ( GCENTRY * ) entry ) - 1 ; GETGC ( ( GCENTRY * ) entry ) = ( link - HTcoll ) + 1 ; RecNewEntry ( link , hiptr , casep , ptr ) ; }
r e c _ h t f i n d
r e c _ h t f i n d
/* if the NOREF bit is on in the type table entry, do
  not reference count this pointer. Used for non-reference
  counted types like symbols, and also when the GC is
  disabled. */ /*
   * Following two tests were moved into GCLOOKUP macro
   * for efficiency.
   */ /*
      if (GetTypeEntry(ptr) & TT_NOREF)
                  return NIL;
  */ /* if *GcDisabled_word is T then do nothing */ /* FS:  this test should not be needed (because type table should
      be cleared).  Also, this test seems to cause an infinite
      ucode loop in remimplicitkeyhash on the 386i		*/ /*    if(*GcDisabled_word == ATOM_T) return(NIL); */ /* GC hash table entries have the high 8 bits of the
  pointer stored in the middle. Set up hiptr to have
  the high bits of the pointer ready to store or test
  against */ /* entry points at the place in the main hash table
  where this pointer is stored. The 'hash' isn't one really;
  it just uses the low bits of the pointer. */ /* NewEntry returns */ /* low bit means a collision entry */ /* entry_contents-1 removes low bit */ /* ModEntry returns or will go to delentry */ /* new collision */ /* start here when a collision is detected. link is a pointer to
  the entry in the collision table, prev is the previous collision
  entry or 0 if this is the first one. */ /* ModEntry returns or goes to dellink */ /* collision didn't match  */ /* try the next link in the collision table */ /* no match */