Fix cache-flush in JIT on PPC
This commit is contained in:
parent
8d3f8f500e
commit
eadca49929
112
pcre-8.20-ppcjit.patch
Normal file
112
pcre-8.20-ppcjit.patch
Normal file
@ -0,0 +1,112 @@
|
||||
Fix cache-flush on PPC
|
||||
|
||||
From:
|
||||
r742 | zherczeg | 2011-11-06 09:05:33 +0100 (Ne, 06 lis 2011) | 3 lines
|
||||
|
||||
Fix cache-flush issue on PowerPC, adding some comments and a check for
|
||||
disabled PCRE_EXTRA_TABLES.
|
||||
|
||||
Fix cache-flush issue on PowerPC (It is still an experimental JIT port).
|
||||
PCRE_EXTRA_TABLES is not suported by JIT, and should be checked before
|
||||
calling _pcre_jit_exec. Some extra comments are added.
|
||||
|
||||
Petr Pisar: Changelog removed
|
||||
|
||||
Index: pcre_exec.c
|
||||
===================================================================
|
||||
--- pcre_exec.c (revision 741)
|
||||
+++ pcre_exec.c (revision 742)
|
||||
@@ -6011,6 +6011,7 @@
|
||||
if (extra_data != NULL
|
||||
&& (extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0
|
||||
&& extra_data->executable_jit != NULL
|
||||
+ && (extra_data->flags & PCRE_EXTRA_TABLES) == 0
|
||||
&& (options & ~(PCRE_NO_UTF8_CHECK | PCRE_NOTBOL | PCRE_NOTEOL |
|
||||
PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART)) == 0)
|
||||
return _pcre_jit_exec(re, extra_data->executable_jit, subject, length,
|
||||
Index: sljit/sljitLir.h
|
||||
===================================================================
|
||||
--- sljit/sljitLir.h (revision 741)
|
||||
+++ sljit/sljitLir.h (revision 742)
|
||||
@@ -56,6 +56,9 @@
|
||||
- mainly position independent code
|
||||
- Optimizations (perhaps later)
|
||||
- Only for basic blocks (when no labels inserted between LIR instructions)
|
||||
+
|
||||
+ For valgrind users:
|
||||
+ - pass --smc-check=all argument to valgrind, since JIT is a "self-modifying code"
|
||||
*/
|
||||
|
||||
#if !(defined SLJIT_NO_DEFAULT_CONFIG && SLJIT_NO_DEFAULT_CONFIG)
|
||||
@@ -87,6 +90,7 @@
|
||||
|
||||
#define SLJIT_UNUSED 0
|
||||
|
||||
+/* Temporary (scratch) registers may not preserve their values across function calls. */
|
||||
#define SLJIT_TEMPORARY_REG1 1
|
||||
#define SLJIT_TEMPORARY_REG2 2
|
||||
#define SLJIT_TEMPORARY_REG3 3
|
||||
@@ -95,6 +99,7 @@
|
||||
#define SLJIT_TEMPORARY_EREG1 4
|
||||
#define SLJIT_TEMPORARY_EREG2 5
|
||||
|
||||
+/* General (saved) registers preserve their values across function calls. */
|
||||
#define SLJIT_GENERAL_REG1 6
|
||||
#define SLJIT_GENERAL_REG2 7
|
||||
#define SLJIT_GENERAL_REG3 8
|
||||
Index: sljit/sljitNativePPC_common.c
|
||||
===================================================================
|
||||
--- sljit/sljitNativePPC_common.c (revision 741)
|
||||
+++ sljit/sljitNativePPC_common.c (revision 742)
|
||||
@@ -37,6 +37,18 @@
|
||||
Both for ppc-32 and ppc-64. */
|
||||
typedef sljit_ui sljit_ins;
|
||||
|
||||
+static void ppc_cache_flush(sljit_ins *from, sljit_ins *to)
|
||||
+{
|
||||
+ while (from < to) {
|
||||
+#ifdef __GNUC__
|
||||
+ asm volatile ( "icbi 0, %0" : : "r"(from) );
|
||||
+#else
|
||||
+#error "Must implement icbi"
|
||||
+#endif
|
||||
+ from++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
#define TMP_REG1 (SLJIT_NO_REGISTERS + 1)
|
||||
#define TMP_REG2 (SLJIT_NO_REGISTERS + 2)
|
||||
#define TMP_REG3 (SLJIT_NO_REGISTERS + 3)
|
||||
Index: sljit/sljitConfigInternal.h
|
||||
===================================================================
|
||||
--- sljit/sljitConfigInternal.h (revision 741)
|
||||
+++ sljit/sljitConfigInternal.h (revision 742)
|
||||
@@ -178,13 +178,23 @@
|
||||
|
||||
#ifndef SLJIT_CACHE_FLUSH
|
||||
|
||||
-#if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) && !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
|
||||
- /* Just call __ARM_NR_cacheflush on Linux. */
|
||||
+#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
|
||||
+
|
||||
+/* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */
|
||||
#define SLJIT_CACHE_FLUSH(from, to) \
|
||||
+ ppc_cache_flush((from), (to))
|
||||
+
|
||||
+#elif (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
|
||||
+
|
||||
+/* Not required to implement on archs with unified caches. */
|
||||
+#define SLJIT_CACHE_FLUSH(from, to)
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+/* Calls __ARM_NR_cacheflush on ARM-Linux. */
|
||||
+#define SLJIT_CACHE_FLUSH(from, to) \
|
||||
__clear_cache((char*)(from), (char*)(to))
|
||||
-#else
|
||||
- /* Not required to implement on archs with unified caches. */
|
||||
-#define SLJIT_CACHE_FLUSH(from, to)
|
||||
+
|
||||
#endif
|
||||
|
||||
#endif /* !SLJIT_CACHE_FLUSH */
|
@ -1,7 +1,7 @@
|
||||
# This is stable release: %%global rcversion RC3
|
||||
Name: pcre
|
||||
Version: 8.20
|
||||
Release: %{?rcversion:0.}5%{?rcversion:.%rcversion}%{?dist}
|
||||
Release: %{?rcversion:0.}6%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
Group: System Environment/Libraries
|
||||
@ -17,6 +17,8 @@ Patch2: pcre-8.20-lookbehind.patch
|
||||
Patch3: pcre-8.20-lookbehind-2.patch
|
||||
# Fix repeated forward reference, in upstream after 8.20.
|
||||
Patch4: pcre-8.20-forward_reference.patch
|
||||
# Fix cache-flush in JIT on PPC, in upstream after 8.20.
|
||||
Patch5: pcre-8.20-ppcjit.patch
|
||||
BuildRequires: readline-devel
|
||||
# New libtool to get rid of rpath
|
||||
BuildRequires: autoconf, automake, libtool
|
||||
@ -60,6 +62,7 @@ libtoolize --copy --force && autoreconf
|
||||
%patch2 -p1 -b .lookbehind
|
||||
%patch3 -p1 -b .lookbehind2
|
||||
%patch4 -p0 -b .forward_reference
|
||||
%patch5 -p0 -b .ppcjit
|
||||
# One contributor's name is non-UTF-8
|
||||
for F in ChangeLog; do
|
||||
iconv -f latin1 -t utf8 "$F" >"${F}.utf8"
|
||||
@ -130,6 +133,9 @@ make check
|
||||
%{_mandir}/man1/pcretest.*
|
||||
|
||||
%changelog
|
||||
* Fri Nov 25 2011 Petr Pisar <ppisar@redhat.com> - 8.20-6
|
||||
- Fix cache-flush in JIT on PPC
|
||||
|
||||
* Tue Nov 22 2011 Petr Pisar <ppisar@redhat.com> - 8.20-5
|
||||
- Fix repeated forward reference (bug #755969)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user