[Pcre-svn] [996] code/trunk: Improved cache flush for AIX

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [996] code/trunk: Improved cache flush for AIX
Revision: 996
          http://vcs.pcre.org/viewvc?view=rev&revision=996
Author:   zherczeg
Date:     2012-07-12 11:10:51 +0100 (Thu, 12 Jul 2012)


Log Message:
-----------
Improved cache flush for AIX

Modified Paths:
--------------
    code/trunk/pcre_jit_compile.c
    code/trunk/sljit/sljitConfigInternal.h
    code/trunk/sljit/sljitNativePPC_common.c


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2012-07-11 11:05:30 UTC (rev 995)
+++ code/trunk/pcre_jit_compile.c    2012-07-12 10:10:51 UTC (rev 996)
@@ -1653,7 +1653,7 @@
 while (list)
   {
   /* sljit_set_label is clever enough to do nothing
-  if either the jump or the label is NULL */
+  if either the jump or the label is NULL. */
   sljit_set_label(list->jump, label);
   list = list->next;
   }
@@ -7804,7 +7804,7 @@
   if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)
     {
     if (mode == JIT_COMPILE && fast_forward_first_two_chars(common, (re->options & PCRE_FIRSTLINE) != 0))
-      /* Do nothing */;
+      { /* Do nothing */ }
     else if ((re->flags & PCRE_FIRSTSET) != 0)
       fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
     else if ((re->flags & PCRE_STARTLINE) != 0)


Modified: code/trunk/sljit/sljitConfigInternal.h
===================================================================
--- code/trunk/sljit/sljitConfigInternal.h    2012-07-11 11:05:30 UTC (rev 995)
+++ code/trunk/sljit/sljitConfigInternal.h    2012-07-12 10:10:51 UTC (rev 996)
@@ -93,9 +93,9 @@
 #else
 #define SLJIT_CONFIG_ARM_V5 1
 #endif
-#elif defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64)
+#elif defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64) || (defined(_AIX) && defined(__64BIT__))
 #define SLJIT_CONFIG_PPC_64 1
-#elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(_POWER)
+#elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(_AIX)
 #define SLJIT_CONFIG_PPC_32 1
 #elif defined(__mips__)
 #define SLJIT_CONFIG_MIPS_32 1


Modified: code/trunk/sljit/sljitNativePPC_common.c
===================================================================
--- code/trunk/sljit/sljitNativePPC_common.c    2012-07-11 11:05:30 UTC (rev 995)
+++ code/trunk/sljit/sljitNativePPC_common.c    2012-07-12 10:10:51 UTC (rev 996)
@@ -33,25 +33,32 @@
    Both for ppc-32 and ppc-64. */
 typedef sljit_ui sljit_ins;


+#ifdef _AIX
+#include <sys/cache.h>
+#endif
+
 static void ppc_cache_flush(sljit_ins *from, sljit_ins *to)
 {
+#ifdef _AIX
+    _sync_cache_range((caddr_t)from, (size_t)(to - from) * sizeof(sljit_ins));
+#else
     while (from < to) {
 #if defined(__GNUC__) || (defined(__IBM_GCC_ASM) && __IBM_GCC_ASM)
-#ifdef _POWER
-        __asm__ volatile ( "clf 0, %0" : : "r"(from) );
-#else
         __asm__ volatile ( "icbi 0, %0" : : "r"(from) );
-#endif
 #ifdef __xlc__
 #warning "This file may fail to compile if -qfuncsect is used"
 #endif
 #elif defined(__xlc__)
 #error "Please enable GCC syntax for inline assembly statements with -qasm=gcc"
 #else
+        /* Power equivalent of icbi, not used yet. */
+        /* __asm__ volatile ( "clf 0, %0" : : "r"(from) ); */
+
 #error "This platform requires a cache flush implementation."
 #endif
         from++;
     }
+#endif /* _AIX */
 }


 #define TMP_REG1    (SLJIT_NO_REGISTERS + 1)