28 |
ARM v5, v7, and Thumb2 |
ARM v5, v7, and Thumb2 |
29 |
Intel x86 32-bit and 64-bit |
Intel x86 32-bit and 64-bit |
30 |
MIPS 32-bit |
MIPS 32-bit |
31 |
Power PC 32-bit and 64-bit |
Power PC 32-bit and 64-bit (experimental) |
32 |
.sp |
.sp |
33 |
If --enable-jit is set on an unsupported platform, compilation fails. |
The Power PC support is designated as experimental because it has not been |
34 |
|
fully tested. If --enable-jit is set on an unsupported platform, compilation |
35 |
|
fails. |
36 |
.P |
.P |
37 |
A program can tell if JIT support is available by calling \fBpcre_config()\fP |
A program can tell if JIT support is available by calling \fBpcre_config()\fP |
38 |
with the PCRE_CONFIG_JIT option. The result is 1 when JIT is available, and 0 |
with the PCRE_CONFIG_JIT option. The result is 1 when JIT is available, and 0 |
49 |
(1) Call \fBpcre_study()\fP with the PCRE_STUDY_JIT_COMPILE option for |
(1) Call \fBpcre_study()\fP with the PCRE_STUDY_JIT_COMPILE option for |
50 |
each compiled pattern, and pass the resulting \fBpcre_extra\fP block to |
each compiled pattern, and pass the resulting \fBpcre_extra\fP block to |
51 |
\fBpcre_exec()\fP. |
\fBpcre_exec()\fP. |
52 |
|
.sp |
53 |
(2) Use \fBpcre_free_study()\fP to free the \fBpcre_extra\fP block when it is |
(2) Use \fBpcre_free_study()\fP to free the \fBpcre_extra\fP block when it is |
54 |
no longer needed instead of just freeing it yourself. This |
no longer needed instead of just freeing it yourself. This |
55 |
ensures that any JIT data is also freed. |
ensures that any JIT data is also freed. |
56 |
.sp |
.sp |
57 |
In some circumstances you may need to call additional functions. These are |
In some circumstances you may need to call additional functions. These are |
77 |
If the JIT compiler finds an unsupported item, no JIT data is generated. You |
If the JIT compiler finds an unsupported item, no JIT data is generated. You |
78 |
can find out if JIT execution is available after studying a pattern by calling |
can find out if JIT execution is available after studying a pattern by calling |
79 |
\fBpcre_fullinfo()\fP with the PCRE_INFO_JIT option. A result of 1 means that |
\fBpcre_fullinfo()\fP with the PCRE_INFO_JIT option. A result of 1 means that |
80 |
JIT compilationw was successful. A result of 0 means that JIT support is not |
JIT compilation was successful. A result of 0 means that JIT support is not |
81 |
available, or the pattern was not studied with PCRE_STUDY_JIT_COMPILE, or the |
available, or the pattern was not studied with PCRE_STUDY_JIT_COMPILE, or the |
82 |
JIT compiler was not able to handle the pattern. |
JIT compiler was not able to handle the pattern. |
83 |
|
.P |
84 |
|
Once a pattern has been studied, with or without JIT, it can be used as many |
85 |
|
times as you like for matching different subject strings. |
86 |
. |
. |
87 |
. |
. |
88 |
.SH "UNSUPPORTED OPTIONS AND PATTERN ITEMS" |
.SH "UNSUPPORTED OPTIONS AND PATTERN ITEMS" |
95 |
.P |
.P |
96 |
The unsupported pattern items are: |
The unsupported pattern items are: |
97 |
.sp |
.sp |
98 |
\eC match a single byte, even in UTF-8 mode |
\eC match a single byte; not supported in UTF-8 mode |
99 |
(?Cn) callouts |
(?Cn) callouts |
100 |
(?(<name>)... conditional test on setting of a named subpattern |
(?(<name>)... conditional test on setting of a named subpattern |
101 |
(?(R)... conditional test on whole pattern recursion |
(?(R)... conditional test on whole pattern recursion |
136 |
.rs |
.rs |
137 |
.sp |
.sp |
138 |
The code that is generated by the JIT compiler is architecture-specific, and is |
The code that is generated by the JIT compiler is architecture-specific, and is |
139 |
also position dependent. For those reasons it cannot be saved and restored like |
also position dependent. For those reasons it cannot be saved (in a file or |
140 |
the bytecode and other data of a compiled pattern. You should be able run |
database) and restored later like the bytecode and other data of a compiled |
141 |
\fBpcre_study()\fP on a saved and restored pattern, and thereby recreate the |
pattern. Saving and restoring compiled patterns is not something many people |
142 |
JIT data, but because JIT compilation uses significant resources, it is |
do. More detail about this facility is given in the |
143 |
probably not worth doing this. |
.\" HREF |
144 |
|
\fBpcreprecompile\fP |
145 |
|
.\" |
146 |
|
documentation. It should be possible to run \fBpcre_study()\fP on a saved and |
147 |
|
restored pattern, and thereby recreate the JIT data, but because JIT |
148 |
|
compilation uses significant resources, it is probably not worth doing this; |
149 |
|
you might as well recompile the original pattern. |
150 |
. |
. |
151 |
. |
. |
152 |
.\" HTML <a name="stackcontrol"></a> |
.\" HTML <a name="stackcontrol"></a> |
160 |
managing blocks of memory for use as JIT stacks. |
managing blocks of memory for use as JIT stacks. |
161 |
.P |
.P |
162 |
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 |
163 |
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 |
164 |
structure of type \fBpcre_jit_stack\fP, or NULL if there is an error. The |
structure of type \fBpcre_jit_stack\fP, or NULL if there is an error. The |
165 |
\fBpcre_jit_stack_free()\fP function can be used to free a stack that is no |
\fBpcre_jit_stack_free()\fP function can be used to free a stack that is no |
166 |
longer needed. (For the technically minded: the address space is allocated by |
longer needed. (For the technically minded: the address space is allocated by |
167 |
mmap or VirtualAlloc.) |
mmap or VirtualAlloc.) |
168 |
.P |
.P |
169 |
JIT uses far less memory for recursion than the interpretive code, |
JIT uses far less memory for recursion than the interpretive code, |
170 |
and a maximum stack size of 512K to 1M should be more than enough for any |
and a maximum stack size of 512K to 1M should be more than enough for any |
171 |
pattern. |
pattern. |
172 |
.P |
.P |
208 |
.sp |
.sp |
209 |
During thread initalization |
During thread initalization |
210 |
thread_local_var = pcre_jit_stack_alloc(...) |
thread_local_var = pcre_jit_stack_alloc(...) |
211 |
|
.sp |
212 |
During thread exit |
During thread exit |
213 |
pcre_jit_stack_free(thread_local_var) |
pcre_jit_stack_free(thread_local_var) |
214 |
|
.sp |
215 |
Use a one-line callback function |
Use a one-line callback function |
216 |
return thread_local_var |
return thread_local_var |
217 |
.sp |
.sp |
225 |
.rs |
.rs |
226 |
.sp |
.sp |
227 |
This is a single-threaded example that specifies a JIT stack without using a |
This is a single-threaded example that specifies a JIT stack without using a |
228 |
callback. |
callback. |
229 |
.sp |
.sp |
230 |
int rc; |
int rc; |
231 |
int ovector[30]; |
int ovector[30]; |
243 |
/* Check results */ |
/* Check results */ |
244 |
pcre_free(re); |
pcre_free(re); |
245 |
pcre_free_study(extra); |
pcre_free_study(extra); |
246 |
pcre_jit_stack_free(jit_stack); |
pcre_jit_stack_free(jit_stack); |
247 |
.sp |
.sp |
248 |
. |
. |
249 |
. |
. |
267 |
.rs |
.rs |
268 |
.sp |
.sp |
269 |
.nf |
.nf |
270 |
Last updated: 06 September 2011 |
Last updated: 19 October 2011 |
271 |
Copyright (c) 1997-2011 University of Cambridge. |
Copyright (c) 1997-2011 University of Cambridge. |
272 |
.fi |
.fi |