Remove pcre2_jit_stack argument from jit_match.
This commit is contained in:
parent
7d9caa5b41
commit
94c0deddd3
|
@ -453,8 +453,7 @@ PCRE2_EXP_DECL int pcre2_substring_list_get(pcre2_match_data *, \
|
||||||
PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_code *, uint32_t); \
|
PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_code *, uint32_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
|
PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_match_context *, \
|
pcre2_match_data *, pcre2_match_context *); \
|
||||||
pcre2_jit_stack *); \
|
|
||||||
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *); \
|
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *, \
|
pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *, \
|
||||||
|
|
|
@ -161,6 +161,10 @@ const pcre2_match_context PRIV(default_match_context) = {
|
||||||
{ default_malloc, default_free, NULL },
|
{ default_malloc, default_free, NULL },
|
||||||
#ifdef HEAP_MATCH_RECURSE
|
#ifdef HEAP_MATCH_RECURSE
|
||||||
{ default_malloc, default_free, NULL },
|
{ default_malloc, default_free, NULL },
|
||||||
|
#endif
|
||||||
|
#ifdef SUPPORT_JIT
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -573,14 +573,14 @@ typedef struct pcre2_real_match_context {
|
||||||
#ifdef HEAP_MATCH_RECURSE
|
#ifdef HEAP_MATCH_RECURSE
|
||||||
pcre2_memctl stack_memctl;
|
pcre2_memctl stack_memctl;
|
||||||
#endif
|
#endif
|
||||||
int (*callout)(pcre2_callout_block *);
|
|
||||||
void *callout_data;
|
|
||||||
uint32_t match_limit;
|
|
||||||
uint32_t recursion_limit;
|
|
||||||
#ifdef SUPPORT_JIT
|
#ifdef SUPPORT_JIT
|
||||||
pcre2_jit_callback jit_callback;
|
pcre2_jit_callback jit_callback;
|
||||||
void *jit_callback_data;
|
void *jit_callback_data;
|
||||||
#endif
|
#endif
|
||||||
|
int (*callout)(pcre2_callout_block *);
|
||||||
|
void *callout_data;
|
||||||
|
uint32_t match_limit;
|
||||||
|
uint32_t recursion_limit;
|
||||||
} pcre2_real_match_context;
|
} pcre2_real_match_context;
|
||||||
|
|
||||||
/* The real compiled code structure */
|
/* The real compiled code structure */
|
||||||
|
|
|
@ -87,7 +87,7 @@ Returns: > 0 => success; value is the number of ovector pairs filled
|
||||||
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
||||||
pcre2_jit_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length,
|
pcre2_jit_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length,
|
||||||
PCRE2_SIZE start_offset, uint32_t options, pcre2_match_data *match_data,
|
PCRE2_SIZE start_offset, uint32_t options, pcre2_match_data *match_data,
|
||||||
pcre2_match_context *mcontext, pcre2_jit_stack *jit_stack)
|
pcre2_match_context *mcontext)
|
||||||
{
|
{
|
||||||
#ifndef SUPPORT_JIT
|
#ifndef SUPPORT_JIT
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ return PCRE2_ERROR_JIT_BADOPTION;
|
||||||
|
|
||||||
pcre2_real_code *re = (pcre2_real_code *)code;
|
pcre2_real_code *re = (pcre2_real_code *)code;
|
||||||
executable_functions *functions = (executable_functions *)re->executable_jit;
|
executable_functions *functions = (executable_functions *)re->executable_jit;
|
||||||
|
pcre2_jit_stack *jit_stack;
|
||||||
uint32_t oveccount = match_data->oveccount;
|
uint32_t oveccount = match_data->oveccount;
|
||||||
uint32_t max_oveccount;
|
uint32_t max_oveccount;
|
||||||
union {
|
union {
|
||||||
|
@ -158,8 +159,10 @@ if (oveccount > max_oveccount)
|
||||||
oveccount = max_oveccount;
|
oveccount = max_oveccount;
|
||||||
arguments.oveccount = oveccount << 1;
|
arguments.oveccount = oveccount << 1;
|
||||||
|
|
||||||
if (jit_stack == NULL && mcontext->jit_callback != NULL)
|
if (mcontext->jit_callback != NULL)
|
||||||
jit_stack = mcontext->jit_callback(mcontext->jit_callback_data);
|
jit_stack = mcontext->jit_callback(mcontext->jit_callback_data);
|
||||||
|
else
|
||||||
|
jit_stack = (pcre2_jit_stack *)mcontext->jit_callback_data;
|
||||||
|
|
||||||
convert_executable_func.executable_func = functions->executable_funcs[index];
|
convert_executable_func.executable_func = functions->executable_funcs[index];
|
||||||
if (jit_stack != NULL)
|
if (jit_stack != NULL)
|
||||||
|
|
|
@ -1295,8 +1295,9 @@ static int regression_tests(void)
|
||||||
return_value8[0] = pcre2_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
|
return_value8[0] = pcre2_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
|
||||||
current->start_offset & OFFSET_MASK, current->match_options, mdata8_1, mcontext8);
|
current->start_offset & OFFSET_MASK, current->match_options, mdata8_1, mcontext8);
|
||||||
} else {
|
} else {
|
||||||
|
pcre2_jit_stack_assign_8(mcontext8, NULL, getstack8());
|
||||||
return_value8[0] = pcre2_jit_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
|
return_value8[0] = pcre2_jit_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
|
||||||
current->start_offset & OFFSET_MASK, current->match_options, mdata8_1, mcontext8, getstack8());
|
current->start_offset & OFFSET_MASK, current->match_options, mdata8_1, mcontext8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1338,8 +1339,9 @@ static int regression_tests(void)
|
||||||
return_value16[0] = pcre2_match_16(re16, regtest_buf16, length16,
|
return_value16[0] = pcre2_match_16(re16, regtest_buf16, length16,
|
||||||
current->start_offset & OFFSET_MASK, current->match_options, mdata16_1, mcontext16);
|
current->start_offset & OFFSET_MASK, current->match_options, mdata16_1, mcontext16);
|
||||||
} else {
|
} else {
|
||||||
|
pcre2_jit_stack_assign_16(mcontext16, NULL, getstack16());
|
||||||
return_value16[0] = pcre2_jit_match_16(re16, regtest_buf16, length16,
|
return_value16[0] = pcre2_jit_match_16(re16, regtest_buf16, length16,
|
||||||
current->start_offset & OFFSET_MASK, current->match_options, mdata16_1, mcontext16, getstack16());
|
current->start_offset & OFFSET_MASK, current->match_options, mdata16_1, mcontext16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1381,8 +1383,9 @@ static int regression_tests(void)
|
||||||
return_value32[0] = pcre2_match_32(re32, regtest_buf32, length32,
|
return_value32[0] = pcre2_match_32(re32, regtest_buf32, length32,
|
||||||
current->start_offset & OFFSET_MASK, current->match_options, mdata32_1, mcontext32);
|
current->start_offset & OFFSET_MASK, current->match_options, mdata32_1, mcontext32);
|
||||||
} else {
|
} else {
|
||||||
|
pcre2_jit_stack_assign_32(mcontext32, NULL, getstack32());
|
||||||
return_value32[0] = pcre2_jit_match_32(re32, regtest_buf32, length32,
|
return_value32[0] = pcre2_jit_match_32(re32, regtest_buf32, length32,
|
||||||
current->start_offset & OFFSET_MASK, current->match_options, mdata32_1, mcontext32, getstack32());
|
current->start_offset & OFFSET_MASK, current->match_options, mdata32_1, mcontext32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6492,7 +6492,7 @@ selected normal or partial matching mode was not compiled). */
|
||||||
if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0)
|
if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0)
|
||||||
{
|
{
|
||||||
rc = pcre2_jit_match(code, subject, length, start_offset, options,
|
rc = pcre2_jit_match(code, subject, length, start_offset, options,
|
||||||
match_data, mcontext, NULL);
|
match_data, mcontext);
|
||||||
if (rc != PCRE2_ERROR_JIT_BADOPTION) return rc;
|
if (rc != PCRE2_ERROR_JIT_BADOPTION) return rc;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue