| 229 |
"invalid combination of newline options", |
"invalid combination of newline options", |
| 230 |
"bad offset value", |
"bad offset value", |
| 231 |
NULL, /* SHORTUTF8 is handled specially */ |
NULL, /* SHORTUTF8 is handled specially */ |
| 232 |
"nested recursion at the same subject position" |
"nested recursion at the same subject position", |
| 233 |
|
"JIT stack limit reached" |
| 234 |
}; |
}; |
| 235 |
|
|
| 236 |
|
|
| 1051 |
|
|
| 1052 |
|
|
| 1053 |
/************************************************* |
/************************************************* |
|
* Check for supported JIT architecture * |
|
|
*************************************************/ |
|
|
|
|
|
/* If it won't JIT-compile a very simple regex, return FALSE. */ |
|
|
|
|
|
static int check_jit_arch(void) |
|
|
{ |
|
|
const char *error; |
|
|
int erroffset, rc; |
|
|
pcre *re = pcre_compile("abc", 0, &error, &erroffset, NULL); |
|
|
pcre_extra *extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error); |
|
|
rc = extra != NULL && (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 && |
|
|
extra->executable_jit != NULL; |
|
|
pcre_free_study(extra); |
|
|
free(re); |
|
|
return rc; |
|
|
} |
|
|
|
|
|
|
|
|
/************************************************* |
|
| 1054 |
* Byte flipping function * |
* Byte flipping function * |
| 1055 |
*************************************************/ |
*************************************************/ |
| 1056 |
|
|
| 1289 |
|
|
| 1290 |
if (strcmp(argv[op], "-m") == 0) showstore = 1; |
if (strcmp(argv[op], "-m") == 0) showstore = 1; |
| 1291 |
else if (strcmp(argv[op], "-s") == 0) force_study = 0; |
else if (strcmp(argv[op], "-s") == 0) force_study = 0; |
| 1292 |
else if (strcmp(argv[op], "-s+") == 0) |
else if (strcmp(argv[op], "-s+") == 0) |
| 1293 |
{ |
{ |
| 1294 |
force_study = 1; |
force_study = 1; |
| 1295 |
force_study_options = PCRE_STUDY_JIT_COMPILE; |
force_study_options = PCRE_STUDY_JIT_COMPILE; |
| 1296 |
} |
} |
| 1297 |
else if (strcmp(argv[op], "-q") == 0) quiet = 1; |
else if (strcmp(argv[op], "-q") == 0) quiet = 1; |
| 1298 |
else if (strcmp(argv[op], "-b") == 0) debug = 1; |
else if (strcmp(argv[op], "-b") == 0) debug = 1; |
| 1299 |
else if (strcmp(argv[op], "-i") == 0) showinfo = 1; |
else if (strcmp(argv[op], "-i") == 0) showinfo = 1; |
| 1360 |
printf(" %sUnicode properties support\n", rc? "" : "No "); |
printf(" %sUnicode properties support\n", rc? "" : "No "); |
| 1361 |
(void)pcre_config(PCRE_CONFIG_JIT, &rc); |
(void)pcre_config(PCRE_CONFIG_JIT, &rc); |
| 1362 |
if (rc) |
if (rc) |
| 1363 |
printf(" Just-in-time compiler support%s\n", check_jit_arch()? |
printf(" Just-in-time compiler support\n"); |
|
"" : " (but this architecture is unsupported)"); |
|
| 1364 |
else |
else |
| 1365 |
printf(" No just-in-time compiler support\n"); |
printf(" No just-in-time compiler support\n"); |
| 1366 |
(void)pcre_config(PCRE_CONFIG_NEWLINE, &rc); |
(void)pcre_config(PCRE_CONFIG_NEWLINE, &rc); |
| 1665 |
#endif |
#endif |
| 1666 |
|
|
| 1667 |
case 'S': |
case 'S': |
| 1668 |
if (do_study == 0) |
if (do_study == 0) |
| 1669 |
{ |
{ |
| 1670 |
do_study = 1; |
do_study = 1; |
| 1671 |
if (*pp == '+') |
if (*pp == '+') |
| 1672 |
{ |
{ |
| 1673 |
study_options |= PCRE_STUDY_JIT_COMPILE; |
study_options |= PCRE_STUDY_JIT_COMPILE; |
| 1674 |
pp++; |
pp++; |
| 1675 |
} |
} |
| 1676 |
} |
} |
| 1677 |
else |
else |
| 1678 |
{ |
{ |
| 1679 |
do_study = 0; |
do_study = 0; |
| 2156 |
fprintf(outfile, "\n"); |
fprintf(outfile, "\n"); |
| 2157 |
} |
} |
| 2158 |
} |
} |
| 2159 |
|
|
| 2160 |
/* Show this only if the JIT was set by /S, not by -s. */ |
/* Show this only if the JIT was set by /S, not by -s. */ |
| 2161 |
|
|
| 2162 |
if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0) |
if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0) |
| 2163 |
{ |
{ |
| 2164 |
int jit; |
int jit; |
| 2165 |
new_info(re, extra, PCRE_INFO_JIT, &jit); |
new_info(re, extra, PCRE_INFO_JIT, &jit); |
| 2166 |
if (jit) |
if (jit) |
| 2167 |
fprintf(outfile, "JIT study was successful\n"); |
fprintf(outfile, "JIT study was successful\n"); |
| 2168 |
else |
else |
| 2169 |
#ifdef SUPPORT_JIT |
#ifdef SUPPORT_JIT |
| 2170 |
fprintf(outfile, "JIT study was not successful\n"); |
fprintf(outfile, "JIT study was not successful\n"); |
| 2171 |
#else |
#else |
| 2172 |
fprintf(outfile, "JIT support is not available in this version of PCRE\n"); |
fprintf(outfile, "JIT support is not available in this version of PCRE\n"); |
| 2173 |
#endif |
#endif |
| 2174 |
} |
} |
| 2175 |
} |
} |
| 2176 |
} |
} |
| 2177 |
|
|
| 2346 |
{ |
{ |
| 2347 |
unsigned char *pt = p; |
unsigned char *pt = p; |
| 2348 |
c = 0; |
c = 0; |
| 2349 |
while (isxdigit(*(++pt))) |
|
| 2350 |
c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W'); |
/* We used to have "while (isxdigit(*(++pt)))" here, but it fails |
| 2351 |
|
when isxdigit() is a macro that refers to its argument more than |
| 2352 |
|
once. This is banned by the C Standard, but apparently happens in at |
| 2353 |
|
least one MacOS environment. */ |
| 2354 |
|
|
| 2355 |
|
for (pt++; isxdigit(*pt); pt++) |
| 2356 |
|
c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10); |
| 2357 |
if (*pt == '}') |
if (*pt == '}') |
| 2358 |
{ |
{ |
| 2359 |
unsigned char buff8[8]; |
unsigned char buff8[8]; |
| 2383 |
c = 0; |
c = 0; |
| 2384 |
while (i++ < 2 && isxdigit(*p)) |
while (i++ < 2 && isxdigit(*p)) |
| 2385 |
{ |
{ |
| 2386 |
c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'W'); |
c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'a' - 10); |
| 2387 |
p++; |
p++; |
| 2388 |
} |
} |
| 2389 |
break; |
break; |
| 2498 |
getnamesptr = npp; |
getnamesptr = npp; |
| 2499 |
} |
} |
| 2500 |
continue; |
continue; |
| 2501 |
|
|
| 2502 |
case 'J': |
case 'J': |
| 2503 |
while(isdigit(*p)) n = n * 10 + *p++ - '0'; |
while(isdigit(*p)) n = n * 10 + *p++ - '0'; |
| 2504 |
if (extra != NULL |
if (extra != NULL |
| 2505 |
&& (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 |
&& (extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 |
| 2506 |
&& extra->executable_jit != NULL) |
&& extra->executable_jit != NULL) |
| 2507 |
{ |
{ |
| 2508 |
if (jit_stack != NULL) pcre_jit_stack_free(jit_stack); |
if (jit_stack != NULL) pcre_jit_stack_free(jit_stack); |
| 2509 |
jit_stack = pcre_jit_stack_alloc(1, n * 1024); |
jit_stack = pcre_jit_stack_alloc(1, n * 1024); |
| 2510 |
pcre_assign_jit_callback(extra, jit_callback, jit_stack); |
pcre_assign_jit_stack(extra, jit_callback, jit_stack); |
| 2511 |
} |
} |
| 2512 |
continue; |
continue; |
| 2513 |
|
|
| 2514 |
case 'L': |
case 'L': |
| 2734 |
extra->flags = 0; |
extra->flags = 0; |
| 2735 |
} |
} |
| 2736 |
else extra->flags &= ~PCRE_EXTRA_EXECUTABLE_JIT; |
else extra->flags &= ~PCRE_EXTRA_EXECUTABLE_JIT; |
| 2737 |
|
|
| 2738 |
(void)check_match_limit(re, extra, bptr, len, start_offset, |
(void)check_match_limit(re, extra, bptr, len, start_offset, |
| 2739 |
options|g_notempty, use_offsets, use_size_offsets, |
options|g_notempty, use_offsets, use_size_offsets, |
| 2740 |
PCRE_EXTRA_MATCH_LIMIT, &(extra->match_limit), |
PCRE_EXTRA_MATCH_LIMIT, &(extra->match_limit), |
| 3089 |
setlocale(LC_CTYPE, "C"); |
setlocale(LC_CTYPE, "C"); |
| 3090 |
locale_set = 0; |
locale_set = 0; |
| 3091 |
} |
} |
| 3092 |
if (jit_stack != NULL) |
if (jit_stack != NULL) |
| 3093 |
{ |
{ |
| 3094 |
pcre_jit_stack_free(jit_stack); |
pcre_jit_stack_free(jit_stack); |
| 3095 |
jit_stack = NULL; |
jit_stack = NULL; |
| 3096 |
} |
} |
| 3097 |
} |
} |
| 3098 |
|
|
| 3099 |
if (infile == stdin) fprintf(outfile, "\n"); |
if (infile == stdin) fprintf(outfile, "\n"); |