diff options
author | zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2015-03-06 07:44:16 +0000 |
---|---|---|
committer | zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2015-03-06 07:44:16 +0000 |
commit | 08025021c3fe75fae0d3a667aefd11dbace5f151 (patch) | |
tree | 18488b224614cfded19b077d2d5911f9f4e52b9c | |
parent | 3831a81914cf11565bf429dd019c9442b404bc5f (diff) | |
download | pcre-08025021c3fe75fae0d3a667aefd11dbace5f151.tar.gz |
Minor JIT compiler update.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1531 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | pcre_jit_compile.c | 2 | ||||
-rw-r--r-- | sljit/sljitLir.c | 6 | ||||
-rw-r--r-- | sljit/sljitLir.h | 12 |
3 files changed, 14 insertions, 6 deletions
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c index 46ce097..b1f75b2 100644 --- a/pcre_jit_compile.c +++ b/pcre_jit_compile.c @@ -2108,7 +2108,7 @@ sljit_uw *result; 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); diff --git a/sljit/sljitLir.c b/sljit/sljitLir.c index 8112e8d..5039a7e 100644 --- a/sljit/sljitLir.c +++ b/sljit/sljitLir.c @@ -435,6 +435,12 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compile 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) { diff --git a/sljit/sljitLir.h b/sljit/sljitLir.h index 79f1d10..24c0f60 100644 --- a/sljit/sljitLir.h +++ b/sljit/sljitLir.h @@ -429,11 +429,13 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compile 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, |