| 68 |
If your program may sometimes be linked with versions of PCRE that are older |
If your program may sometimes be linked with versions of PCRE that are older |
| 69 |
than 8.20, but you want to use JIT when it is available, you can test |
than 8.20, but you want to use JIT when it is available, you can test |
| 70 |
the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such |
the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such |
| 71 |
as PCRE_CONFIG_JIT, for compile-time control of your code. |
as PCRE_CONFIG_JIT, for compile-time control of your code. |
| 72 |
</P> |
</P> |
| 73 |
<br><a name="SEC3" href="#TOC1">SIMPLE USE OF JIT</a><br> |
<br><a name="SEC3" href="#TOC1">SIMPLE USE OF JIT</a><br> |
| 74 |
<P> |
<P> |
| 88 |
#define PCRE_STUDY_JIT_COMPILE 0 |
#define PCRE_STUDY_JIT_COMPILE 0 |
| 89 |
#endif |
#endif |
| 90 |
</pre> |
</pre> |
| 91 |
so that no option is passed to <b>pcre_study()</b>, and then use something like |
so that no option is passed to <b>pcre_study()</b>, and then use something like |
| 92 |
this to free the study data: |
this to free the study data: |
| 93 |
<pre> |
<pre> |
| 94 |
#ifdef PCRE_CONFIG_JIT |
#ifdef PCRE_CONFIG_JIT |
| 188 |
managing blocks of memory for use as JIT stacks. There is further discussion |
managing blocks of memory for use as JIT stacks. There is further discussion |
| 189 |
about the use of JIT stacks in the section entitled |
about the use of JIT stacks in the section entitled |
| 190 |
<a href="#stackcontrol">"JIT stack FAQ"</a> |
<a href="#stackcontrol">"JIT stack FAQ"</a> |
| 191 |
below. |
below. |
| 192 |
</P> |
</P> |
| 193 |
<P> |
<P> |
| 194 |
The <b>pcre_jit_stack_alloc()</b> function creates a JIT stack. Its arguments |
The <b>pcre_jit_stack_alloc()</b> function creates a JIT stack. Its arguments |
| 269 |
we do the recursion in memory. |
we do the recursion in memory. |
| 270 |
</P> |
</P> |
| 271 |
<P> |
<P> |
| 272 |
(2) Why don't we simply allocate blocks of memory with <b>malloc()</b>? |
(2) Why don't we simply allocate blocks of memory with <b>malloc()</b>? |
| 273 |
<br> |
<br> |
| 274 |
<br> |
<br> |
| 275 |
Modern operating systems have a nice feature: they can reserve an address space |
Modern operating systems have a nice feature: they can reserve an address space |
| 280 |
grow up to 1M anytime if needed. |
grow up to 1M anytime if needed. |
| 281 |
</P> |
</P> |
| 282 |
<P> |
<P> |
| 283 |
(3) Who "owns" a JIT stack? |
(3) Who "owns" a JIT stack? |
| 284 |
<br> |
<br> |
| 285 |
<br> |
<br> |
| 286 |
The owner of the stack is the user program, not the JIT studied pattern or |
The owner of the stack is the user program, not the JIT studied pattern or |
| 317 |
<P> |
<P> |
| 318 |
(6) OK, the stack is for long term memory allocation. But what happens if a |
(6) OK, the stack is for long term memory allocation. But what happens if a |
| 319 |
pattern causes stack overflow with a stack of 1M? Is that 1M kept until the |
pattern causes stack overflow with a stack of 1M? Is that 1M kept until the |
| 320 |
stack is freed? |
stack is freed? |
| 321 |
<br> |
<br> |
| 322 |
<br> |
<br> |
| 323 |
Especially on embedded sytems, it might be a good idea to release |
Especially on embedded sytems, it might be a good idea to release |
| 328 |
</P> |
</P> |
| 329 |
<P> |
<P> |
| 330 |
(7) This is too much of a headache. Isn't there any better solution for JIT |
(7) This is too much of a headache. Isn't there any better solution for JIT |
| 331 |
stack handling? |
stack handling? |
| 332 |
<br> |
<br> |
| 333 |
<br> |
<br> |
| 334 |
No, thanks to Windows. If POSIX threads were used everywhere, we could throw |
No, thanks to Windows. If POSIX threads were used everywhere, we could throw |