From: Andrea Corallo Date: Sun, 15 Dec 2019 17:26:25 +0000 (+0100) Subject: malloc instead of static alloc into emit_ctxt_code X-Git-Tag: emacs-28.0.90~2727^2~913 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a10405386f83333184c94a0a194b404e4273e2d0;p=emacs.git malloc instead of static alloc into emit_ctxt_code make it good to be reentrant --- diff --git a/src/comp.c b/src/comp.c index 288aa6ccc41..3324d9f9217 100644 --- a/src/comp.c +++ b/src/comp.c @@ -1813,13 +1813,13 @@ emit_ctxt_code (void) /* Functions imported from Lisp code. */ - static gcc_jit_field *fields[F_RELOC_MAX_SIZE]; + gcc_jit_field **fields = xmalloc (freloc.size * sizeof (*fields)); ptrdiff_t n_frelocs = 0; Lisp_Object f_runtime = declare_runtime_imported_funcs (); FOR_EACH_TAIL (f_runtime) { Lisp_Object el = XCAR (f_runtime); - eassert (n_frelocs < ARRAYELTS (fields)); + eassert (n_frelocs < freloc.size); fields[n_frelocs++] = xmint_pointer (XCDR (el)); } @@ -1828,7 +1828,7 @@ emit_ctxt_code (void) { struct Lisp_Subr *subr = XSUBR (XCAR (subr_l)); Lisp_Object subr_sym = intern_c_string (subr->symbol_name); - eassert (n_frelocs < ARRAYELTS (fields)); + eassert (n_frelocs < freloc.size); fields[n_frelocs++] = declare_imported_func (subr_sym, comp.lisp_obj_type, subr->max_args, NULL); } @@ -1845,6 +1845,8 @@ emit_ctxt_code (void) GCC_JIT_GLOBAL_EXPORTED, gcc_jit_type_get_pointer (gcc_jit_struct_as_type (f_reloc_struct)), IMPORTED_FUNC_LINK_TABLE); + + xfree (fields); }