Move context argument to last in pcre2_jit_stack_create().

This commit is contained in:
Philip.Hazel 2014-11-28 12:46:16 +00:00
parent 9fcdf2cc6f
commit 161cd17ba0
14 changed files with 115 additions and 116 deletions

View File

@ -19,18 +19,18 @@ SYNOPSIS
<b>#include &#60;pcre2.h&#62;</b>
</P>
<P>
<b>pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *<i>gcontext</i>,</b>
<b> PCRE2_SIZE <i>startsize</i>, PCRE2_SIZE <i>maxsize</i>);</b>
<b>pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE <i>startsize</i>,</b>
<b> PCRE2_SIZE <i>maxsize</i>, pcre2_general_context *<i>gcontext</i>);</b>
</P>
<br><b>
DESCRIPTION
</b><br>
<P>
This function is used to create a stack for use by the code compiled by the JIT
compiler. The first argument is a general context, for memory allocation
functions, or NULL for standard memory allocation. The remaining arguments are
a starting size for the stack, and a maximum size to which it is allowed to
grow. The result can be passed to the JIT run-time code by calling
compiler. The first two arguments are a starting size for the stack, and a
maximum size to which it is allowed to grow. The final argument is a general
context, for memory allocation functions, or NULL for standard memory
allocation. The result can be passed to the JIT run-time code by calling
<b>pcre2_jit_stack_assign()</b> to associate the stack with a compiled pattern,
which can then be processed by <b>pcre2_match()</b>. If the "fast path" JIT
matcher, <b>pcre2_jit_match()</b> is used, the stack can be passed directly as

View File

@ -22,7 +22,7 @@ SYNOPSIS
<b>int pcre2_substitute(const pcre2_code *<i>code</i>, PCRE2_SPTR <i>subject</i>,</b>
<b> PCRE2_SIZE <i>length</i>, PCRE2_SIZE <i>startoffset</i>,</b>
<b> uint32_t <i>options</i>, pcre2_match_data *<i>match_data</i>,</b>
<b> pcre2_match_context *<i>mcontext</i>, PCRE2_SPTR \fIreplacementzfP,</b>
<b> pcre2_match_context *<i>mcontext</i>, PCRE2_SPTR <i>replacement</i>,</b>
<b> PCRE2_SIZE <i>rlength</i>, PCRE2_UCHAR *<i>outputbuffer</i>,</b>
<b> PCRE2_SIZE *<i>outlengthptr</i>);</b>
</P>

View File

@ -250,8 +250,8 @@ document for an overview of all the PCRE2 documentation.
<b>void pcre2_jit_free_unused_memory(pcre2_general_context *<i>gcontext</i>);</b>
<br>
<br>
<b>pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *<i>gcontext</i>,</b>
<b> PCRE2_SIZE <i>startsize</i>, PCRE2_SIZE <i>maxsize</i>);</b>
<b>pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE <i>startsize</i>,</b>
<b> PCRE2_SIZE <i>maxsize</i>, pcre2_general_context *<i>gcontext</i>);</b>
<br>
<br>
<b>void pcre2_jit_stack_assign(pcre2_match_context *<i>mcontext</i>,</b>
@ -1308,8 +1308,8 @@ textual error message from any error code.
<b>void pcre2_jit_free_unused_memory(pcre2_general_context *<i>gcontext</i>);</b>
<br>
<br>
<b>pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *<i>gcontext</i>,</b>
<b> PCRE2_SIZE <i>startsize</i>, PCRE2_SIZE <i>maxsize</i>);</b>
<b>pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE <i>startsize</i>,</b>
<b> PCRE2_SIZE <i>maxsize</i>, pcre2_general_context *<i>gcontext</i>);</b>
<br>
<br>
<b>void pcre2_jit_stack_assign(pcre2_match_context *<i>mcontext</i>,</b>
@ -2681,7 +2681,7 @@ Cambridge, England.
</P>
<br><a name="SEC37" href="#TOC1">REVISION</a><br>
<P>
Last updated: 26 November 2014
Last updated: 27 November 2014
<br>
Copyright &copy; 1997-2014 University of Cambridge.
<br>

View File

@ -177,8 +177,8 @@ below.
</P>
<P>
The <b>pcre2_jit_stack_create()</b> function creates a JIT stack. Its arguments
are a general context (for memory allocation functions, or NULL for standard
memory allocation), a starting size and a maximum size, and it returns a
are a starting size, a maximum size, and a general context (for memory
allocation functions, or NULL for standard memory allocation). It returns a
pointer to an opaque structure of type <b>pcre2_jit_stack</b>, or NULL if there
is an error. The <b>pcre2_jit_stack_free()</b> function is used to free a stack
that is no longer needed. (For the technically minded: the address space is
@ -360,7 +360,7 @@ calls.
&errornumber, &erroffset, NULL);
rc = pcre2_jit_compile(re, PCRE2_JIT_COMPLETE);
mcontext = pcre2_match_context_create(NULL);
jit_stack = pcre2_jit_stack_create(NULL, 32*1024, 512*1024);
jit_stack = pcre2_jit_stack_create(32*1024, 512*1024, NULL);
pcre2_jit_stack_assign(mcontext, NULL, jit_stack);
match_data = pcre2_match_data_create(re, 10);
rc = pcre2_match(re, subject, length, 0, 0, match_data, mcontext);
@ -418,7 +418,7 @@ Cambridge, England.
</P>
<br><a name="SEC13" href="#TOC1">REVISION</a><br>
<P>
Last updated: 23 November 2014
Last updated: 27 November 2014
<br>
Copyright &copy; 1997-2014 University of Cambridge.
<br>

View File

@ -334,8 +334,8 @@ PCRE2 NATIVE API JIT FUNCTIONS
void pcre2_jit_free_unused_memory(pcre2_general_context *gcontext);
pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *gcontext,
PCRE2_SIZE startsize, PCRE2_SIZE maxsize);
pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE startsize,
PCRE2_SIZE maxsize, pcre2_general_context *gcontext);
void pcre2_jit_stack_assign(pcre2_match_context *mcontext,
pcre2_jit_callback callback_function, void *callback_data);
@ -1337,8 +1337,8 @@ JUST-IN-TIME (JIT) COMPILATION
void pcre2_jit_free_unused_memory(pcre2_general_context *gcontext);
pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *gcontext,
PCRE2_SIZE startsize, PCRE2_SIZE maxsize);
pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE startsize,
PCRE2_SIZE maxsize, pcre2_general_context *gcontext);
void pcre2_jit_stack_assign(pcre2_match_context *mcontext,
pcre2_jit_callback callback_function, void *callback_data);
@ -2622,7 +2622,7 @@ AUTHOR
REVISION
Last updated: 26 November 2014
Last updated: 27 November 2014
Copyright (c) 1997-2014 University of Cambridge.
------------------------------------------------------------------------------
@ -3647,13 +3647,12 @@ CONTROLLING THE JIT STACK
the section entitled "JIT stack FAQ" below.
The pcre2_jit_stack_create() function creates a JIT stack. Its argu-
ments are a general context (for memory allocation functions, or NULL
for standard memory allocation), a starting size and a maximum size,
and it returns a pointer to an opaque structure of type
pcre2_jit_stack, or NULL if there is an error. The
pcre2_jit_stack_free() function is used to free a stack that is no
longer needed. (For the technically minded: the address space is allo-
cated by mmap or VirtualAlloc.)
ments are a starting size, a maximum size, and a general context (for
memory allocation functions, or NULL for standard memory allocation).
It returns a pointer to an opaque structure of type pcre2_jit_stack, or
NULL if there is an error. The pcre2_jit_stack_free() function is used
to free a stack that is no longer needed. (For the technically minded:
the address space is allocated by mmap or VirtualAlloc.)
JIT uses far less memory for recursion than the interpretive code, and
a maximum stack size of 512K to 1M should be more than enough for any
@ -3822,7 +3821,7 @@ EXAMPLE CODE
&errornumber, &erroffset, NULL);
rc = pcre2_jit_compile(re, PCRE2_JIT_COMPLETE);
mcontext = pcre2_match_context_create(NULL);
jit_stack = pcre2_jit_stack_create(NULL, 32*1024, 512*1024);
jit_stack = pcre2_jit_stack_create(32*1024, 512*1024, NULL);
pcre2_jit_stack_assign(mcontext, NULL, jit_stack);
match_data = pcre2_match_data_create(re, 10);
rc = pcre2_match(re, subject, length, 0, 0, match_data, mcontext);
@ -3876,7 +3875,7 @@ AUTHOR
REVISION
Last updated: 23 November 2014
Last updated: 27 November 2014
Copyright (c) 1997-2014 University of Cambridge.
------------------------------------------------------------------------------

View File

@ -7,18 +7,18 @@ PCRE2 - Perl-compatible regular expressions (revised API)
.B #include <pcre2.h>
.PP
.nf
.B pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *\fIgcontext\fP,
.B " PCRE2_SIZE \fIstartsize\fP, PCRE2_SIZE \fImaxsize\fP);"
.B pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE \fIstartsize\fP,
.B " PCRE2_SIZE \fImaxsize\fP, pcre2_general_context *\fIgcontext\fP);"
.fi
.
.SH DESCRIPTION
.rs
.sp
This function is used to create a stack for use by the code compiled by the JIT
compiler. The first argument is a general context, for memory allocation
functions, or NULL for standard memory allocation. The remaining arguments are
a starting size for the stack, and a maximum size to which it is allowed to
grow. The result can be passed to the JIT run-time code by calling
compiler. The first two arguments are a starting size for the stack, and a
maximum size to which it is allowed to grow. The final argument is a general
context, for memory allocation functions, or NULL for standard memory
allocation. The result can be passed to the JIT run-time code by calling
\fBpcre2_jit_stack_assign()\fP to associate the stack with a compiled pattern,
which can then be processed by \fBpcre2_match()\fP. If the "fast path" JIT
matcher, \fBpcre2_jit_match()\fP is used, the stack can be passed directly as

View File

@ -10,7 +10,7 @@ PCRE2 - Perl-compatible regular expressions (revised API)
.B int pcre2_substitute(const pcre2_code *\fIcode\fP, PCRE2_SPTR \fIsubject\fP,
.B " PCRE2_SIZE \fIlength\fP, PCRE2_SIZE \fIstartoffset\fP,"
.B " uint32_t \fIoptions\fP, pcre2_match_data *\fImatch_data\fP,"
.B " pcre2_match_context *\fImcontext\fP, PCRE2_SPTR \fIreplacementzfP,"
.B " pcre2_match_context *\fImcontext\fP, PCRE2_SPTR \fIreplacement\fP,"
.B " PCRE2_SIZE \fIrlength\fP, PCRE2_UCHAR *\fIoutputbuffer\fP,"
.B " PCRE2_SIZE *\fIoutlengthptr\fP);"
.fi

View File

@ -1,4 +1,4 @@
.TH PCRE2API 3 "26 November 2014" "PCRE2 10.00"
.TH PCRE2API 3 "27 November 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.sp
@ -195,8 +195,8 @@ document for an overview of all the PCRE2 documentation.
.sp
.B void pcre2_jit_free_unused_memory(pcre2_general_context *\fIgcontext\fP);
.sp
.B pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *\fIgcontext\fP,
.B " PCRE2_SIZE \fIstartsize\fP, PCRE2_SIZE \fImaxsize\fP);"
.B pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE \fIstartsize\fP,
.B " PCRE2_SIZE \fImaxsize\fP, pcre2_general_context *\fIgcontext\fP);"
.sp
.B void pcre2_jit_stack_assign(pcre2_match_context *\fImcontext\fP,
.B " pcre2_jit_callback \fIcallback_function\fP, void *\fIcallback_data\fP);"
@ -1300,8 +1300,8 @@ textual error message from any error code.
.sp
.B void pcre2_jit_free_unused_memory(pcre2_general_context *\fIgcontext\fP);
.sp
.B pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *\fIgcontext\fP,
.B " PCRE2_SIZE \fIstartsize\fP, PCRE2_SIZE \fImaxsize\fP);"
.B pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE \fIstartsize\fP,
.B " PCRE2_SIZE \fImaxsize\fP, pcre2_general_context *\fIgcontext\fP);"
.sp
.B void pcre2_jit_stack_assign(pcre2_match_context *\fImcontext\fP,
.B " pcre2_jit_callback \fIcallback_function\fP, void *\fIcallback_data\fP);"
@ -2731,6 +2731,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 26 November 2014
Last updated: 27 November 2014
Copyright (c) 1997-2014 University of Cambridge.
.fi

View File

@ -1,4 +1,4 @@
.TH PCRE2JIT 3 "23 November 2014" "PCRE2 10.00"
.TH PCRE2JIT 3 "27 November 2014" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH "PCRE2 JUST-IN-TIME COMPILER SUPPORT"
@ -163,8 +163,8 @@ about the use of JIT stacks in the section entitled
below.
.P
The \fBpcre2_jit_stack_create()\fP function creates a JIT stack. Its arguments
are a general context (for memory allocation functions, or NULL for standard
memory allocation), a starting size and a maximum size, and it returns a
are a starting size, a maximum size, and a general context (for memory
allocation functions, or NULL for standard memory allocation). It returns a
pointer to an opaque structure of type \fBpcre2_jit_stack\fP, or NULL if there
is an error. The \fBpcre2_jit_stack_free()\fP function is used to free a stack
that is no longer needed. (For the technically minded: the address space is
@ -336,7 +336,7 @@ calls.
&errornumber, &erroffset, NULL);
rc = pcre2_jit_compile(re, PCRE2_JIT_COMPLETE);
mcontext = pcre2_match_context_create(NULL);
jit_stack = pcre2_jit_stack_create(NULL, 32*1024, 512*1024);
jit_stack = pcre2_jit_stack_create(32*1024, 512*1024, NULL);
pcre2_jit_stack_assign(mcontext, NULL, jit_stack);
match_data = pcre2_match_data_create(re, 10);
rc = pcre2_match(re, subject, length, 0, 0, match_data, mcontext);
@ -398,6 +398,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 23 November 2014
Last updated: 27 November 2014
Copyright (c) 1997-2014 University of Cambridge.
.fi

View File

@ -472,8 +472,8 @@ PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
pcre2_match_data *, pcre2_match_context *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *); \
PCRE2_EXP_DECL \
pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *, \
PCRE2_SIZE, PCRE2_SIZE); \
pcre2_jit_stack *pcre2_jit_stack_create(PCRE2_SIZE, PCRE2_SIZE, \
pcre2_general_context *); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(pcre2_match_context *, \
pcre2_jit_callback, void *); \
PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);

View File

@ -97,8 +97,8 @@ sljit_free_unused_memory_exec();
*************************************************/
PCRE2_EXP_DEFN pcre2_jit_stack * PCRE2_CALL_CONVENTION
pcre2_jit_stack_create(pcre2_general_context *gcontext, size_t startsize,
size_t maxsize)
pcre2_jit_stack_create(size_t startsize, size_t maxsize,
pcre2_general_context *gcontext)
{
#ifndef SUPPORT_JIT

View File

@ -854,7 +854,7 @@ static pcre2_jit_stack_8 *stack8;
static pcre2_jit_stack_8 *getstack8(void)
{
if (!stack8)
stack8 = pcre2_jit_stack_create_8(NULL, 1, 1024 * 1024);
stack8 = pcre2_jit_stack_create_8(1, 1024 * 1024, NULL);
return stack8;
}
@ -877,7 +877,7 @@ static pcre2_jit_stack_16 *stack16;
static pcre2_jit_stack_16 *getstack16(void)
{
if (!stack16)
stack16 = pcre2_jit_stack_create_16(NULL, 1, 1024 * 1024);
stack16 = pcre2_jit_stack_create_16(1, 1024 * 1024, NULL);
return stack16;
}
@ -900,7 +900,7 @@ static pcre2_jit_stack_32 *stack32;
static pcre2_jit_stack_32 *getstack32(void)
{
if (!stack32)
stack32 = pcre2_jit_stack_create_32(NULL, 1, 1024 * 1024);
stack32 = pcre2_jit_stack_create_32(1, 1024 * 1024, NULL);
return stack32;
}

View File

@ -3115,7 +3115,7 @@ for (fn = pattern_files; fn != NULL; fn = fn->next)
#ifdef SUPPORT_PCRE2GREP_JIT
if (use_jit)
jit_stack = pcre2_jit_stack_create(NULL, 32*1024, 1024*1024);
jit_stack = pcre2_jit_stack_create(32*1024, 1024*1024, NULL);
#endif
for (j = 1, cp = patterns; cp != NULL; j++, cp = cp->next)

View File

@ -4731,7 +4731,7 @@ if (dat_datctl.jitstack != 0)
if (dat_datctl.jitstack != jit_stack_size)
{
PCRE2_JIT_STACK_FREE(jit_stack);
PCRE2_JIT_STACK_CREATE(jit_stack, NULL, 1, dat_datctl.jitstack * 1024);
PCRE2_JIT_STACK_CREATE(jit_stack, 1, dat_datctl.jitstack * 1024, NULL);
jit_stack_size = dat_datctl.jitstack;
}
PCRE2_JIT_STACK_ASSIGN(dat_context, jit_callback, jit_stack);