| 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 |
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 |
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 |
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 |
provide a unique number for each call to RMATCH. There is no way of generating |
| 198 |
|
|
| 199 |
Crude tests on x86 Linux show a small speedup of around 5-8%. However, on |
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 |
FreeBSD, avoiding longjmp() more than halves the time taken to run the standard |
| 201 |
tests. Furthermore, not using longjmp() means that local dynamic variables |
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 |
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 |
reduced because the result can be "passed back" by straight setting of the |
| 204 |
variable instead of being passed in the frame. |
variable instead of being passed in the frame. |
| 205 |
**************************************************************************** |
**************************************************************************** |
| 213 |
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
RM21, RM22, RM23, RM24, RM25, RM26, RM27, RM28, RM29, RM30, |
| 214 |
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40, |
| 215 |
RM41, RM42, RM43, RM44, RM45, RM46, RM47 }; |
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. Note that the "rw" argument of RMATCH isn't |
versions and production versions. Note that the "rw" argument of RMATCH isn't |
| 220 |
actuall used in this definition. */ |
actuall used in this definition. */ |
| 221 |
|
|
| 222 |
#ifndef NO_RECURSE |
#ifndef NO_RECURSE |
| 344 |
/* Where to jump back to */ |
/* Where to jump back to */ |
| 345 |
|
|
| 346 |
int Xwhere; |
int Xwhere; |
| 347 |
|
|
| 348 |
} heapframe; |
} heapframe; |
| 349 |
|
|
| 350 |
#endif |
#endif |
| 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 |
/* 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 |
match(), the RRETURN() macro jumps here. The number that is saved in |
| 3656 |
frame->Xwhere indicates which label we actually want to return to. */ |
frame->Xwhere indicates which label we actually want to return to. */ |
| 3657 |
|
|
| 3658 |
#ifdef NO_RECURSE |
#ifdef NO_RECURSE |
| 3670 |
DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere)); |
DPRINTF(("jump error in pcre match: label %d non-existent\n", frame->Xwhere)); |
| 3671 |
return PCRE_ERROR_INTERNAL; |
return PCRE_ERROR_INTERNAL; |
| 3672 |
} |
} |
| 3673 |
#undef LBL |
#undef LBL |
| 3674 |
#endif /* NO_RECURSE */ |
#endif /* NO_RECURSE */ |
| 3675 |
} |
} |
| 3676 |
|
|