Fixed wrong assertion, and fixed bug in distance routine: it did not check
authorceriel <none@none>
Wed, 4 Apr 1990 14:52:29 +0000 (14:52 +0000)
committerceriel <none@none>
Wed, 4 Apr 1990 14:52:29 +0000 (14:52 +0000)
that each stackpattern token that does not exactly match can be made from the
stack

mach/proto/ncg/codegen.c
mach/proto/ncg/subr.c

index 0e54d1e..e7c64ef 100644 (file)
@@ -152,7 +152,7 @@ unsigned codegen(codep,ply,toplevel,costlimit,forced) byte *codep; unsigned cost
                        int j, nargs;
                        getint(i,bp);
                        getint(nargs,bp);
-                       assert(nargs < MAXPROCARG);
+                       assert(nargs <= MAXPROCARG);
                        for (j = 0; j < nargs; j++) {
                                getint(procarg[j],bp);
                        }
index e5f6cca..c25cb0b 100644 (file)
@@ -324,6 +324,14 @@ distance(cindex) {
                                return(100);
                        if (expsize<toksize)
                                return(99-i);
+
+                       /* Now we have a match in size, but it is not exact.
+                          Therefore, make sure that we can at least
+                          create it from the stack!
+                       */
+                       if (! from_stack(&machsets[tokexp])) {
+                               return MAXINT;
+                       }
                } else
                        exact++;
        }