summaryrefslogtreecommitdiff
path: root/doc/pcrejit.3
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-02-18 18:45:55 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-02-18 18:45:55 +0000
commit0c93c6b96052e711b78d83166348b6c09bf4270d (patch)
tree3ea34c460f31f49e8357070545145be06e64969a /doc/pcrejit.3
parent1f561d2f2a6982000e4037c9a5b4072ecae9b532 (diff)
downloadpcre-0c93c6b96052e711b78d83166348b6c09bf4270d.tar.gz
Update documentation for partial matching support in JIT.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@921 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'doc/pcrejit.3')
-rw-r--r--doc/pcrejit.352
1 files changed, 32 insertions, 20 deletions
diff --git a/doc/pcrejit.3 b/doc/pcrejit.3
index 0a32a11..66c282e 100644
--- a/doc/pcrejit.3
+++ b/doc/pcrejit.3
@@ -40,15 +40,13 @@ JIT. The support is limited to the following hardware platforms:
MIPS 32-bit
Power PC 32-bit and 64-bit
.sp
-The Power PC support is designated as experimental because it has not been
-fully tested. If --enable-jit is set on an unsupported platform, compilation
-fails.
+If --enable-jit is set on an unsupported platform, compilation fails.
.P
A program that is linked with PCRE 8.20 or later can tell if JIT support is
available by calling \fBpcre_config()\fP with the PCRE_CONFIG_JIT option. The
result is 1 when JIT is available, and 0 otherwise. However, a simple program
does not need to check this in order to use JIT. The API is implemented in a
-way that falls back to the ordinary PCRE code if JIT is not available.
+way that falls back to the interpretive code if JIT is not available.
.P
If your program may sometimes be linked with versions of PCRE that are older
than 8.20, but you want to use JIT when it is available, you can test
@@ -66,7 +64,7 @@ You have to do two things to make use of the JIT support in the simplest way:
\fBpcre_exec()\fP.
.sp
(2) Use \fBpcre_free_study()\fP to free the \fBpcre_extra\fP block when it is
- no longer needed instead of just freeing it yourself. This
+ no longer needed, instead of just freeing it yourself. This
ensures that any JIT data is also freed.
.sp
For a program that may be linked with pre-8.20 versions of PCRE, you can insert
@@ -84,6 +82,20 @@ this to free the study data:
pcre_free(study_ptr);
#endif
.sp
+PCRE_STUDY_JIT_COMPILE requests the JIT compiler to generate code for complete
+matches. If you want to run partial matches using the PCRE_PARTIAL_HARD or
+PCRE_PARTIAL_SOFT options of \fBpcre_exec()\fP, you should set one or both of
+the following options in addition to, or instead of, PCRE_STUDY_JIT_COMPILE
+when you call \fBpcre_study()\fP:
+.sp
+ PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
+ PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
+.sp
+The JIT compiler generates different optimized code for each of the three
+modes (normal, soft partial, hard partial). When \fBpcre_exec()\fP is called,
+the appropriate code is run if it is available. Otherwise, the pattern is
+matched using interpretive code.
+.P
In some circumstances you may need to call additional functions. These are
described in the section entitled
.\" HTML <a href="#stackcontrol">
@@ -92,12 +104,13 @@ described in the section entitled
.\"
below.
.P
-If JIT support is not available, PCRE_STUDY_JIT_COMPILE is ignored, and no JIT
-data is set up. Otherwise, the compiled pattern is passed to the JIT compiler,
-which turns it into machine code that executes much faster than the normal
-interpretive code. When \fBpcre_exec()\fP is passed a \fBpcre_extra\fP block
-containing a pointer to JIT code, it obeys that instead of the normal code. The
-result is identical, but the code runs much faster.
+If JIT support is not available, PCRE_STUDY_JIT_COMPILE etc. are ignored, and
+no JIT data is created. Otherwise, the compiled pattern is passed to the JIT
+compiler, which turns it into machine code that executes much faster than the
+normal interpretive code. When \fBpcre_exec()\fP is passed a \fBpcre_extra\fP
+block containing a pointer to JIT code of the appropriate mode (normal or
+hard/soft partial), it obeys that code instead of running the interpreter. The
+result is identical, but the compiled JIT code runs much faster.
.P
There are some \fBpcre_exec()\fP options that are not supported for JIT
execution. There are also some pattern items that JIT cannot handle. Details
@@ -108,8 +121,8 @@ If the JIT compiler finds an unsupported item, no JIT data is generated. You
can find out if JIT execution is available after studying a pattern by calling
\fBpcre_fullinfo()\fP with the PCRE_INFO_JIT option. A result of 1 means that
JIT compilation was successful. A result of 0 means that JIT support is not
-available, or the pattern was not studied with PCRE_STUDY_JIT_COMPILE, or the
-JIT compiler was not able to handle the pattern.
+available, or the pattern was not studied with PCRE_STUDY_JIT_COMPILE etc., or
+the JIT compiler was not able to handle the pattern.
.P
Once a pattern has been studied, with or without JIT, it can be used as many
times as you like for matching different subject strings.
@@ -119,9 +132,8 @@ times as you like for matching different subject strings.
.rs
.sp
The only \fBpcre_exec()\fP options that are supported for JIT execution are
-PCRE_NO_UTF8_CHECK, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, and
-PCRE_NOTEMPTY_ATSTART. Note in particular that partial matching is not
-supported.
+PCRE_NO_UTF8_CHECK, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY,
+PCRE_NOTEMPTY_ATSTART, PCRE_PARTIAL_HARD, and PCRE_PARTIAL_SOFT.
.P
The unsupported pattern items are:
.sp
@@ -210,8 +222,8 @@ should use. Its arguments are as follows:
void *data
.sp
The \fIextra\fP argument must be the result of studying a pattern with
-PCRE_STUDY_JIT_COMPILE. There are three cases for the values of the other two
-options:
+PCRE_STUDY_JIT_COMPILE etc. There are three cases for the values of the other
+two options:
.sp
(1) If \fIcallback\fP is NULL and \fIdata\fP is NULL, an internal 32K block
on the machine stack is used.
@@ -250,7 +262,7 @@ This is a suggestion for how a typical multithreaded program might operate:
All the functions described in this section do nothing if JIT is not available,
and \fBpcre_assign_jit_stack()\fP does nothing unless the \fBextra\fP argument
is non-NULL and points to a \fBpcre_extra\fP block that is the result of a
-successful study with PCRE_STUDY_JIT_COMPILE.
+successful study with PCRE_STUDY_JIT_COMPILE etc.
.
.
.\" HTML <a name="stackfaq"></a>
@@ -367,6 +379,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 08 January 2012
+Last updated: 18 February 2012
Copyright (c) 1997-2012 University of Cambridge.
.fi