improved ply handling

This commit is contained in:
ceriel 1992-12-18 10:22:55 +00:00
parent 5fbaff533c
commit ed2ba2e1d5

View file

@ -148,6 +148,10 @@ unsigned codegen(codep,ply,toplevel,costlimit,forced) byte *codep; unsigned cost
#ifndef NDEBUG #ifndef NDEBUG
chkregs(); chkregs();
#endif #endif
if (! toplevel) {
ply -= emp-saveemp+1;
if (ply <= 0) ply = 1;
}
n = *bp++; n = *bp++;
if (n==0) { /* "procedure" */ if (n==0) { /* "procedure" */
int j, nargs; int j, nargs;
@ -853,8 +857,7 @@ normalfailed: if (stackpad!=tokpatlen) {
} }
} }
if (!toplevel) { if (!toplevel) {
if (ply >= j) ply = emrepllen + ply - j; ply += emrepllen;
else ply = emrepllen;
#ifndef NDEBUG #ifndef NDEBUG
if (Debug > 4) if (Debug > 4)
fprintf(stderr, "ply becomes %d\n", ply); fprintf(stderr, "ply becomes %d\n", ply);