diff options
Diffstat (limited to 'src/runtime/rstruct.r')
-rw-r--r-- | src/runtime/rstruct.r | 163 |
1 files changed, 0 insertions, 163 deletions
diff --git a/src/runtime/rstruct.r b/src/runtime/rstruct.r index 22ab704..acf72f4 100644 --- a/src/runtime/rstruct.r +++ b/src/runtime/rstruct.r @@ -91,10 +91,6 @@ word i, j; Protect(lp2 = (struct b_list *) alclist(size), return Error); Protect(bp2 = (struct b_lelem *)alclstb(nslots,(word)0,size), return Error); lp2->listhead = lp2->listtail = (union block *) bp2; -#ifdef ListFix - bp2->listprev = bp2->listnext = (union block *) lp2; -#endif /* ListFix */ - cpslots(dp1, bp2->lslots, i, j); /* @@ -102,95 +98,9 @@ word i, j; */ dp2->dword = D_List; BlkLoc(*dp2) = (union block *) lp2; - EVValD(dp2, E_Lcreate); return Succeeded; } -#ifdef TableFix -/* - * cpset(dp1,dp2,n) - copy set dp1 to dp2, reserving memory for n entries. - */ -int cpset(dp1, dp2, n) -dptr dp1, dp2; -word n; - { - int i = cphash(dp1, dp2, n, T_Set); - EVValD(dp2, E_Screate); - return i; - } - -int cptable(dp1, dp2, n) -dptr dp1, dp2; -word n; - { - int i = cphash(dp1, dp2, n, T_Table); - BlkLoc(*dp2)->table.defvalue = BlkLoc(*dp1)->table.defvalue; - EVValD(dp2, E_Tcreate); - return i; - } - -int cphash(dp1, dp2, n, tcode) -dptr dp1, dp2; -word n; -int tcode; - { - union block *src; - tended union block *dst; - tended struct b_slots *seg; - tended struct b_selem *ep, *prev; - struct b_selem *se; - register word slotnum; - register int i; - - /* - * Make a new set organized like dp1, with room for n elements. - */ - dst = hmake(tcode, BlkLoc(*dp1)->set.mask + 1, n); - if (dst == NULL) - return Error; - /* - * Copy the header and slot blocks. - */ - src = BlkLoc(*dp1); - dst->set.size = src->set.size; /* actual set size */ - dst->set.mask = src->set.mask; /* hash mask */ - for (i = 0; i < HSegs && src->set.hdir[i] != NULL; i++) - memcpy((char *)dst->set.hdir[i], (char *)src->set.hdir[i], - src->set.hdir[i]->blksize); - /* - * Work down the chain of element blocks in each bucket - * and create identical chains in new set. - */ - for (i = 0; i < HSegs && (seg = dst->set.hdir[i]) != NULL; i++) - for (slotnum = segsize[i] - 1; slotnum >= 0; slotnum--) { - prev = NULL; - for (ep = (struct b_selem *)seg->hslots[slotnum]; - ep != NULL && BlkType(ep) != T_Table; - ep = (struct b_selem *)ep->clink) { - if (tcode == T_Set) { - Protect(se = alcselem(&ep->setmem, ep->hashnum), return Error); - se->clink = ep->clink; - } - else { - Protect(se = (struct b_selem *)alctelem(), return Error); - *(struct b_telem *)se = *(struct b_telem *)ep; /* copy table entry */ - if (BlkType(se->clink) == T_Table) - se->clink = dst; - } - if (prev == NULL) - seg->hslots[slotnum] = (union block *)se; - else - prev->clink = (union block *)se; - prev = se; - } - } - dp2->dword = tcode | D_Typecode | F_Ptr; - BlkLoc(*dp2) = dst; - if (TooSparse(dst)) - hshrink(dst); - return Succeeded; - } -#else /* TableFix */ /* * cpset(dp1,dp2,n) - copy set dp1 to dp2, reserving memory for n entries. */ @@ -243,10 +153,8 @@ word n; BlkLoc(*dp2) = dst; if (TooSparse(dst)) hshrink(dst); - Desc_EVValD(dst, E_Screate, D_Set); return Succeeded; } -#endif /* TableFix */ /* * hmake - make a hash structure (Set or Table) with a given number of slots. @@ -281,13 +189,6 @@ word nslots, nelem; for (; seg >= 0; seg--) { Protect(segp = alcsegment(segsize[seg]), return NULL); blk->set.hdir[seg] = segp; -#ifdef TableFix - if (tcode == T_Table) { - int j; - for (j = 0; j < segsize[seg]; j++) - segp->hslots[j] = blk; - } -#endif /* TableFix */ } blk->set.mask = nslots - 1; return blk; @@ -384,15 +285,9 @@ union block *ep; * has same hash value as the current one, in which case we defer it * by doing nothing now. */ -#ifdef TableFix - if (bp->table.mask != s->tmask && - (ep->selem.clink == NULL || BlkType(ep->telem.clink) == T_Table || - ep->telem.clink->telem.hashnum != ep->telem.hashnum)) { -#else /* TableFix */ if (bp->table.mask != s->tmask && (ep->selem.clink == NULL || ep->telem.clink->telem.hashnum != ep->telem.hashnum)) { -#endif /* TableFix */ /* * Yes, they did split. Make a note of the current state. */ @@ -414,12 +309,7 @@ union block *ep; * element, because it may have moved to a new segment. */ ep = bp->table.hdir[s->segnum]->hslots[s->slotnum]; -#ifdef TableFix - while (ep != NULL && BlkType(ep) != T_Table && - ep->telem.hashnum <= hn) -#else /* TableFix */ while (ep != NULL && ep->telem.hashnum <= hn) -#endif /* TableFix */ ep = ep->telem.clink; } @@ -429,22 +319,14 @@ union block *ep; * that have identical hash numbers. Find the next element in * the current hash chain. */ -#ifdef TableFix - if (ep != NULL && BlkType(ep) != T_Table) /* NULL on very first call */ -#else /* TableFix */ if (ep != NULL) /* already NULL on very first call */ -#endif /* TableFix */ ep = ep->telem.clink; /* next element in chain, if any */ } /* * If we don't yet have an element, search successive slots. */ -#ifdef TableFix - while (ep == NULL || BlkType(ep) == T_Table) { -#else /* TableFix */ while (ep == NULL) { -#endif /* TableFix */ /* * Move to the next slot and pick the first entry. */ @@ -470,12 +352,7 @@ union block *ep; * This chain was split from its parent while the parent was * being processed. Skip past elements already processed. */ -#ifdef TableFix - while (ep != NULL && BlkType(ep) != T_Table && - ep->telem.hashnum <= s->sghash[i]) -#else /* TableFix */ while (ep != NULL && ep->telem.hashnum <= s->sghash[i]) -#endif /* TableFix */ ep = ep->telem.clink; } } @@ -484,9 +361,6 @@ union block *ep; /* * Return the element. */ -#ifdef TableFix - if (ep && BlkType(ep) == T_Table) ep = NULL; -#endif /* TableFix */ return ep; } @@ -508,25 +382,12 @@ union block *bp; return; /* can't split further */ newslots = ps->mask + 1; Protect(newseg = alcsegment(newslots), return); -#ifdef TableFix - if (BlkType(bp) == T_Table) { - int j; - for(j=0; j<newslots; j++) newseg->hslots[j] = bp; - } -#endif /* TableFix */ - curslot = newseg->hslots; for (segnum = 0; (seg = ps->hdir[segnum]) != NULL; segnum++) for (slotnum = 0; slotnum < segsize[segnum]; slotnum++) { tp0 = &seg->hslots[slotnum]; /* ptr to tail of old slot */ tp1 = curslot++; /* ptr to tail of new slot */ -#ifdef TableFix - for (ep = *tp0; - ep != NULL && BlkType(ep) != T_Table; - ep = ep->selem.clink) { -#else /* TableFix */ for (ep = *tp0; ep != NULL; ep = ep->selem.clink) { -#endif /* TableFix */ if ((ep->selem.hashnum & newslots) == 0) { *tp0 = ep; /* element does not move */ tp0 = &ep->selem.clink; @@ -536,14 +397,7 @@ union block *bp; tp1 = &ep->selem.clink; } } -#ifdef TableFix - if ( BlkType(bp) == T_Table ) - *tp0 = *tp1 = bp; - else - *tp0 = *tp1 = NULL; -#else /* TableFix */ *tp0 = *tp1 = NULL; -#endif /* TableFix */ } ps->hdir[segnum] = newseg; ps->mask = (ps->mask << 1) | 1; @@ -578,12 +432,7 @@ union block *bp; tp = &seg->hslots[slotnum]; /* tail pointer */ ep0 = seg->hslots[slotnum]; /* lower slot entry pointer */ ep1 = *uppslot++; /* upper slot entry pointer */ -#ifdef TableFix - while (ep0 != NULL && BlkType(ep0) != T_Table && - ep1 != NULL && BlkType(ep1) != T_Table) -#else /* TableFix */ while (ep0 != NULL && ep1 != NULL) -#endif /* TableFix */ if (ep0->selem.hashnum < ep1->selem.hashnum) { *tp = ep0; tp = &ep0->selem.clink; @@ -594,20 +443,12 @@ union block *bp; tp = &ep1->selem.clink; ep1 = ep1->selem.clink; } -#ifdef TableFix - while (ep0 != NULL && BlkType(ep0) != T_Table) { -#else /* TableFix */ while (ep0 != NULL) { -#endif /* TableFix */ *tp = ep0; tp = &ep0->selem.clink; ep0 = ep0->selem.clink; } -#ifdef TableFix - while (ep1 != NULL && BlkType(ep1) != T_Table) { -#else /* TableFix */ while (ep1 != NULL) { -#endif /* TableFix */ *tp = ep1; tp = &ep1->selem.clink; ep1 = ep1->selem.clink; @@ -640,11 +481,7 @@ int *res; /* pointer to integer result flag */ * Look for x in the hash chain. */ *res = 0; -#ifdef TableFix - while ((pe = (struct b_selem *)*lp) != NULL && BlkType(pe) != T_Table) { -#else /* TableFix */ while ((pe = (struct b_selem *)*lp) != NULL) { -#endif /* TableFix */ eh = pe->hashnum; if (eh > hn) /* too far - it isn't there */ return lp; |