[Pcre-svn] [1175] code/trunk/sljit: JIT compiler update.

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1175] code/trunk/sljit: JIT compiler update.
Revision: 1175
          http://vcs.pcre.org/viewvc?view=rev&revision=1175
Author:   zherczeg
Date:     2012-10-26 05:47:29 +0100 (Fri, 26 Oct 2012)


Log Message:
-----------
JIT compiler update.

Modified Paths:
--------------
    code/trunk/sljit/sljitConfigInternal.h
    code/trunk/sljit/sljitNativeSPARC_common.c
    code/trunk/sljit/sljitUtils.c


Modified: code/trunk/sljit/sljitConfigInternal.h
===================================================================
--- code/trunk/sljit/sljitConfigInternal.h    2012-10-24 21:29:12 UTC (rev 1174)
+++ code/trunk/sljit/sljitConfigInternal.h    2012-10-26 04:47:29 UTC (rev 1175)
@@ -219,6 +219,12 @@
 #define SLJIT_CACHE_FLUSH(from, to) \
     ppc_cache_flush((from), (to))


+#elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+
+/* The __clear_cache() implementation of GCC is a dummy function on Sparc. */
+#define SLJIT_CACHE_FLUSH(from, to) \
+    sparc_cache_flush((from), (to))
+
 #else


/* Calls __ARM_NR_cacheflush on ARM-Linux. */

Modified: code/trunk/sljit/sljitNativeSPARC_common.c
===================================================================
--- code/trunk/sljit/sljitNativeSPARC_common.c    2012-10-24 21:29:12 UTC (rev 1174)
+++ code/trunk/sljit/sljitNativeSPARC_common.c    2012-10-26 04:47:29 UTC (rev 1175)
@@ -33,6 +33,30 @@
    Both for sparc-32 and sparc-64 */
 typedef sljit_ui sljit_ins;


+static void sparc_cache_flush(sljit_ins *from, sljit_ins *to)
+{
+    if (SLJIT_UNLIKELY(from == to))
+        return;
+
+    do {
+        __asm__ volatile (
+            "flush %0\n"
+            : : "r"(from)
+        );
+        /* Operates at least on doubleword. */
+        from += 2;
+    } while (from < to);
+
+    if (from == to) {
+        /* Flush the last word. */
+        to --;
+        __asm__ volatile (
+            "flush %0\n"
+            : : "r"(to)
+        );
+    }
+}
+
 /* TMP_REG2 is not used by getput_arg */
 #define TMP_REG1    (SLJIT_NO_REGISTERS + 1)
 #define TMP_REG2    (SLJIT_NO_REGISTERS + 2)


Modified: code/trunk/sljit/sljitUtils.c
===================================================================
--- code/trunk/sljit/sljitUtils.c    2012-10-24 21:29:12 UTC (rev 1174)
+++ code/trunk/sljit/sljitUtils.c    2012-10-26 04:47:29 UTC (rev 1175)
@@ -106,10 +106,10 @@


#else /* _WIN32 */

+#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
+
#include <pthread.h>

-#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
-
static pthread_mutex_t allocator_mutex = PTHREAD_MUTEX_INITIALIZER;

static SLJIT_INLINE void allocator_grab_lock(void)
@@ -126,6 +126,8 @@

#if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)

+#include <pthread.h>
+
static pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER;

SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)