summaryrefslogtreecommitdiff
path: root/src/pcre2_jit_misc.c
diff options
context:
space:
mode:
authorzherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>2015-03-06 07:41:36 +0000
committerzherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>2015-03-06 07:41:36 +0000
commit54f5af13d8b61ba4078e59e89b718c729449e399 (patch)
treefa3363b6c2077836d1aee5a2a18aa982b9ce2694 /src/pcre2_jit_misc.c
parente917562d38f048b304bd14b458713349ad6869be (diff)
downloadpcre2-54f5af13d8b61ba4078e59e89b718c729449e399.tar.gz
Remove computing the JIT read-only data size in advance and use on-demand memory allocation.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@213 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_jit_misc.c')
-rw-r--r--src/pcre2_jit_misc.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c
index f81345e..2d8088c 100644
--- a/src/pcre2_jit_misc.c
+++ b/src/pcre2_jit_misc.c
@@ -46,6 +46,25 @@ POSSIBILITY OF SUCH DAMAGE.
/*************************************************
+* Free JIT read-only data *
+*************************************************/
+
+void
+PRIV(jit_free_rodata)(void *current, void *allocator_data)
+{
+void *next;
+
+SLJIT_UNUSED_ARG(allocator_data);
+
+while (current != NULL)
+ {
+ next = *(void**)current;
+ SLJIT_FREE(current, allocator_data);
+ current = next;
+ }
+}
+
+/*************************************************
* Free JIT compiled code *
*************************************************/
@@ -65,8 +84,7 @@ 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);
+ PRIV(jit_free_rodata)(functions->read_only_data_heads[i], allocator_data);
}
SLJIT_FREE(functions, allocator_data);