summaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2019-12-25 18:26:17 +0100
committerAndrea Corallo <akrl@sdf.org>2020-01-01 11:38:17 +0100
commit5f63ac26ccc18bcf9e364b74af4424f9e3677cf8 (patch)
tree60a760f7db1332289efb738a96869a842bcf5114 /src/comp.c
parent726d8c5bae847a3240b758a1d25135865e9304f0 (diff)
downloademacs-5f63ac26ccc18bcf9e364b74af4424f9e3677cf8.tar.gz
emacs-5f63ac26ccc18bcf9e364b74af4424f9e3677cf8.tar.bz2
emacs-5f63ac26ccc18bcf9e364b74af4424f9e3677cf8.zip
always fill freloc before compiling too
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/comp.c b/src/comp.c
index 9baa990061b..b0812433337 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -226,6 +226,34 @@ format_string (const char *format, ...)
}
static void
+freloc_check_fill (void)
+{
+ if (freloc.size)
+ return;
+
+ eassert (!NILP (Vcomp_subr_list));
+
+ if (ARRAYELTS (helper_link_table) > F_RELOC_MAX_SIZE)
+ goto overflow;
+ memcpy (freloc.link_table, helper_link_table, sizeof (helper_link_table));
+ freloc.size = ARRAYELTS (helper_link_table);
+
+ Lisp_Object subr_l = Vcomp_subr_list;
+ FOR_EACH_TAIL (subr_l)
+ {
+ if (freloc.size == F_RELOC_MAX_SIZE)
+ goto overflow;
+ struct Lisp_Subr *subr = XSUBR (XCAR (subr_l));
+ freloc.link_table[freloc.size] = subr->function.a0;
+ freloc.size++;
+ }
+ return;
+
+ overflow:
+ fatal ("Overflowing function relocation table, increase F_RELOC_MAX_SIZE");
+}
+
+static void
bcall0 (Lisp_Object f)
{
Ffuncall (1, &f);
@@ -1813,7 +1841,7 @@ emit_ctxt_code (void)
emit_static_object (TEXT_DATA_RELOC_SYM, d_reloc);
/* Functions imported from Lisp code. */
-
+ freloc_check_fill ();
gcc_jit_field **fields = xmalloc (freloc.size * sizeof (*fields));
ptrdiff_t n_frelocs = 0;
Lisp_Object f_runtime = declare_runtime_imported_funcs ();
@@ -3113,34 +3141,6 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
}
-static void
-freloc_check_fill (void)
-{
- if (freloc.size)
- return;
-
- if (ARRAYELTS (helper_link_table) > F_RELOC_MAX_SIZE)
- goto overflow;
- memcpy (freloc.link_table, helper_link_table, sizeof (helper_link_table));
- freloc.size = ARRAYELTS (helper_link_table);
-
- eassert (!NILP (Vcomp_subr_list));
-
- Lisp_Object subr_l = Vcomp_subr_list;
- FOR_EACH_TAIL (subr_l)
- {
- if (freloc.size == F_RELOC_MAX_SIZE)
- goto overflow;
- struct Lisp_Subr *subr = XSUBR (XCAR (subr_l));
- freloc.link_table[freloc.size] = subr->function.a0;
- freloc.size++;
- }
- return;
-
- overflow:
- fatal ("Overflowing function relocation table, increase F_RELOC_MAX_SIZE");
-}
-
/******************************************************************************/
/* Helper functions called from the run-time. */
/* These can't be statics till shared mechanism is used to solve relocations. */