From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="113444"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: 41242-done@debbugs.gnu.org To: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 09 19:39:28 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiiDg-000TPB-0s for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Jun 2020 19:39:28 +0200 Original-Received: from localhost ([::1]:41418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiiDf-0006Mo-0a for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Jun 2020 13:39:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jihsw-0001VB-GY for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 13:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jihsw-0001Tg-4b for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 13:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jihsv-0006iN-Ua for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 13:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Jun 2020 17:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41242 X-GNU-PR-Package: emacs Original-Received: via spool by 41242-done@debbugs.gnu.org id=D41242.159172304325761 (code D ref 41242); Tue, 09 Jun 2020 17:18:01 +0000 Original-Received: (at 41242-done) by debbugs.gnu.org; 9 Jun 2020 17:17:23 +0000 Original-Received: from localhost ([127.0.0.1]:60848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jihsI-0006hR-Mz for submit@debbugs.gnu.org; Tue, 09 Jun 2020 13:17:22 -0400 Original-Received: from mx.sdf.org ([205.166.94.20]:55618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jihsG-0006hJ-L2 for 41242-done@debbugs.gnu.org; Tue, 09 Jun 2020 13:17:21 -0400 Original-Received: from sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 059HHJwR028284 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Tue, 9 Jun 2020 17:17:19 GMT Original-Received: (from akrl@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 059HHJZH012821; Tue, 9 Jun 2020 17:17:19 GMT In-Reply-To: ("Nicolas =?UTF-8?Q?B=C3=A9rtolo?="'s message of "Tue, 9 Jun 2020 11:14:55 -0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181795 Archived-At: Nicolas B=C3=A9rtolo writes: > Hi, > > I have attached a bugfix for the issue that causes crashes when closing E= macs. > > 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? =3D=3D=3D=3D=3D=3D ;;; -*- 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) =3D=3D=3D=3D=3D=3D 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 --=20 akrl@sdf.org