summaryrefslogtreecommitdiff
path: root/sljit
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-10-26 04:47:29 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-10-26 04:47:29 +0000
commit090076e4e902fd8df0b1b2498c30a6a074ef26f9 (patch)
treeaf2828322637402aa06089938a67f044b1c72f60 /sljit
parentaf4a4331972a63d9ed6768c08bdca1fcc11fa1a0 (diff)
downloadpcre-090076e4e902fd8df0b1b2498c30a6a074ef26f9.tar.gz
JIT compiler update.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1175 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'sljit')
-rw-r--r--sljit/sljitConfigInternal.h6
-rw-r--r--sljit/sljitNativeSPARC_common.c24
-rw-r--r--sljit/sljitUtils.c6
3 files changed, 34 insertions, 2 deletions
diff --git a/sljit/sljitConfigInternal.h b/sljit/sljitConfigInternal.h
index 1dfff6a..61c7255 100644
--- a/sljit/sljitConfigInternal.h
+++ b/sljit/sljitConfigInternal.h
@@ -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. */
diff --git a/sljit/sljitNativeSPARC_common.c b/sljit/sljitNativeSPARC_common.c
index 85a320c..c825d2c 100644
--- a/sljit/sljitNativeSPARC_common.c
+++ b/sljit/sljitNativeSPARC_common.c
@@ -33,6 +33,30 @@ SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
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)
diff --git a/sljit/sljitUtils.c b/sljit/sljitUtils.c
index 56cf32a..e3ffbf9 100644
--- a/sljit/sljitUtils.c
+++ b/sljit/sljitUtils.c
@@ -106,10 +106,10 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
#else /* _WIN32 */
-#include <pthread.h>
-
#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
+#include <pthread.h>
+
static pthread_mutex_t allocator_mutex = PTHREAD_MUTEX_INITIALIZER;
static SLJIT_INLINE void allocator_grab_lock(void)
@@ -126,6 +126,8 @@ static SLJIT_INLINE void allocator_release_lock(void)
#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)