Store optimize qualities into .eln files

For now just comp-speed and comp-debug are stored.
This commit is contained in:
AndreaCorallo 2020-02-25 22:37:20 +00:00 committed by Andrea Corallo
parent 6898161a2b
commit 511415f6f6
3 changed files with 16 additions and 2 deletions

View file

@ -47,6 +47,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#define TEXT_DATA_RELOC_SYM "text_data_reloc"
#define TEXT_DATA_RELOC_IMPURE_SYM "text_data_reloc_imp"
#define TEXT_DATA_RELOC_EPHEMERAL_SYM "text_data_reloc_eph"
#define TEXT_OPTIM_QLY "text_optim_qly"
#define SPEED XFIXNUM (Fsymbol_value (Qcomp_speed))
#define COMP_DEBUG XFIXNUM (Fsymbol_value (Qcomp_debug))
@ -1915,6 +1916,14 @@ declare_runtime_imported_funcs (void)
static void
emit_ctxt_code (void)
{
/* Emit optimize qualities. */
Lisp_Object opt_qly[] =
{ Fcons (Qcomp_speed,
Fsymbol_value (Qcomp_speed)),
Fcons (Qcomp_debug,
Fsymbol_value (Qcomp_debug)) };
emit_static_object (TEXT_OPTIM_QLY, Flist (2, opt_qly));
comp.current_thread_ref =
gcc_jit_lvalue_as_rvalue (
gcc_jit_context_new_global (
@ -3414,6 +3423,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump)
/* Imported data. */
if (!loading_dump)
{
comp_u->optimize_qualities = load_static_obj (comp_u, TEXT_OPTIM_QLY);
comp_u->data_vec = load_static_obj (comp_u, TEXT_DATA_RELOC_SYM);
comp_u->data_impure_vec =
load_static_obj (comp_u, TEXT_DATA_RELOC_IMPURE_SYM);

View file

@ -36,6 +36,7 @@ struct Lisp_Native_Comp_Unit
union vectorlike_header header;
/* Original eln file loaded. */
Lisp_Object file;
Lisp_Object optimize_qualities;
/* Analogous to the constant vector but per compilation unit. */
Lisp_Object data_vec;
/* Same but for data that cannot be moved to pure space.

View file

@ -1840,8 +1840,11 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
#ifdef HAVE_NATIVE_COMP
case PVEC_NATIVE_COMP_UNIT:
{
print_c_string ("#<native compilation unit ", printcharfun);
print_string (XNATIVE_COMP_UNIT (obj)->file, printcharfun);
struct Lisp_Native_Comp_Unit *cu = XNATIVE_COMP_UNIT (obj);
print_c_string ("#<native compilation unit: ", printcharfun);
print_string (cu->file, printcharfun);
printchar (' ', printcharfun);
print_object (cu->optimize_qualities, printcharfun, escapeflag);
printchar ('>', printcharfun);
}
break;