Subject: bug#70914: 29.3; Crashes often on Windows

From: Andrea Corallo <[email-masked]>
Date: Thu, 16 May 2024 11:26:09 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Andrea Corallo <[email-masked]>
>> Cc: Simen Endsjø <[email-masked]>,
>>   [email-masked]
>> Date: Thu, 16 May 2024 08:11:03 -0400
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > Another possible idea is to disable native-compilation and use of
>> > *.eln files that were already compiled.  The simplest way of doing the
>> > former is to set the variables native-comp-jit-compilation and
>> > native-comp-enable-subr-trampolines to nil in your early-init file,
>> > then start Emacs as usual.  Can you try that?
>> >
>> > AFAIK, the above does not prevent Emacs from loading and using the
>> > *.eln files that were already generated.  Andrea, what is the best way
>> > of disabling the use of existing *.eln files without rebuilding Emacs?
>> > Maybe renaming libgccjit-0.dll and restarting Emacs?
>> 
>> I don't recall any pre-cooked way of doing it.  I suspect renaming
>> libgccjit-0.dll on Windows should hinibit the compilation but not the
>> load.
>> 
>> The only option that comes to my mind would be applying the following
>> and running make.
>> 
>> ================
>> modified   src/lread.c
>> @@ -1430,7 +1430,7 @@ DEFUN ("load", Fload, Sload, 1, 5, 0,
>>    else
>>      file = Fsubstitute_in_file_name (file);
>> 
>> -  bool no_native = suffix_p (file, ".elc");
>> +  bool no_native = true;/* suffix_p (file, ".elc"); */
>> 
>>    /* Avoid weird lossage with null string as arg,
>>       since it would try to load a directory as a Lisp file.  */
>> ================
>> 
>> But I guess is not an option here if one can't recompile.
>
> Probably not.
>
> For the non-preloaded *.eln files, I guess moving them out of
> native-comp-eln-load-path and setting native-comp-jit-compilation and
> native-comp-enable-subr-trampolines to nil in early-init should force
> Emacs to load the *.elc files, right?  If not, why not?

Yeah right, if moving files is an option it should work.

> But if we don't have any way of disabling loading of *.eln, I think we
> should provide it.  WDYT?

I agree, will do.

> Also, if we do provide that, what will happen with the preloaded *.eln
> files?  They are recorded in the pdumper file, so there's no way of
> starting Emacs without loading them? or is there?

We don't have ATM any mechanism to replace already loaded eln with the
corresponding elc, so I think there's no quick solution for that ATM.

  Andrea