[Pcre-svn] [1531] code/trunk: Minor JIT compiler update.

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1531] code/trunk: Minor JIT compiler update.
Revision: 1531
          http://vcs.pcre.org/viewvc?view=rev&revision=1531
Author:   zherczeg
Date:     2015-03-06 07:44:16 +0000 (Fri, 06 Mar 2015)


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

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


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2015-03-05 08:53:37 UTC (rev 1530)
+++ code/trunk/pcre_jit_compile.c    2015-03-06 07:44:16 UTC (rev 1531)
@@ -2108,7 +2108,7 @@
 if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
   return NULL;


-result = (sljit_uw *)SLJIT_MALLOC(size + sizeof(sljit_uw), common->allocator_data);
+result = (sljit_uw *)SLJIT_MALLOC(size + sizeof(sljit_uw), compiler->allocator_data);
if (SLJIT_UNLIKELY(result == NULL))
{
sljit_set_compiler_memory_error(compiler);

Modified: code/trunk/sljit/sljitLir.c
===================================================================
--- code/trunk/sljit/sljitLir.c    2015-03-05 08:53:37 UTC (rev 1530)
+++ code/trunk/sljit/sljitLir.c    2015-03-06 07:44:16 UTC (rev 1531)
@@ -435,6 +435,12 @@
     SLJIT_FREE(compiler, allocator_data);
 }


+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
+{
+    if (compiler->error == SLJIT_SUCCESS)
+        compiler->error = SLJIT_ERR_ALLOC_FAILED;
+}
+
 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
 {


Modified: code/trunk/sljit/sljitLir.h
===================================================================
--- code/trunk/sljit/sljitLir.h    2015-03-05 08:53:37 UTC (rev 1530)
+++ code/trunk/sljit/sljitLir.h    2015-03-06 07:44:16 UTC (rev 1531)
@@ -429,11 +429,13 @@
    these checks increases the performance of the compiling process. */
 static SLJIT_INLINE sljit_si sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }


-/* Sets the compiler error code to SLJIT_ERR_ALLOC_FAILED. After
- the error code is set, the compiler behaves as if itself detected
- an allocation failure. This can greatly simplify error management,
- since only the compiler needs to be checked after compilation. */
-static SLJIT_INLINE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler) { compiler->error = SLJIT_ERR_ALLOC_FAILED; }
+/* Sets the compiler error code to SLJIT_ERR_ALLOC_FAILED except
+ if an error was detected before. After the error code is set
+ the compiler behaves as if the allocation failure happened
+ during an sljit function call. This can greatly simplify error
+ checking, since only the compiler status needs to be checked
+ after the compilation. */
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler);

 /*
    Allocate a small amount of memory. The size must be <= 64 bytes on 32 bit,