summaryrefslogtreecommitdiff
path: root/src/pcre2_jit_misc.c
diff options
context:
space:
mode:
authorzherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>2014-10-09 10:06:19 +0000
committerzherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>2014-10-09 10:06:19 +0000
commit7dd590c6886a3e85969012fe09e6d6de383e9b99 (patch)
tree02804766a6e7181fa4ffb51207aa3b7415bd81e7 /src/pcre2_jit_misc.c
parente1d12154109405742c2291e488e8e0187dbe791c (diff)
downloadpcre2-7dd590c6886a3e85969012fe09e6d6de383e9b99.tar.gz
Support for JIT code free and small partial match optimization.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@100 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_jit_misc.c')
-rw-r--r--src/pcre2_jit_misc.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c
index 79a3337..c5b1cf6 100644
--- a/src/pcre2_jit_misc.c
+++ b/src/pcre2_jit_misc.c
@@ -50,14 +50,26 @@ POSSIBILITY OF SUCH DAMAGE.
*************************************************/
void
-PRIV(jit_free)(void *executable_jit)
+PRIV(jit_free)(void *executable_jit, pcre2_memctl *memctl)
{
#ifndef SUPPORT_JIT
(void)executable_jit;
+(void)memctl;
#else /* SUPPORT_JIT */
-/* Dummy code */
-(void)executable_jit;
+executable_functions *functions = (executable_functions *)executable_jit;
+void *allocator_data = memctl;
+int i;
+
+for (i = 0; i < JIT_NUMBER_OF_COMPILE_MODES; i++)
+ {
+ if (functions->executable_funcs[i] != NULL)
+ sljit_free_code(functions->executable_funcs[i]);
+ if (functions->read_only_data[i] != NULL)
+ SLJIT_FREE(functions->read_only_data[i], allocator_data);
+ }
+
+SLJIT_FREE(functions, allocator_data);
#endif /* SUPPORT_JIT */
}
@@ -192,6 +204,7 @@ return 0;
#else /* SUPPORT_JIT */
sljit_uw *executable_sizes = ((executable_functions *)executable_jit)->executable_sizes;
+SLJIT_COMPILE_ASSERT(JIT_NUMBER_OF_COMPILE_MODES == 3, number_of_compile_modes_changed);
return executable_sizes[0] + executable_sizes[1] + executable_sizes[2];
#endif