From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Newsgroups: gmane.emacs.bugs Subject: bug#41242: Port feature/native-comp to Windows Date: Thu, 14 May 2020 14:35:36 -0300 Message-ID: References: <834ksi60zn.fsf@gnu.org> <83wo5e4e9n.fsf@gnu.org> 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="91333"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41242@debbugs.gnu.org, Andrea Corallo To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 14 19:36:15 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 1jZHmI-000Nek-Mo for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 19:36:14 +0200 Original-Received: from localhost ([::1]:50774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZHmH-000493-Mi for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 13:36:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZHm6-00047c-1f for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 13:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZHm5-0007pd-PM for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 13:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZHm5-0004dS-Nd for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 13:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 17:36: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-submit@debbugs.gnu.org id=B41242.158947775517805 (code B ref 41242); Thu, 14 May 2020 17:36:01 +0000 Original-Received: (at 41242) by debbugs.gnu.org; 14 May 2020 17:35:55 +0000 Original-Received: from localhost ([127.0.0.1]:34712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZHlz-0004d5-8Y for submit@debbugs.gnu.org; Thu, 14 May 2020 13:35:55 -0400 Original-Received: from mail-oo1-f45.google.com ([209.85.161.45]:41632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZHlx-0004cq-Qg for 41242@debbugs.gnu.org; Thu, 14 May 2020 13:35:54 -0400 Original-Received: by mail-oo1-f45.google.com with SMTP id z26so531459oog.8 for <41242@debbugs.gnu.org>; Thu, 14 May 2020 10:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Xw6nok5YDsPDPqlGW3ZB5jQJyMoa+zCjCC3Op48ryak=; b=D6dlmZnn6jw7Ib4wnOLZF0EX2LsNln1GTwrhXL1wX68tDe15SIocOZF1cOF685EiM/ iP7XdunFH+0YBR7K9yJtHhwSxj5KFylHZsN1Ly6W0rNFB275k8ZgQkxY07bDDiwyqSYd VqPZAR52PrkozYos4yzckda19QdFZT9bu1yC54fjd54fY6Es+7zMVD04nSIGzSiiokG1 EmcLDm2THCOCdBDDtnZQ7BHK1Hu/gxGkE07+7ZSK0Q4rFNvlRr5j3F81wq8COgnDGVbP KMvleC5nhLi3KzlbVIy5ek/kJ1AbPQpShcSzphfveWycN+aDV8qCe/c8T5FHJOFQwIoV Nq6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Xw6nok5YDsPDPqlGW3ZB5jQJyMoa+zCjCC3Op48ryak=; b=Ga9LGNN3h2xF/JDAzJw1yZn/zmQ25ixbI9HeTdxEBKFCY3fX7vbR+It8rhuhbm4JdX lFk0cqWZ+gdTNljiGbkd3r440sdcr4PWvbuuK7YdkOgg0IfrvuElsri3MAHxDMkguTci 7CVVraLgWJ2j9CkaFsji2Cczbqp8pr8LKdzVRcIJMTrLoKbYzkwzkXrKBX6f8Fnnunvi YhkZKPCmJMy3OyGvwWe+1hr3M+x+abEDe08nL/Ta1J2FAUPZ2j027+ExdXDjx0dKLC4h T44x58W5xAH2XlAzkAAAMjN3N5MCZcdi5nCXyeTiSbG1cbgwyZHsVTbk9Q91QgZC1FB8 gWxQ== X-Gm-Message-State: AOAM531pMzjojZnIMUnlcAMUiRQFBnjD2lItRiy8VZVSdA00rNwkHGLX KiNvHgcgwHNHYx+K9/FNYeKi/8ZdiAJiv8X0bQM= X-Google-Smtp-Source: ABdhPJw6F8+i+tk0Na/+PJyvBFTNn1O4iEqyJivXxtF1bPZLZgeKJ0kvFuZLfLgdzdtGTW6k9fgEWddHt3GBSurqnRQ= X-Received: by 2002:a4a:b346:: with SMTP id n6mr4549840ooo.18.1589477748044; Thu, 14 May 2020 10:35:48 -0700 (PDT) In-Reply-To: <83wo5e4e9n.fsf@gnu.org> 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:180229 Archived-At: > Why do you need to check if it's renamed? Just rename always. You need to see if the file has been renamed because someone needs to delete the file > 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. Touch=C3=A9. El jue., 14 may. 2020 a las 14:28, Eli Zaretskii () escribi= =C3=B3: > > > From: Nicolas B=C3=A9rtolo > > 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 han= dle > > 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 fro= m > > > 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 r= ename 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 f= ile 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.