aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c
diff options
context:
space:
mode:
authorAndrea Corallo2020-03-26 15:47:36 +0000
committerAndrea Corallo2020-03-29 12:30:33 +0100
commit9d8ce520f03217e5aaf08b3e252a1bb82c3fc641 (patch)
tree342546aba6a2ea10a515cb8f0bc9cab885145f30 /src/comp.c
parent05f89e8ef4eb5fbcd04fcc9c0dcb92f90ad6b28c (diff)
downloademacs-9d8ce520f03217e5aaf08b3e252a1bb82c3fc641.tar.gz
emacs-9d8ce520f03217e5aaf08b3e252a1bb82c3fc641.zip
* comp.c (maybe_defer_native_compilation): Compile comp dependecies.
Make maybe_defer_native_compilation able to compile comp dependecies breaking circularity.
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/comp.c b/src/comp.c
index 60ef3bf0dcd..563f6250730 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -3356,6 +3356,10 @@ helper_PSEUDOVECTOR_TYPEP_XUNTAG (Lisp_Object a, enum pvec_type code)
3356/* Deferred compilation mechanism. */ 3356/* Deferred compilation mechanism. */
3357/***********************************/ 3357/***********************************/
3358 3358
3359/* List of sources we'll compile and load after having conventionally
3360 loaded the compiler and its dependencies. */
3361static Lisp_Object delayed_sources;
3362
3359void 3363void
3360maybe_defer_native_compilation (Lisp_Object function_name, 3364maybe_defer_native_compilation (Lisp_Object function_name,
3361 Lisp_Object definition) 3365 Lisp_Object definition)
@@ -3396,13 +3400,32 @@ maybe_defer_native_compilation (Lisp_Object function_name,
3396 if (NILP (Ffile_exists_p (src))) 3400 if (NILP (Ffile_exists_p (src)))
3397 return; 3401 return;
3398 3402
3399 /* Really happening. */ 3403 /* This is to have deferred compilaiton able to compile comp
3400 Fputhash (function_name, definition, Vcomp_deferred_pending_h); 3404 dependecies breaking circularity. */
3401 comp_deferred_compilation = false; 3405 if (!NILP (Ffeaturep (Qcomp, Qnil)))
3402 Frequire (intern_c_string ("comp"), Qnil, Qnil); 3406 {
3403 comp_deferred_compilation = true; 3407 /* Comp already loaded. */
3404 CALLN (Ffuncall, intern_c_string ("native-compile-async"), src, Qnil, 3408 if (!NILP (delayed_sources))
3405 Qlate); 3409 {
3410 CALLN (Ffuncall, intern_c_string ("native-compile-async"),
3411 delayed_sources, Qnil, Qlate);
3412 delayed_sources = Qnil;
3413 }
3414 Fputhash (function_name, definition, Vcomp_deferred_pending_h);
3415 CALLN (Ffuncall, intern_c_string ("native-compile-async"), src, Qnil,
3416 Qlate);
3417 }
3418 else
3419 {
3420 delayed_sources = Fcons (src, delayed_sources);
3421 /* Require comp only once. */
3422 static bool comp_required = false;
3423 if (!comp_required)
3424 {
3425 comp_required = true;
3426 Frequire (Qcomp, Qnil, Qnil);
3427 }
3428 }
3406} 3429}
3407 3430
3408 3431
@@ -3675,6 +3698,7 @@ syms_of_comp (void)
3675 DEFSYM (Qd_ephemeral, "d-ephemeral"); 3698 DEFSYM (Qd_ephemeral, "d-ephemeral");
3676 3699
3677 /* Others. */ 3700 /* Others. */
3701 DEFSYM (Qcomp, "comp");
3678 DEFSYM (Qfixnum, "fixnum"); 3702 DEFSYM (Qfixnum, "fixnum");
3679 DEFSYM (Qscratch, "scratch"); 3703 DEFSYM (Qscratch, "scratch");
3680 DEFSYM (Qlate, "late"); 3704 DEFSYM (Qlate, "late");
@@ -3733,6 +3757,8 @@ syms_of_comp (void)
3733 staticpro (&comp.func_blocks_h); 3757 staticpro (&comp.func_blocks_h);
3734 staticpro (&comp.emitter_dispatcher); 3758 staticpro (&comp.emitter_dispatcher);
3735 comp.emitter_dispatcher = Qnil; 3759 comp.emitter_dispatcher = Qnil;
3760 staticpro (&delayed_sources);
3761 delayed_sources = Qnil;
3736 3762
3737 DEFVAR_LISP ("comp-ctxt", Vcomp_ctxt, 3763 DEFVAR_LISP ("comp-ctxt", Vcomp_ctxt,
3738 doc: /* The compiler context. */); 3764 doc: /* The compiler context. */);