/[pcre]/code/trunk/pcre_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_exec.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 150 by ph10, Tue Apr 17 08:22:40 2007 UTC revision 164 by ph10, Fri May 4 15:11:14 2007 UTC
# Line 188  calls by keeping local variables that ne Line 188  calls by keeping local variables that ne
188  obtained from malloc() instead instead of on the stack. Macros are used to  obtained from malloc() instead instead of on the stack. Macros are used to
189  achieve this so that the actual code doesn't look very different to what it  achieve this so that the actual code doesn't look very different to what it
190  always used to.  always used to.
191    
192    The original heap-recursive code used longjmp(). However, it seems that this
193    can be very slow on some operating systems. Following a suggestion from Stan
194    Switzer, the use of longjmp() has been abolished, at the cost of having to
195    provide a unique number for each call to RMATCH. There is no way of generating
196    a sequence of numbers at compile time in C. I have given them names, to make
197    them stand out more clearly.
198    
199    Crude tests on x86 Linux show a small speedup of around 5-8%. However, on
200    FreeBSD, avoiding longjmp() more than halves the time taken to run the standard
201    tests. Furthermore, not using longjmp() means that local dynamic variables
202    don't have indeterminate values; this has meant that the frame size can be
203    reduced because the result can be "passed back" by straight setting of the
204    variable instead of being passed in the frame.
205  ****************************************************************************  ****************************************************************************
206  ***************************************************************************/  ***************************************************************************/
207    
208    
209    /* Numbers for RMATCH calls */
210    
211    enum { RM1=1, RM2,  RM3,  RM4,  RM5,  RM6,  RM7,  RM8,  RM9,  RM10,
212           RM11,  RM12, RM13, RM14, RM15, RM16, RM17, RM18, RM19, RM20,
213           RM21,  RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30,
214           RM31,  RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
215           RM41,  RM42, RM43, RM44, RM45, RM46, RM47 };
216    
217    
218  /* These versions of the macros use the stack, as normal. There are debugging  /* These versions of the macros use the stack, as normal. There are debugging
219  versions and production versions. */  versions and production versions. Note that the "rw" argument of RMATCH isn't
220    actuall used in this definition. */
221    
222  #ifndef NO_RECURSE  #ifndef NO_RECURSE
223  #define REGISTER register  #define REGISTER register
224    
225  #ifdef DEBUG  #ifdef DEBUG
226  #define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \
227    { \    { \
228    printf("match() called in line %d\n", __LINE__); \    printf("match() called in line %d\n", __LINE__); \
229    rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1); \    rrc = match(ra,rb,rc,rd,re,rf,rg,rdepth+1); \
230    printf("to line %d\n", __LINE__); \    printf("to line %d\n", __LINE__); \
231    }    }
232  #define RRETURN(ra) \  #define RRETURN(ra) \
# Line 210  versions and production versions. */ Line 235  versions and production versions. */
235    return ra; \    return ra; \
236    }    }
237  #else  #else
238  #define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) \  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw) \
239    rx = match(ra,rb,rc,rd,re,rf,rg,rdepth+1)    rrc = match(ra,rb,rc,rd,re,rf,rg,rdepth+1)
240  #define RRETURN(ra) return ra  #define RRETURN(ra) return ra
241  #endif  #endif
242    
243  #else  #else
244    
245    
246  /* These versions of the macros manage a private stack on the heap. Note  /* These versions of the macros manage a private stack on the heap. Note that
247  that the rd argument of RMATCH isn't actually used. It's the md argument of  the "rd" argument of RMATCH isn't actually used in this definition. It's the md
248  match(), which never changes. */  argument of match(), which never changes. */
249    
250  #define REGISTER  #define REGISTER
251    
252  #define RMATCH(rx,ra,rb,rc,rd,re,rf,rg)\  #define RMATCH(ra,rb,rc,rd,re,rf,rg,rw)\
253    {\    {\
254    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\    heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
255    if (setjmp(frame->Xwhere) == 0)\    frame->Xwhere = rw; \
256      {\    newframe->Xeptr = ra;\
257      newframe->Xeptr = ra;\    newframe->Xecode = rb;\
258      newframe->Xecode = rb;\    newframe->Xoffset_top = rc;\
259      newframe->Xoffset_top = rc;\    newframe->Xims = re;\
260      newframe->Xims = re;\    newframe->Xeptrb = rf;\
261      newframe->Xeptrb = rf;\    newframe->Xflags = rg;\
262      newframe->Xflags = rg;\    newframe->Xrdepth = frame->Xrdepth + 1;\
263      newframe->Xrdepth = frame->Xrdepth + 1;\    newframe->Xprevframe = frame;\
264      newframe->Xprevframe = frame;\    frame = newframe;\
265      frame = newframe;\    DPRINTF(("restarting from line %d\n", __LINE__));\
266      DPRINTF(("restarting from line %d\n", __LINE__));\    goto HEAP_RECURSE;\
267      goto HEAP_RECURSE;\    L_##rw:\
268      }\    DPRINTF(("jumped back to line %d\n", __LINE__));\
   else\  
     {\  
     DPRINTF(("longjumped back to line %d\n", __LINE__));\  
     frame = md->thisframe;\  
     rx = frame->Xresult;\  
     }\  
269    }    }
270    
271  #define RRETURN(ra)\  #define RRETURN(ra)\
# Line 256  match(), which never changes. */ Line 275  match(), which never changes. */
275    (pcre_stack_free)(newframe);\    (pcre_stack_free)(newframe);\
276    if (frame != NULL)\    if (frame != NULL)\
277      {\      {\
278      frame->Xresult = ra;\      rrc = ra;\
279      md->thisframe = frame;\      goto HEAP_RETURN;\
     longjmp(frame->Xwhere, 1);\  
280      }\      }\
281    return ra;\    return ra;\
282    }    }
# Line 323  typedef struct heapframe { Line 341  typedef struct heapframe {
341    
342    eptrblock Xnewptrb;    eptrblock Xnewptrb;
343    
344    /* Place to pass back result, and where to jump back to */    /* Where to jump back to */
   
   int  Xresult;  
   jmp_buf Xwhere;  
345    
346      int Xwhere;
347    
348  } heapframe;  } heapframe;
349    
350  #endif  #endif
# Line 545  defined). However, RMATCH isn't like a f Line 562  defined). However, RMATCH isn't like a f
562  complicated macro. It has to be used in one particular way. This shouldn't,  complicated macro. It has to be used in one particular way. This shouldn't,
563  however, impact performance when true recursion is being used. */  however, impact performance when true recursion is being used. */
564    
565    #ifdef SUPPORT_UTF8
566    utf8 = md->utf8;       /* Local copy of the flag */
567    #else
568    utf8 = FALSE;
569    #endif
570    
571  /* First check that we haven't called match() too many times, or that we  /* First check that we haven't called match() too many times, or that we
572  haven't exceeded the recursive call limit. */  haven't exceeded the recursive call limit. */
573    
# Line 553  if (rdepth >= md->match_limit_recursion) Line 576  if (rdepth >= md->match_limit_recursion)
576    
577  original_ims = ims;    /* Save for resetting on ')' */  original_ims = ims;    /* Save for resetting on ')' */
578    
 #ifdef SUPPORT_UTF8  
 utf8 = md->utf8;       /* Local copy of the flag */  
 #else  
 utf8 = FALSE;  
 #endif  
   
579  /* At the start of a group with an unlimited repeat that may match an empty  /* At the start of a group with an unlimited repeat that may match an empty
580  string, the match_cbegroup flag is set. When this is the case, add the current  string, the match_cbegroup flag is set. When this is the case, add the current
581  subject pointer to the chain of such remembered pointers, to be checked when we  subject pointer to the chain of such remembered pointers, to be checked when we
# Line 637  for (;;) Line 654  for (;;)
654        flags = (op == OP_SCBRA)? match_cbegroup : 0;        flags = (op == OP_SCBRA)? match_cbegroup : 0;
655        do        do
656          {          {
657          RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,          RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
658            ims, eptrb, flags);            ims, eptrb, flags, RM1);
659          if (rrc != MATCH_NOMATCH) RRETURN(rrc);          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
660          md->capture_last = save_capture_last;          md->capture_last = save_capture_last;
661          ecode += GET(ecode, 1);          ecode += GET(ecode, 1);
# Line 681  for (;;) Line 698  for (;;)
698        /* For non-final alternatives, continue the loop for a NOMATCH result;        /* For non-final alternatives, continue the loop for a NOMATCH result;
699        otherwise return. */        otherwise return. */
700    
701        RMATCH(rrc, eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,        RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, ims,
702          eptrb, flags);          eptrb, flags, RM2);
703        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
704        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
705        }        }
# Line 723  for (;;) Line 740  for (;;)
740    
741      else      else
742        {        {
743        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
744            match_condassert);            match_condassert, RM3);
745        if (rrc == MATCH_MATCH)        if (rrc == MATCH_MATCH)
746          {          {
747          condition = TRUE;          condition = TRUE;
# Line 802  for (;;) Line 819  for (;;)
819      case OP_ASSERTBACK:      case OP_ASSERTBACK:
820      do      do
821        {        {
822        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
823            RM4);
824        if (rrc == MATCH_MATCH) break;        if (rrc == MATCH_MATCH) break;
825        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
826        ecode += GET(ecode, 1);        ecode += GET(ecode, 1);
# Line 828  for (;;) Line 846  for (;;)
846      case OP_ASSERTBACK_NOT:      case OP_ASSERTBACK_NOT:
847      do      do
848        {        {
849        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL, 0,
850            RM5);
851        if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);        if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
852        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
853        ecode += GET(ecode,1);        ecode += GET(ecode,1);
# Line 957  for (;;) Line 976  for (;;)
976        flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;        flags = (*callpat >= OP_SBRA)? match_cbegroup : 0;
977        do        do
978          {          {
979          RMATCH(rrc, eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,          RMATCH(eptr, callpat + _pcre_OP_lengths[*callpat], offset_top,
980            md, ims, eptrb, flags);            md, ims, eptrb, flags, RM6);
981          if (rrc == MATCH_MATCH)          if (rrc == MATCH_MATCH)
982            {            {
983            DPRINTF(("Recursion matched\n"));            DPRINTF(("Recursion matched\n"));
# Line 1001  for (;;) Line 1020  for (;;)
1020    
1021      do      do
1022        {        {
1023        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,
1024          eptrb, 0);          eptrb, 0, RM7);
1025        if (rrc == MATCH_MATCH) break;        if (rrc == MATCH_MATCH) break;
1026        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1027        ecode += GET(ecode,1);        ecode += GET(ecode,1);
# Line 1047  for (;;) Line 1066  for (;;)
1066    
1067      if (*ecode == OP_KETRMIN)      if (*ecode == OP_KETRMIN)
1068        {        {
1069        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0,
1070            RM8);
1071        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1072        ecode = prev;        ecode = prev;
1073        flags = match_tail_recursed;        flags = match_tail_recursed;
# Line 1055  for (;;) Line 1075  for (;;)
1075        }        }
1076      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1077        {        {
1078        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_cbegroup);        RMATCH(eptr, prev, offset_top, md, ims, eptrb, match_cbegroup, RM9);
1079        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1080        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
1081        flags = match_tail_recursed;        flags = match_tail_recursed;
# Line 1079  for (;;) Line 1099  for (;;)
1099      case OP_BRAZERO:      case OP_BRAZERO:
1100        {        {
1101        next = ecode+1;        next = ecode+1;
1102        RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, next, offset_top, md, ims, eptrb, 0, RM10);
1103        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1104        do next += GET(next,1); while (*next == OP_ALT);        do next += GET(next,1); while (*next == OP_ALT);
1105        ecode = next + 1 + LINK_SIZE;        ecode = next + 1 + LINK_SIZE;
# Line 1090  for (;;) Line 1110  for (;;)
1110        {        {
1111        next = ecode+1;        next = ecode+1;
1112        do next += GET(next, 1); while (*next == OP_ALT);        do next += GET(next, 1); while (*next == OP_ALT);
1113        RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0, RM11);
1114        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1115        ecode++;        ecode++;
1116        }        }
# Line 1195  for (;;) Line 1215  for (;;)
1215    
1216      if (*ecode == OP_KETRMIN)      if (*ecode == OP_KETRMIN)
1217        {        {
1218        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);        RMATCH(eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0,
1219            RM12);
1220        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1221        ecode = prev;        ecode = prev;
1222        flags |= match_tail_recursed;        flags |= match_tail_recursed;
# Line 1203  for (;;) Line 1224  for (;;)
1224        }        }
1225      else  /* OP_KETRMAX */      else  /* OP_KETRMAX */
1226        {        {
1227        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, flags);        RMATCH(eptr, prev, offset_top, md, ims, eptrb, flags, RM13);
1228        if (rrc != MATCH_NOMATCH) RRETURN(rrc);        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1229        ecode += 1 + LINK_SIZE;        ecode += 1 + LINK_SIZE;
1230        flags = match_tail_recursed;        flags = match_tail_recursed;
# Line 1602  for (;;) Line 1623  for (;;)
1623          {          {
1624          for (fi = min;; fi++)          for (fi = min;; fi++)
1625            {            {
1626            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM14);
1627            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1628            if (fi >= max || !match_ref(offset, eptr, length, md, ims))            if (fi >= max || !match_ref(offset, eptr, length, md, ims))
1629              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
# Line 1623  for (;;) Line 1644  for (;;)
1644            }            }
1645          while (eptr >= pp)          while (eptr >= pp)
1646            {            {
1647            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM15);
1648            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1649            eptr -= length;            eptr -= length;
1650            }            }
# Line 1728  for (;;) Line 1749  for (;;)
1749            {            {
1750            for (fi = min;; fi++)            for (fi = min;; fi++)
1751              {              {
1752              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM16);
1753              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1754              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1755              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 1748  for (;;) Line 1769  for (;;)
1769            {            {
1770            for (fi = min;; fi++)            for (fi = min;; fi++)
1771              {              {
1772              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM17);
1773              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1774              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1775              c = *eptr++;              c = *eptr++;
# Line 1785  for (;;) Line 1806  for (;;)
1806              }              }
1807            for (;;)            for (;;)
1808              {              {
1809              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM18);
1810              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1811              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
1812              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 1804  for (;;) Line 1825  for (;;)
1825              }              }
1826            while (eptr >= pp)            while (eptr >= pp)
1827              {              {
1828              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM19);
1829              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1830              eptr--;              eptr--;
1831              }              }
# Line 1875  for (;;) Line 1896  for (;;)
1896          {          {
1897          for (fi = min;; fi++)          for (fi = min;; fi++)
1898            {            {
1899            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM20);
1900            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1901            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
1902            GETCHARINC(c, eptr);            GETCHARINC(c, eptr);
# Line 1899  for (;;) Line 1920  for (;;)
1920            }            }
1921          for(;;)          for(;;)
1922            {            {
1923            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM21);
1924            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
1925            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
1926            BACKCHAR(eptr)            BACKCHAR(eptr)
# Line 2086  for (;;) Line 2107  for (;;)
2107            {            {
2108            for (fi = min;; fi++)            for (fi = min;; fi++)
2109              {              {
2110              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM22);
2111              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2112              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2113              if (memcmp(eptr, charptr, length) == 0) eptr += length;              if (memcmp(eptr, charptr, length) == 0) eptr += length;
# Line 2127  for (;;) Line 2148  for (;;)
2148            if (possessive) continue;            if (possessive) continue;
2149            for(;;)            for(;;)
2150             {             {
2151             RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);             RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM23);
2152             if (rrc != MATCH_NOMATCH) RRETURN(rrc);             if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2153             if (eptr == pp) RRETURN(MATCH_NOMATCH);             if (eptr == pp) RRETURN(MATCH_NOMATCH);
2154  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
# Line 2176  for (;;) Line 2197  for (;;)
2197          {          {
2198          for (fi = min;; fi++)          for (fi = min;; fi++)
2199            {            {
2200            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM24);
2201            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2202            if (fi >= max || eptr >= md->end_subject ||            if (fi >= max || eptr >= md->end_subject ||
2203                fc != md->lcc[*eptr++])                fc != md->lcc[*eptr++])
# Line 2195  for (;;) Line 2216  for (;;)
2216          if (possessive) continue;          if (possessive) continue;
2217          while (eptr >= pp)          while (eptr >= pp)
2218            {            {
2219            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM25);
2220            eptr--;            eptr--;
2221            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2222            }            }
# Line 2214  for (;;) Line 2235  for (;;)
2235          {          {
2236          for (fi = min;; fi++)          for (fi = min;; fi++)
2237            {            {
2238            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM26);
2239            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2240            if (fi >= max || eptr >= md->end_subject || fc != *eptr++)            if (fi >= max || eptr >= md->end_subject || fc != *eptr++)
2241              RRETURN(MATCH_NOMATCH);              RRETURN(MATCH_NOMATCH);
# Line 2232  for (;;) Line 2253  for (;;)
2253          if (possessive) continue;          if (possessive) continue;
2254          while (eptr >= pp)          while (eptr >= pp)
2255            {            {
2256            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM27);
2257            eptr--;            eptr--;
2258            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2259            }            }
# Line 2377  for (;;) Line 2398  for (;;)
2398            register unsigned int d;            register unsigned int d;
2399            for (fi = min;; fi++)            for (fi = min;; fi++)
2400              {              {
2401              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM28);
2402              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2403              GETCHARINC(d, eptr);              GETCHARINC(d, eptr);
2404              if (d < 256) d = md->lcc[d];              if (d < 256) d = md->lcc[d];
# Line 2391  for (;;) Line 2412  for (;;)
2412            {            {
2413            for (fi = min;; fi++)            for (fi = min;; fi++)
2414              {              {
2415              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM29);
2416              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2417              if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])              if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])
2418                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
# Line 2423  for (;;) Line 2444  for (;;)
2444          if (possessive) continue;          if (possessive) continue;
2445          for(;;)          for(;;)
2446              {              {
2447              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM30);
2448              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2449              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
2450              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 2441  for (;;) Line 2462  for (;;)
2462            if (possessive) continue;            if (possessive) continue;
2463            while (eptr >= pp)            while (eptr >= pp)
2464              {              {
2465              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM31);
2466              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2467              eptr--;              eptr--;
2468              }              }
# Line 2486  for (;;) Line 2507  for (;;)
2507            register unsigned int d;            register unsigned int d;
2508            for (fi = min;; fi++)            for (fi = min;; fi++)
2509              {              {
2510              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM32);
2511              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2512              GETCHARINC(d, eptr);              GETCHARINC(d, eptr);
2513              if (fi >= max || eptr >= md->end_subject || fc == d)              if (fi >= max || eptr >= md->end_subject || fc == d)
# Line 2499  for (;;) Line 2520  for (;;)
2520            {            {
2521            for (fi = min;; fi++)            for (fi = min;; fi++)
2522              {              {
2523              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM33);
2524              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2525              if (fi >= max || eptr >= md->end_subject || fc == *eptr++)              if (fi >= max || eptr >= md->end_subject || fc == *eptr++)
2526                RRETURN(MATCH_NOMATCH);                RRETURN(MATCH_NOMATCH);
# Line 2530  for (;;) Line 2551  for (;;)
2551            if (possessive) continue;            if (possessive) continue;
2552            for(;;)            for(;;)
2553              {              {
2554              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM34);
2555              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2556              if (eptr-- == pp) break;        /* Stop if tried at original pos */              if (eptr-- == pp) break;        /* Stop if tried at original pos */
2557              BACKCHAR(eptr);              BACKCHAR(eptr);
# Line 2548  for (;;) Line 2569  for (;;)
2569            if (possessive) continue;            if (possessive) continue;
2570            while (eptr >= pp)            while (eptr >= pp)
2571              {              {
2572              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM35);
2573              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2574              eptr--;              eptr--;
2575              }              }
# Line 2945  for (;;) Line 2966  for (;;)
2966            case PT_ANY:            case PT_ANY:
2967            for (fi = min;; fi++)            for (fi = min;; fi++)
2968              {              {
2969              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM36);
2970              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2971              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2972              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 2956  for (;;) Line 2977  for (;;)
2977            case PT_LAMP:            case PT_LAMP:
2978            for (fi = min;; fi++)            for (fi = min;; fi++)
2979              {              {
2980              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM37);
2981              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2982              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2983              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 2971  for (;;) Line 2992  for (;;)
2992            case PT_GC:            case PT_GC:
2993            for (fi = min;; fi++)            for (fi = min;; fi++)
2994              {              {
2995              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM38);
2996              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
2997              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
2998              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 2984  for (;;) Line 3005  for (;;)
3005            case PT_PC:            case PT_PC:
3006            for (fi = min;; fi++)            for (fi = min;; fi++)
3007              {              {
3008              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM39);
3009              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3010              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3011              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 2997  for (;;) Line 3018  for (;;)
3018            case PT_SC:            case PT_SC:
3019            for (fi = min;; fi++)            for (fi = min;; fi++)
3020              {              {
3021              RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);              RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM40);
3022              if (rrc != MATCH_NOMATCH) RRETURN(rrc);              if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3023              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);              if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3024              GETCHARINC(c, eptr);              GETCHARINC(c, eptr);
# Line 3019  for (;;) Line 3040  for (;;)
3040          {          {
3041          for (fi = min;; fi++)          for (fi = min;; fi++)
3042            {            {
3043            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM41);
3044            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3045            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
3046            GETCHARINCTEST(c, eptr);            GETCHARINCTEST(c, eptr);
# Line 3048  for (;;) Line 3069  for (;;)
3069          {          {
3070          for (fi = min;; fi++)          for (fi = min;; fi++)
3071            {            {
3072            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM42);
3073            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3074            if (fi >= max || eptr >= md->end_subject ||            if (fi >= max || eptr >= md->end_subject ||
3075                 (ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 &&                 (ctype == OP_ANY && (ims & PCRE_DOTALL) == 0 &&
# Line 3122  for (;;) Line 3143  for (;;)
3143          {          {
3144          for (fi = min;; fi++)          for (fi = min;; fi++)
3145            {            {
3146            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM43);
3147            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3148            if (fi >= max || eptr >= md->end_subject ||            if (fi >= max || eptr >= md->end_subject ||
3149                 ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))                 ((ims & PCRE_DOTALL) == 0 && IS_NEWLINE(eptr)))
# Line 3268  for (;;) Line 3289  for (;;)
3289          if (possessive) continue;          if (possessive) continue;
3290          for(;;)          for(;;)
3291            {            {
3292            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM44);
3293            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3294            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
3295            BACKCHAR(eptr);            BACKCHAR(eptr);
# Line 3304  for (;;) Line 3325  for (;;)
3325          if (possessive) continue;          if (possessive) continue;
3326          for(;;)          for(;;)
3327            {            {
3328            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM45);
3329            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3330            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
3331            for (;;)                        /* Move back over one extended */            for (;;)                        /* Move back over one extended */
# Line 3488  for (;;) Line 3509  for (;;)
3509          if (possessive) continue;          if (possessive) continue;
3510          for(;;)          for(;;)
3511            {            {
3512            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM46);
3513            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3514            if (eptr-- == pp) break;        /* Stop if tried at original pos */            if (eptr-- == pp) break;        /* Stop if tried at original pos */
3515            BACKCHAR(eptr);            BACKCHAR(eptr);
# Line 3602  for (;;) Line 3623  for (;;)
3623          if (possessive) continue;          if (possessive) continue;
3624          while (eptr >= pp)          while (eptr >= pp)
3625            {            {
3626            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);            RMATCH(eptr, ecode, offset_top, md, ims, eptrb, 0, RM47);
3627            eptr--;            eptr--;
3628            if (rrc != MATCH_NOMATCH) RRETURN(rrc);            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
3629            }            }
# Line 3628  for (;;) Line 3649  for (;;)
3649    
3650    }             /* End of main loop */    }             /* End of main loop */
3651  /* Control never reaches here */  /* Control never reaches here */
3652    
3653    
3654    /* When compiling to use the heap rather than the stack for recursive calls to
3655    match(), the RRETURN() macro jumps here. The number that is saved in
3656    frame->Xwhere indicates which label we actually want to return to. */
3657    
3658    #ifdef NO_RECURSE
3659    #define LBL(val) case val: goto L_RM##val;
3660    HEAP_RETURN:
3661    switch (frame->Xwhere)
3662      {
3663      LBL( 1) LBL( 2) LBL( 3) LBL( 4) LBL( 5) LBL( 6) LBL( 7) LBL( 8)
3664      LBL( 9) LBL(10) LBL(11) LBL(12) LBL(13) LBL(14) LBL(15) LBL(16)
3665      LBL(17) LBL(18) LBL(19) LBL(20) LBL(21) LBL(22) LBL(23) LBL(24)
3666      LBL(25) LBL(26) LBL(27) LBL(28) LBL(29) LBL(30) LBL(31) LBL(32)
3667      LBL(33) LBL(34) LBL(35) LBL(36) LBL(37) LBL(38) LBL(39) LBL(40)
3668      LBL(41) LBL(42) LBL(43) LBL(44) LBL(45) LBL(46) LBL(47)
3669      default:
3670      DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere));
3671      return PCRE_ERROR_INTERNAL;
3672      }
3673    #undef LBL
3674    #endif  /* NO_RECURSE */
3675  }  }
3676    
3677    

Legend:
Removed from v.150  
changed lines
  Added in v.164

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12