GNU bug report logs - #41242
Port feature/native-comp to Windows

Previous Next

Package: emacs;

Reported by: Nicolas Bértolo <nicolasbertolo <at> gmail.com>

Date: Wed, 13 May 2020 19:28:01 UTC

Severity: wishlist

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

Full log


Message #472 received at 41242-done <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Nicolas Bértolo <nicolasbertolo <at> gmail.com>
Cc: 41242-done <at> debbugs.gnu.org
Subject: Re: bug#41242: Port feature/native-comp to Windows - Reduce the
 number of files probed when finding a lisp file.
Date: Tue, 09 Jun 2020 17:17:19 +0000
Nicolas Bértolo <nicolasbertolo <at> gmail.com> writes:

> Hi,
>
> I have attached a bugfix for the issue that causes crashes when closing Emacs.
>
> Ideally I would figure out why iterating over  a weak hash-table does not skip
> elements that were already GC'd, but I could not do it. I feel fixing
> this bug is
> very important, so I used a C array to keep the list of native
> compilation units.

Hi Nico,

at a quick look your code to itereate looks correct and very similar to
other we have in the codebase so this is important to understand what is
going on.  Have you tried to run a reproducer like the following?

======
;;; -*- lexical-binding: t; -*-

(setq gc-cons-threshold most-positive-fixnum)
(defun foo ())
(load (native-compile #'foo))

(setq xxx (make-hash-table :weakness 'value))
(puthash 1 (subr-native-comp-unit (symbol-function #'foo)) xxx)

(defun foo ())
(maphash (lambda (k v)
	   (message "%s %s" k v))
	 xxx)

(garbage-collect)
(maphash (lambda (k v)
	   (message "%s %s" k v))
	 xxx)
======

The thing is that 'mark_and_sweep_weak_table_contents' is called after
convetional mark and before conventional sweep.  This will eventually
call 'sweep_weak_table' that sets the Qunbound as key.

Should be relativelly easy to see that the CU is sweeped there, and in
case is not see the reason.

A possibility where I bet is that something goes wrong dumping and
reviving a weak hashtable (like this is not in 'weak_hash_tables').

You can quickly check against that moving the creation of your hash such
that is created at each startup.

Hope it helps

  Andrea

-- 
akrl <at> sdf.org




This bug report was last modified 5 years and 42 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.