Subject: bug#41242: Port feature/native-comp to Windows - Determine the emacs root dir...

From: Nicolas Bértolo <[email-masked]>
Date: Sat, 30 May 2020 13:25:48 -0300

> I guess this should then go into master right?  Probably also others
> likes to review it, in case should not be discussed in this thread.

Ok, later I will open a bug report about it.

> - We can't use "gensym" for register_native_comp_unit() because the dynamic
>   library may not have been loaded yet when loading a dump file.

> The code LGTM, I just think instead of make_fixum you could use make_int
> to have some more room (not sure how much is realistic this scenario but
> comes for free).

See new attached patch.

> I'll look into.

Thanks.

> I think this issue deserves to be precisely understood.

I was not even close. The code crashes when iterating over the
`all_loaded_comp_units_h` weak hash table. We get a SIGSEGV when iterating over
a native compilation unit that has already been swept by the GC. For some
reason the hash table does not get updated. Maybe the code I used to iterate
over the hash table is not ok for weak hash tables?

=============
  struct Lisp_Hash_Table *h = XHASH_TABLE (all_loaded_comp_units_h);

  for (ptrdiff_t i = 0; i < HASH_TABLE_SIZE (h); ++i)
    {
      Lisp_Object k = HASH_KEY (h, i);
      if (!EQ (k, Qunbound))
        {
          Lisp_Object val = HASH_VALUE (h, i);
          struct Lisp_Native_Comp_Unit *cu = XNATIVE_COMP_UNIT (val);
          dispose_comp_unit (cu, false);
        }
    }
=============

Thanks, Nico.