/[pcre]/code/trunk/doc/pcrejit.3
ViewVC logotype

Diff of /code/trunk/doc/pcrejit.3

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

revision 768 by ph10, Sat Nov 26 19:05:39 2011 UTC revision 788 by ph10, Tue Dec 6 15:38:01 2011 UTC
# Line 43  way that falls back to the ordinary PCRE Line 43  way that falls back to the ordinary PCRE
43  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
44  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
45  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
46  as PCRE_CONFIG_JIT, for compile-time control of your code.  as PCRE_CONFIG_JIT, for compile-time control of your code.
47  .  .
48  .  .
49  .SH "SIMPLE USE OF JIT"  .SH "SIMPLE USE OF JIT"
# Line 65  For a program that may be linked with pr Line 65  For a program that may be linked with pr
65    #define PCRE_STUDY_JIT_COMPILE 0    #define PCRE_STUDY_JIT_COMPILE 0
66    #endif    #endif
67  .sp  .sp
68  so that no option is passed to \fBpcre_study()\fP, and then use something like  so that no option is passed to \fBpcre_study()\fP, and then use something like
69  this to free the study data:  this to free the study data:
70  .sp  .sp
71    #ifdef PCRE_CONFIG_JIT    #ifdef PCRE_CONFIG_JIT
# Line 179  about the use of JIT stacks in the secti Line 179  about the use of JIT stacks in the secti
179  .\" </a>  .\" </a>
180  "JIT stack FAQ"  "JIT stack FAQ"
181  .\"  .\"
182  below.  below.
183  .P  .P
184  The \fBpcre_jit_stack_alloc()\fP function creates a JIT stack. Its arguments  The \fBpcre_jit_stack_alloc()\fP function creates a JIT stack. Its arguments
185  are a starting size and a maximum size, and it returns a pointer to an opaque  are a starting size and a maximum size, and it returns a pointer to an opaque
# Line 256  stack chain needs to be updated every ti Line 256  stack chain needs to be updated every ti
256  Although it is possible, its updating time overhead decreases performance. So  Although it is possible, its updating time overhead decreases performance. So
257  we do the recursion in memory.  we do the recursion in memory.
258  .P  .P
259  (2) Why don't we simply allocate blocks of memory with \fBmalloc()\fP?  (2) Why don't we simply allocate blocks of memory with \fBmalloc()\fP?
260  .sp  .sp
261  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
262  instead of allocating memory. We can safely allocate memory pages inside this  instead of allocating memory. We can safely allocate memory pages inside this
# Line 265  important because of pointers). Thus we Line 265  important because of pointers). Thus we
265  only a single memory page (usually 4K) if that is enough. However, we can still  only a single memory page (usually 4K) if that is enough. However, we can still
266  grow up to 1M anytime if needed.  grow up to 1M anytime if needed.
267  .P  .P
268  (3) Who "owns" a JIT stack?  (3) Who "owns" a JIT stack?
269  .sp  .sp
270  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
271  anything else. The user program must ensure that if a stack is used by  anything else. The user program must ensure that if a stack is used by
# Line 296  list of the currently JIT studied patter Line 296  list of the currently JIT studied patter
296  .P  .P
297  (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
298  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
299  stack is freed?  stack is freed?
300  .sp  .sp
301  Especially on embedded sytems, it might be a good idea to release  Especially on embedded sytems, it might be a good idea to release
302  memory sometimes without freeing the stack. There is no API for this at the  memory sometimes without freeing the stack. There is no API for this at the
# Line 305  memory for any stack and another which a Line 305  memory for any stack and another which a
305  stack) would be a good idea if someone needs this.  stack) would be a good idea if someone needs this.
306  .P  .P
307  (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
308  stack handling?  stack handling?
309  .sp  .sp
310  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
311  out this complicated API.  out this complicated API.

Legend:
Removed from v.768  
changed lines
  Added in v.788

  ViewVC Help
Powered by ViewVC 1.1.5