From: ceriel Date: Thu, 16 Jun 1988 13:24:10 +0000 (+0000) Subject: made bittable dynamic X-Git-Tag: release-5-5~3191 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a0934dc7e0fc06d311049ff08cf3604fbe0c73d2;p=ack.git made bittable dynamic --- diff --git a/mach/proto/as/comm0.h b/mach/proto/as/comm0.h index d828685ee..10b223eb5 100644 --- a/mach/proto/as/comm0.h +++ b/mach/proto/as/comm0.h @@ -26,7 +26,6 @@ /* table sizes */ #define STRINGMAX 200 /* <= 256 */ -#define BITMAX 2000 /* for short or long branches */ #define SECTMAX 64 #define NAMEMAX 80 #define MEMINCR 2048 diff --git a/mach/proto/as/comm1.h b/mach/proto/as/comm1.h index f917bdeac..1a2029bca 100644 --- a/mach/proto/as/comm1.h +++ b/mach/proto/as/comm1.h @@ -78,9 +78,11 @@ extern short hashindex; /* see item_search() */ extern item_t *fb_ptr[4*FB_SIZE]; #ifdef THREE_PASS -extern char bittab[BITMAX>>3]; - /* one bit per small-large decision */ -extern long nbits; /* number of decisions so far */ +#define BITCHUNK (8 * MEMINCR) +extern int nbits; +extern int bitindex; /* bitindex * MEMINCR * 8 + nbits gives + number of decisions so far + */ #endif #ifdef LISTING diff --git a/mach/proto/as/comm4.c b/mach/proto/as/comm4.c index 802f69462..cc1a68bf7 100644 --- a/mach/proto/as/comm4.c +++ b/mach/proto/as/comm4.c @@ -139,6 +139,11 @@ char **argv; register nfile = 0; #endif +#ifdef THREE_PASS + bitindex = -1; + nbits = BITCHUNK; +#endif + tempfile = fftemp(temppath, "asTXXXXXX"); #ifdef LISTING listmode = dflag; @@ -384,7 +389,8 @@ pass_23(n) listeoln = 1; #endif #ifdef THREE_PASS - nbits = 0; + bitindex = -1; + nbits = BITCHUNK; #endif for (i = 0; i < FB_SIZE; i++) fb_ptr[FB_FORW+i] = fb_ptr[FB_HEAD+i]; diff --git a/mach/proto/as/comm7.c b/mach/proto/as/comm7.c index 774b022cd..8c854fbcd 100644 --- a/mach/proto/as/comm7.c +++ b/mach/proto/as/comm7.c @@ -172,6 +172,9 @@ listline(textline) /* ---------- code optimization ---------- */ #ifdef THREE_PASS +#define PBITTABSZ 128 +static char *pbittab[PBITTABSZ]; + small(fitsmall, gain) { register bit; @@ -181,16 +184,32 @@ small(fitsmall, gain) nosect(); if (bflag) return(0); - if (nbits == BITMAX) { - static int w_given; - if (pass == PASS_1 && ! w_given) { - w_given = 1; - warning("bit table overflow"); + if (nbits == BITCHUNK) { + bitindex++; + nbits = 0; + if (bitindex == PBITTABSZ) { + static int w_given; + if (pass == PASS_1 && ! w_given) { + w_given = 1; + warning("bit table overflow"); + } + return(0); } - return(0); + if (pbittab[bitindex] == 0 && pass == PASS_1) { + if ((pbittab[bitindex] = malloc(MEMINCR)) == 0) { + static int w2_given; + + if (!w2_given) { + w2_given = 1; + warning("out of space for bit table"); + } + } + } + if (pbittab[bitindex] == 0) + return (0); } - p = &bittab[(int) (nbits>>3)]; - bit = 1 << ((int)nbits&7); + bit = 1 << (nbits&7); + p = pbittab[bitindex]+(nbits>>3); nbits++; switch (pass) { case PASS_1: