[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 9d8ce52 03/10: * comp.c (maybe_defer_native_compilat
From: |
Andrea Corallo |
Subject: |
feature/native-comp 9d8ce52 03/10: * comp.c (maybe_defer_native_compilation): Compile comp dependecies. |
Date: |
Sun, 29 Mar 2020 09:12:52 -0400 (EDT) |
branch: feature/native-comp
commit 9d8ce520f03217e5aaf08b3e252a1bb82c3fc641
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
* comp.c (maybe_defer_native_compilation): Compile comp dependecies.
Make maybe_defer_native_compilation able to compile comp dependecies
breaking circularity.
---
src/comp.c | 40 +++++++++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/src/comp.c b/src/comp.c
index 60ef3bf..563f625 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -3356,6 +3356,10 @@ helper_PSEUDOVECTOR_TYPEP_XUNTAG (Lisp_Object a, enum
pvec_type code)
/* Deferred compilation mechanism. */
/***********************************/
+/* List of sources we'll compile and load after having conventionally
+ loaded the compiler and its dependencies. */
+static Lisp_Object delayed_sources;
+
void
maybe_defer_native_compilation (Lisp_Object function_name,
Lisp_Object definition)
@@ -3396,13 +3400,32 @@ maybe_defer_native_compilation (Lisp_Object
function_name,
if (NILP (Ffile_exists_p (src)))
return;
- /* Really happening. */
- Fputhash (function_name, definition, Vcomp_deferred_pending_h);
- comp_deferred_compilation = false;
- Frequire (intern_c_string ("comp"), Qnil, Qnil);
- comp_deferred_compilation = true;
- CALLN (Ffuncall, intern_c_string ("native-compile-async"), src, Qnil,
- Qlate);
+ /* This is to have deferred compilaiton able to compile comp
+ dependecies breaking circularity. */
+ if (!NILP (Ffeaturep (Qcomp, Qnil)))
+ {
+ /* Comp already loaded. */
+ if (!NILP (delayed_sources))
+ {
+ CALLN (Ffuncall, intern_c_string ("native-compile-async"),
+ delayed_sources, Qnil, Qlate);
+ delayed_sources = Qnil;
+ }
+ Fputhash (function_name, definition, Vcomp_deferred_pending_h);
+ CALLN (Ffuncall, intern_c_string ("native-compile-async"), src, Qnil,
+ Qlate);
+ }
+ else
+ {
+ delayed_sources = Fcons (src, delayed_sources);
+ /* Require comp only once. */
+ static bool comp_required = false;
+ if (!comp_required)
+ {
+ comp_required = true;
+ Frequire (Qcomp, Qnil, Qnil);
+ }
+ }
}
@@ -3675,6 +3698,7 @@ syms_of_comp (void)
DEFSYM (Qd_ephemeral, "d-ephemeral");
/* Others. */
+ DEFSYM (Qcomp, "comp");
DEFSYM (Qfixnum, "fixnum");
DEFSYM (Qscratch, "scratch");
DEFSYM (Qlate, "late");
@@ -3733,6 +3757,8 @@ syms_of_comp (void)
staticpro (&comp.func_blocks_h);
staticpro (&comp.emitter_dispatcher);
comp.emitter_dispatcher = Qnil;
+ staticpro (&delayed_sources);
+ delayed_sources = Qnil;
DEFVAR_LISP ("comp-ctxt", Vcomp_ctxt,
doc: /* The compiler context. */);
- feature/native-comp updated (bb0496e -> 00ee320), Andrea Corallo, 2020/03/29
- feature/native-comp 05f89e8 02/10: src/comp.c (Fcomp__init_ctxt): Aesthetic, Andrea Corallo, 2020/03/29
- feature/native-comp 9d8ce52 03/10: * comp.c (maybe_defer_native_compilation): Compile comp dependecies.,
Andrea Corallo <=
- feature/native-comp 3c5e3ca 05/10: * test/src/comp-test-funcs.el (comp-test-big-interactive): New test, Andrea Corallo, 2020/03/29
- feature/native-comp 79483a5 01/10: * .gitlab-ci.yml (test-native-bootstrap-speed*): Timeout to 8h, Andrea Corallo, 2020/03/29
- feature/native-comp d5f6dc1 04/10: Prevent collisions in C namespace and function shadowing, Andrea Corallo, 2020/03/29
- feature/native-comp 89cbff3 06/10: * test/src/comp-tests.el (comp-tests-doc): Fix, Andrea Corallo, 2020/03/29
- feature/native-comp 530faee 09/10: Fix free function compilation, Andrea Corallo, 2020/03/29
- feature/native-comp c69c185 07/10: Add comp-test-40187 checking function shadowing., Andrea Corallo, 2020/03/29
- feature/native-comp 53f9bc6 08/10: * comp.el (comp-output-base-filename): Handle src being a symbol, Andrea Corallo, 2020/03/29
- feature/native-comp 00ee320 10/10: Merge remote-tracking branch 'savannah/master' into HEAD, Andrea Corallo, 2020/03/29