aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-01 20:52:08 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-01 20:52:08 +0100
commit0eb238cf006caac8f7b19a85426905d388f6a20a (patch)
tree90c9acd83c029fb5759b56b77b483bd44f4511a6 /src
parent849d39783113dab5f3130e3e59cd8b30f53b136e (diff)
Force JIT compilation
Diffstat (limited to 'src')
-rw-r--r--src/globals.h1
-rw-r--r--src/main.c6
-rw-r--r--src/work.c24
3 files changed, 13 insertions, 18 deletions
diff --git a/src/globals.h b/src/globals.h
index 9475bc3..1285db3 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -39,7 +39,6 @@ typedef struct {
maybe_extern flags_t flags;
maybe_extern int grab_tabsize;
maybe_extern op_t *ops;
-maybe_extern typeof(pcre2_match) *pcre2_match_fn;
#if MAIN_C
atomic_int rv = EXIT_NOMATCH;
const char *lquot = "`", *rquot = "'";
diff --git a/src/main.c b/src/main.c
index a23ff56..2e71bef 100644
--- a/src/main.c
+++ b/src/main.c
@@ -347,12 +347,8 @@ pattern_comp(u8view_t pat)
pcre2_bitch_and_die(
ec, "failed to compile regex at byte offset %zu: %s", eoff);
}
- if ((ec = pcre2_jit_compile(op.re, PCRE2_JIT_COMPLETE)) != 0) {
+ if ((ec = pcre2_jit_compile(op.re, PCRE2_JIT_COMPLETE)) != 0)
pcre2_bitch_and_die(ec, "failed to JIT compile regex: %s");
- rv = EXIT_WARNING;
- pcre2_match_fn = pcre2_match;
- } else
- pcre2_match_fn = pcre2_jit_match;
#if DEBUG
op.free_me = true;
#endif
diff --git a/src/work.c b/src/work.c
index 12d998f..bf66fdb 100644
--- a/src/work.c
+++ b/src/work.c
@@ -185,8 +185,8 @@ DEFINE_OPERATOR(g)
{
pcre2_match_data *md =
pcre2_match_data_create_from_pattern(ops[opi].re, nullptr);
- int n = pcre2_match_fn(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
- md, nullptr);
+ int n = pcre2_jit_match(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
+ md, nullptr);
pcre2_match_data_free(md);
if (n == PCRE2_ERROR_NOMATCH)
@@ -201,8 +201,8 @@ DEFINE_OPERATOR(G)
{
pcre2_match_data *md =
pcre2_match_data_create_from_pattern(ops[opi].re, nullptr);
- int n = pcre2_match_fn(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
- md, nullptr);
+ int n = pcre2_jit_match(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
+ md, nullptr);
pcre2_match_data_free(md);
if (n == PCRE2_ERROR_NOMATCH)
@@ -223,8 +223,8 @@ DEFINE_OPERATOR(h)
u8view_t sv_save = sv;
ptrdiff_t origlen = array_len(*hl);
for (;;) {
- int n = pcre2_match_fn(ops[opi].re, sv.p, sv.len, 0,
- PCRE2_NOTEMPTY, md, nullptr);
+ int n = pcre2_jit_match(ops[opi].re, sv.p, sv.len, 0,
+ PCRE2_NOTEMPTY, md, nullptr);
if (n == PCRE2_ERROR_NOMATCH)
break;
if (n < 0)
@@ -251,8 +251,8 @@ DEFINE_OPERATOR(H)
u8view_t sv_save = sv;
ptrdiff_t origlen = array_len(*hl);
for (;;) {
- int n = pcre2_match_fn(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
- md, nullptr);
+ int n = pcre2_jit_match(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
+ md, nullptr);
if (n == PCRE2_ERROR_NOMATCH)
break;
if (n < 0)
@@ -272,8 +272,8 @@ DEFINE_OPERATOR(x)
pcre2_match_data *md =
pcre2_match_data_create_from_pattern(ops[opi].re, nullptr);
for (;;) {
- int n = pcre2_match_fn(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
- md, nullptr);
+ int n = pcre2_jit_match(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
+ md, nullptr);
if (n == PCRE2_ERROR_NOMATCH)
break;
if (n < 0)
@@ -291,8 +291,8 @@ DEFINE_OPERATOR(X)
pcre2_match_data *md =
pcre2_match_data_create_from_pattern(ops[opi].re, nullptr);
for (;;) {
- int n = pcre2_match_fn(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
- md, nullptr);
+ int n = pcre2_jit_match(ops[opi].re, sv.p, sv.len, 0, PCRE2_NOTEMPTY,
+ md, nullptr);
if (n == PCRE2_ERROR_NOMATCH)
break;
if (n < 0)