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

Top Page

Reply to this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [951] code/trunk/sljit: JIT compiler update
Revision: 951
          http://vcs.pcre.org/viewvc?view=rev&revision=951
Author:   zherczeg
Date:     2012-03-15 07:15:02 +0000 (Thu, 15 Mar 2012)


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

Modified Paths:
--------------
    code/trunk/sljit/sljitConfig.h
    code/trunk/sljit/sljitLir.h
    code/trunk/sljit/sljitUtils.c


Modified: code/trunk/sljit/sljitConfig.h
===================================================================
--- code/trunk/sljit/sljitConfig.h    2012-03-10 09:23:27 UTC (rev 950)
+++ code/trunk/sljit/sljitConfig.h    2012-03-15 07:15:02 UTC (rev 951)
@@ -60,6 +60,12 @@
 #define SLJIT_UTIL_STACK 1
 #endif


+/* Single threaded application. Does not require any locks. */
+#ifndef SLJIT_SINGLE_THREADED
+/* Disabled by default. */
+#define SLJIT_SINGLE_THREADED 0
+#endif
+
 /* --------------------------------------------------------------------- */
 /*  Configuration                                                        */
 /* --------------------------------------------------------------------- */


Modified: code/trunk/sljit/sljitLir.h
===================================================================
--- code/trunk/sljit/sljitLir.h    2012-03-10 09:23:27 UTC (rev 950)
+++ code/trunk/sljit/sljitLir.h    2012-03-15 07:15:02 UTC (rev 951)
@@ -42,6 +42,10 @@
         - very effective to cache an important value once
       - A fixed stack space can be allocated for local variables
       - The compiler is thread-safe
+      - The compiler is highly configurable through preprocessor macros.
+        You can disable unneeded features (multithreading in single
+        threaded applications), and you can use your own system functions
+        (including memory allocators). See sljitConfig.h
     Disadvantages:
       - Limited number of registers (only 6+4 integer registers, max 3+2
         temporary, max 3+2 saved and 4 floating point registers)


Modified: code/trunk/sljit/sljitUtils.c
===================================================================
--- code/trunk/sljit/sljitUtils.c    2012-03-10 09:23:27 UTC (rev 950)
+++ code/trunk/sljit/sljitUtils.c    2012-03-15 07:15:02 UTC (rev 951)
@@ -30,8 +30,38 @@


#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR) || (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)

-#ifdef _WIN32
+#if (defined SLJIT_SINGLE_THREADED && SLJIT_SINGLE_THREADED)

+#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
+
+static SLJIT_INLINE void allocator_grab_lock(void)
+{
+    // Always successful.
+}
+
+static SLJIT_INLINE void allocator_release_lock(void)
+{
+    // Always successful.
+}
+
+#endif /* SLJIT_EXECUTABLE_ALLOCATOR */
+
+#if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)
+
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
+{
+    // Always successful.
+}
+
+SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
+{
+    // Always successful.
+}
+
+#endif /* SLJIT_UTIL_GLOBAL_LOCK */
+
+#elif defined(_WIN32) /* SLJIT_SINGLE_THREADED */
+
 #include "windows.h"


#if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)