made bittable dynamic
This commit is contained in:
parent
184984d472
commit
a0934dc7e0
4 changed files with 39 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -172,6 +172,9 @@ listline(textline)
|
|||
/* ---------- code optimization ---------- */
|
||||
|
||||
#ifdef THREE_PASS
|
||||
#define PBITTABSZ 128
|
||||
static char *pbittab[PBITTABSZ];
|
||||
|
||||
small(fitsmall, gain)
|
||||
{
|
||||
register bit;
|
||||
|
@ -181,7 +184,10 @@ small(fitsmall, gain)
|
|||
nosect();
|
||||
if (bflag)
|
||||
return(0);
|
||||
if (nbits == BITMAX) {
|
||||
if (nbits == BITCHUNK) {
|
||||
bitindex++;
|
||||
nbits = 0;
|
||||
if (bitindex == PBITTABSZ) {
|
||||
static int w_given;
|
||||
if (pass == PASS_1 && ! w_given) {
|
||||
w_given = 1;
|
||||
|
@ -189,8 +195,21 @@ small(fitsmall, gain)
|
|||
}
|
||||
return(0);
|
||||
}
|
||||
p = &bittab[(int) (nbits>>3)];
|
||||
bit = 1 << ((int)nbits&7);
|
||||
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);
|
||||
}
|
||||
bit = 1 << (nbits&7);
|
||||
p = pbittab[bitindex]+(nbits>>3);
|
||||
nbits++;
|
||||
switch (pass) {
|
||||
case PASS_1:
|
||||
|
|
Loading…
Reference in a new issue