From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#41242: Port feature/native-comp to Windows Date: Thu, 14 May 2020 20:28:36 +0300 Message-ID: <83wo5e4e9n.fsf@gnu.org> References: <834ksi60zn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="64420"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41242@debbugs.gnu.org, akrl@sdf.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 Thu May 14 19:30:11 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 1jZHgR-000GgC-JO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 19:30:11 +0200 Original-Received: from localhost ([::1]:48782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZHgQ-0001tj-La for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 13:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZHgJ-0001tN-It for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 13:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51383) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZHgJ-0006WX-9V for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 13:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZHgI-0002K7-HW for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 13:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 17:30:02 +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-submit@debbugs.gnu.org id=B41242.15894773428820 (code B ref 41242); Thu, 14 May 2020 17:30:02 +0000 Original-Received: (at 41242) by debbugs.gnu.org; 14 May 2020 17:29:02 +0000 Original-Received: from localhost ([127.0.0.1]:34695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZHfJ-0002I3-Gv for submit@debbugs.gnu.org; Thu, 14 May 2020 13:29:01 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZHfH-0002Hk-Tx for 41242@debbugs.gnu.org; Thu, 14 May 2020 13:29:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38497) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZHfB-0006Og-9m; Thu, 14 May 2020 13:28:53 -0400 Original-Received: from [176.228.60.248] (port=3540 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jZHfA-0001NF-5I; Thu, 14 May 2020 13:28:52 -0400 In-Reply-To: (message from Nicolas =?UTF-8?Q?B=C3=A9rtolo?= on Thu, 14 May 2020 13:50:48 -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:180226 Archived-At: > From: Nicolas BĂ©rtolo > Date: Thu, 14 May 2020 13:50:48 -0300 > Cc: Eli Zaretskii , 41242@debbugs.gnu.org > > 1) Call `native-comp-unload`. > > 2) This should inspect the eln file and put all the subrs defined in it on a > list. This should also copy the original bytecode from the eln file and store it > somewhere. > > 3) Then `garbage-collect` is called. This should find all references to the > subrs in the list and swap them atomically for references to functions > from the bytecode. > > 4) After the previous step the GC should be able to collect the DLL handle > knowing that no references to it remain. > > What do you think? Do we really need this complexity? > > No you are right, I don't use Windows since forever, I discovered from > > this thread is not portable. I guess we'll need to rename also here. > > But someone needs to delete the old eln file. Let's say that we use > GetModuleFileNameA() to know if another Emacs instance has decided to rename the > eln file and then we delete it on close if its suffix is ".eln.old". > > This algorithm has a big race condition though. If Emacs1 renames the file after > Emacs2 has checked that it has not been renamed, then the file won't be deleted. Why do you need to check if it's renamed? Just rename always. > If we put the "old eln" in the $TEMP folder this may not be a big issue though. It is not good to move to $TEMP because that one could be on a different volume, and Windows won't let you do that with a DLL that is loaded into a process.