Subject: Re: bug#46495: 28.0.50; [native-comp] Build fails for 32bit --with-wide-int

From: Andrea Corallo <[email-masked]>
Date: Wed, 31 Mar 2021 12:24:07 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: Andrea Corallo <[email-masked]>
>> Cc: [email-masked], [email-masked], [email-masked]
>> Date: Wed, 31 Mar 2021 10:33:43 +0000
>> 
>> >>   libgccjit-0.dll: note: disable pass tree-isolate-paths for functions in the range of [0, 4294967295]
>> >
>> > Oh, I see: it's because batch-native-compile runs the final
>> > compilation phase in a subprocess.  But doesn't that mean the
>> > non-default setting of comp-debug will not have its effect in this
>> > case?
>> 
>> `comp-debug' at that point is captured in the compilation context
>> `comp-ctxt', we have a slot for that in the structure.
>
> OK, thanks.
>
>> > Btw, I find the doc strings of the various top-level native-compile
>> > functions not very helpful when I need to understand under what
>> > circumstances they run the compilation asynchronously.  I always need
>> > to read the code, and read it carefully, to figure that out.  Can this
>> > please be improved?
>> 
>> Sure, if you have a list of the one that you have found troublesome
>> (and/or some suggestion) I'll try to improve them.
>
> I think these:
>
>   comp--native-compile, native-compile, batch-native-compile,
>   batch-byte-native-compile-for-bootstrap
>
> The first of these is an internal function, but it's used a lot, and
> its doc string describes most of what it does -- except the async
> aspect.
>
> One question I have, that perhaps will be answered by the enhanced doc
> strings, is this: how to run a batch compilation of a non-preloaded
> file such that no subprocesses at all are used?

ATM there's no way.  The idea is that we typically don't want to run in
the same process as libgccjit leaks memory (and contribute to memory
fragmentation).  We do it only for
`batch-byte-native-compile-for-bootstrap' as we know that the Emacs
process will not last long.

> There's
> comp-async-jobs-number, but a zero value doesn't disable async
> compilation, it means something else.
>
> Another question is: the documentation sometimes mentions async
> compilation and sometimes mentions deferred compilation -- but these
> are not the same, right?

I'd say:

- async compilation is the mechanism that allow for compiling
  asynchronously.

- deferred is the mechanism that allow for loading bytecode, triggering
  an async compilation and eventually perform the swap of the function
  definition when the async compilation is done.

Regards

  Andrea