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 */
|
/* table sizes */
|
||||||
#define STRINGMAX 200 /* <= 256 */
|
#define STRINGMAX 200 /* <= 256 */
|
||||||
#define BITMAX 2000 /* for short or long branches */
|
|
||||||
#define SECTMAX 64
|
#define SECTMAX 64
|
||||||
#define NAMEMAX 80
|
#define NAMEMAX 80
|
||||||
#define MEMINCR 2048
|
#define MEMINCR 2048
|
||||||
|
|
|
@ -78,9 +78,11 @@ extern short hashindex; /* see item_search() */
|
||||||
extern item_t *fb_ptr[4*FB_SIZE];
|
extern item_t *fb_ptr[4*FB_SIZE];
|
||||||
|
|
||||||
#ifdef THREE_PASS
|
#ifdef THREE_PASS
|
||||||
extern char bittab[BITMAX>>3];
|
#define BITCHUNK (8 * MEMINCR)
|
||||||
/* one bit per small-large decision */
|
extern int nbits;
|
||||||
extern long nbits; /* number of decisions so far */
|
extern int bitindex; /* bitindex * MEMINCR * 8 + nbits gives
|
||||||
|
number of decisions so far
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LISTING
|
#ifdef LISTING
|
||||||
|
|
|
@ -139,6 +139,11 @@ char **argv;
|
||||||
register nfile = 0;
|
register nfile = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef THREE_PASS
|
||||||
|
bitindex = -1;
|
||||||
|
nbits = BITCHUNK;
|
||||||
|
#endif
|
||||||
|
|
||||||
tempfile = fftemp(temppath, "asTXXXXXX");
|
tempfile = fftemp(temppath, "asTXXXXXX");
|
||||||
#ifdef LISTING
|
#ifdef LISTING
|
||||||
listmode = dflag;
|
listmode = dflag;
|
||||||
|
@ -384,7 +389,8 @@ pass_23(n)
|
||||||
listeoln = 1;
|
listeoln = 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef THREE_PASS
|
#ifdef THREE_PASS
|
||||||
nbits = 0;
|
bitindex = -1;
|
||||||
|
nbits = BITCHUNK;
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < FB_SIZE; i++)
|
for (i = 0; i < FB_SIZE; i++)
|
||||||
fb_ptr[FB_FORW+i] = fb_ptr[FB_HEAD+i];
|
fb_ptr[FB_FORW+i] = fb_ptr[FB_HEAD+i];
|
||||||
|
|
|
@ -172,6 +172,9 @@ listline(textline)
|
||||||
/* ---------- code optimization ---------- */
|
/* ---------- code optimization ---------- */
|
||||||
|
|
||||||
#ifdef THREE_PASS
|
#ifdef THREE_PASS
|
||||||
|
#define PBITTABSZ 128
|
||||||
|
static char *pbittab[PBITTABSZ];
|
||||||
|
|
||||||
small(fitsmall, gain)
|
small(fitsmall, gain)
|
||||||
{
|
{
|
||||||
register bit;
|
register bit;
|
||||||
|
@ -181,16 +184,32 @@ small(fitsmall, gain)
|
||||||
nosect();
|
nosect();
|
||||||
if (bflag)
|
if (bflag)
|
||||||
return(0);
|
return(0);
|
||||||
if (nbits == BITMAX) {
|
if (nbits == BITCHUNK) {
|
||||||
static int w_given;
|
bitindex++;
|
||||||
if (pass == PASS_1 && ! w_given) {
|
nbits = 0;
|
||||||
w_given = 1;
|
if (bitindex == PBITTABSZ) {
|
||||||
warning("bit table overflow");
|
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 << (nbits&7);
|
||||||
bit = 1 << ((int)nbits&7);
|
p = pbittab[bitindex]+(nbits>>3);
|
||||||
nbits++;
|
nbits++;
|
||||||
switch (pass) {
|
switch (pass) {
|
||||||
case PASS_1:
|
case PASS_1:
|
||||||
|
|
Loading…
Reference in a new issue