]> git.eshelyaron.com Git - emacs.git/commitdiff
Free JIT contexts when compiled functions cleaned up
authorNickolas Lloyd <ultrageek.lloyd@gmail.com>
Sun, 1 Jan 2017 00:36:32 +0000 (19:36 -0500)
committerNickolas Lloyd <ultrageek.lloyd@gmail.com>
Sun, 1 Jan 2017 00:36:32 +0000 (19:36 -0500)
* 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

index 100cefeeb99ceb18c3503bc374985834cd78368c..585be227941054ee2d2448f6633df7ca8cfcb4ad 100644 (file)
@@ -30,6 +30,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <pthread.h>
 #endif
 
+#ifdef HAVE_LIBJIT
+#include <jit.h>
+#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.  */