]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/libregexp/regcomp.c
libregexp: improve the transition to next available thread, instruction, and generation
[plan9front.git] / sys / src / libregexp / regcomp.c
index ad3b8cd96218fc5bf0bacc04ea74ebeeb53aacb0..3e3ba6ae529841dcbe4f411074f2d4376ed4c12d 100644 (file)
@@ -156,17 +156,6 @@ initplex(Parselex *plex, char *regstr, int lit)
        return plex;
 }
 
-static int
-maxthreads(Renode *tree)
-{
-       tree = tree->left;
-       if(tree->op == TCAT)
-               tree = tree->left;
-       if(tree->op == TBOL)
-               return 2;
-       return -1;
-}
-
 static Reprog*
 regcomp1(char *regstr, int nl, int lit)
 {
@@ -187,7 +176,7 @@ regcomp1(char *regstr, int nl, int lit)
                return nil;
        }
 
-       maxthr = regstrlen;
+       maxthr = regstrlen + 1;
        parsetr = node(&plex, TSUB, e0(&plex), nil);
 
 //     prtree(parsetr, 0, 1);
@@ -304,12 +293,13 @@ Tailcall:
 static Reinst*
 compile(Renode *parsetr, Reprog *reprog, int nl)
 {
-       Reinst *reinst;
+       Reinst *reinst, *end;
        int sub;
 
        sub = 0;
        reinst = (Reinst*)(reprog+1);
-       compile1(parsetr, reinst, &sub, nl);
+       end = compile1(parsetr, reinst, &sub, nl);
+       assert(reinst + reprog->len == end);
        return reinst;
 }