/* * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". * * Author: Hans van Staveren */ #include #include "assert.h" #include "param.h" #include "tables.h" #include "types.h" #include #include "data.h" #include "result.h" #include "extern.h" #include "subr.h" #include "salloc.h" /* * Package for string allocation and garbage collection. * Call salloc(size) to get room for string. * Every now and then call garbage_collect() from toplevel. */ #define MAXSTAB 2500 #define THRESHOLD 200 char *stab[MAXSTAB]; int nstab=0; static void chkstr(string str,char used[]) { register int low,middle,high; low=0; high=nstab-1; while (high>low) { middle= (low+high)>>1; if (str==stab[middle]) { used[middle]=1; return; } if (strem_soper,used); for (tp= fakestack;tp<&fakestack[stackheight];tp++) { if (tp->t_token== -1) continue; tdp = &tokens[tp->t_token]; for (i=0;it_type[i] == EV_STR) chkstr(tp->t_att[i].as,used); } for (rp= machregs; rpr_contents; assert(tp->t_token != -1); tdp= &tokens[tp->t_token]; for (i=0;it_type[i] == EV_STR) chkstr(tp->t_att[i].as,used); } for (i=0;i