diff options
| author | Quentin Carbonneaux | 2015-03-04 19:10:21 -0500 |
|---|---|---|
| committer | Quentin Carbonneaux | 2015-03-04 19:10:21 -0500 |
| commit | 58e9fc1df61074fa86c6cd985f52893138b840d4 (patch) | |
| tree | e656717e2e8078929739d465bc36fb15b79e5902 | |
| parent | d90dd7d7d862e842df03ea0f943422cdf0a48e3e (diff) | |
add quick and dirty dirty bit
| -rw-r--r-- | miniyacc.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -69,6 +69,7 @@ struct Item { int nt; Term ts[MaxTm]; Item **gtbl; + int dirty; }; struct Row { @@ -354,6 +355,7 @@ stadd(Item **pi) i1 = st[hi]; for (n=0; n<i->nt; n++) chg |= tsunion(&i1->ts[n].lk, &i->ts[n].lk); + i1->dirty |= chg; *pi = i1; return chg; } else { @@ -362,6 +364,7 @@ stadd(Item **pi) die("out of memory"); memmove(&st[hi+1], &st[hi], (nst-1 - hi) * sizeof st[0]); i->gtbl = yalloc(nsy, sizeof i->gtbl[0]); + i->dirty = 1; st[hi] = yalloc(1, sizeof *i1); *st[hi] = *i; return 1; @@ -387,10 +390,14 @@ stgen() i0.nt = 0; i0.ts[i0.nt++] = tini; stadd(&ini); + ini->dirty = 1; do { chg = 0; for (n=0; n<nst; n++) { i = st[n]; + if (!i->dirty) + continue; + i->dirty = 0; iclose(i); for (s=0; s<nsy; s++) { igoto(i, s); |
