From fcc76c6d04ce212d579620fcac9c166a0ff141b5 Mon Sep 17 00:00:00 2001 From: Nickolas Lloyd Date: Sat, 31 Dec 2016 19:36:32 -0500 Subject: [PATCH] Free JIT contexts when compiled functions cleaned up * src/alloc.c (cleanup_vector): Call jit_context_destroy () to destroy a compiled function's associated context when it's pseudovector is destroyed. --- src/alloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/alloc.c b/src/alloc.c index 100cefeeb99..585be227941 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -30,6 +30,10 @@ along with GNU Emacs. If not, see . */ #include #endif +#ifdef HAVE_LIBJIT +#include +#endif + #include "lisp.h" #include "dispextern.h" #include "intervals.h" @@ -3214,6 +3218,13 @@ cleanup_vector (struct Lisp_Vector *vector) finalize_one_mutex ((struct Lisp_Mutex *) vector); else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_CONDVAR)) finalize_one_condvar ((struct Lisp_CondVar *) vector); + else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_COMPILED) + && (void *)vector->contents[COMPILED_JIT_ID] != NULL) + { + jit_function_t func = + (jit_function_t )vector->contents[COMPILED_JIT_ID]; + jit_context_destroy (jit_function_get_context (func)); + } } /* Reclaim space used by unmarked vectors. */ -- 2.39.5