Enable JIT in the pcre2grep tool

This commit is contained in:
Petr Písař 2016-06-03 10:39:09 +02:00
parent 0c68f1730f
commit 6ca7a15ebe
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,46 @@
From c3e3345d205607532c739b38acbc100623cd512a Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 31 May 2016 11:06:53 +0000
Subject: [PATCH] Make pcre2grep use JIT (it was omitted by mistake).
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@519 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.21.
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
index 47d2a4e..60b6812 100644
--- a/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -2788,9 +2788,24 @@ if ((popts & PO_FIXED_STRINGS) != 0)
sprintf((char *)buffer, "%s%.*s%s", prefix[popts], patlen, ps, suffix[popts]);
p->compiled = pcre2_compile(buffer, -1, options, &errcode, &erroffset,
compile_context);
-if (p->compiled != NULL) return TRUE;
+
+/* Handle successful compile */
+
+if (p->compiled != NULL)
+ {
+#ifdef SUPPORT_PCRE2GREP_JIT
+ if (use_jit)
+ {
+ errcode = pcre2_jit_compile(p->compiled, PCRE2_JIT_COMPLETE);
+ if (errcode == 0) return TRUE;
+ erroffset = PCRE2_SIZE_MAX; /* Will get reduced to patlen below */
+ }
+ else
+#endif
+ return TRUE;
+ }
-/* Handle compile errors */
+/* Handle compile and JIT compile errors */
erroffset -= (int)strlen(prefix[popts]);
if (erroffset > patlen) erroffset = patlen;
--
2.5.5

View File

@ -34,6 +34,8 @@ Patch4: pcre2-10.21-Fix-typo-in-pcre2_study.patch
Patch5: pcre2-10.21-A-racing-condition-is-fixed-in-JIT-reported-by-Mozil.patch
# Fix an ovector check in JIT test program, fixed in upstream after 10.21
Patch6: pcre2-10.21-Fix-typo-in-test-program.patch
# Enable JIT in the pcre2grep tool, fixed in upstream after 10.21
Patch7: pcre2-10.21-Make-pcre2grep-use-JIT-it-was-omitted-by-mistake.patch
# New libtool to get rid of RPATH and to use distribution autotools
BuildRequires: autoconf
@ -118,6 +120,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
# Because of multilib patch
libtoolize --copy --force
autoreconf -vif
@ -216,6 +219,7 @@ make %{?_smp_mflags} check VERBOSE=yes
* Fri Jun 03 2016 Petr Pisar <ppisar@redhat.com> - 10.21-5
- Fix a race in JIT locking condition
- Fix an ovector check in JIT test program
- Enable JIT in the pcre2grep tool
* Mon Mar 07 2016 Petr Pisar <ppisar@redhat.com> - 10.21-4
- Ship README in devel as it covers API and build, not general info