From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#46256: [feature/native-comp] AOT eln files ignored if run from build tree Date: Sun, 7 Mar 2021 22:16:58 +0000 Message-ID: References: <86eehujcip.fsf@gmail.com> <86blch14qt.fsf@gmail.com> <83h7m84h9g.fsf@gnu.org> <86v9ao5czu.fsf@gmail.com> <86wnutogrh.fsf@gmail.com> <86wnut8fb9.fsf@gmail.com> <861rd1tbpa.fsf@gmail.com> <83pn0km6y3.fsf@gnu.org> <86ft1f8ara.fsf@gmail.com> <83sg5cjdn8.fsf@gnu.org> <83r1kwjcy2.fsf@gnu.org> <8335x6u9o4.fsf@gnu.org> <83zgzesrku.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27117"; mail-complaints-to="usenet@ciao.gmane.io" Cc: andrewjmoreton@gmail.com, 46256@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 23:18:15 2021 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 1lJ1j5-0006vM-1A for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 23:18:15 +0100 Original-Received: from localhost ([::1]:55244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJ1j4-0005Sq-3U for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 17:18:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJ1is-0005RS-KO for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 17:18:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58382) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJ1is-0004cX-D1 for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 17:18:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lJ1is-0002Hb-7t for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 17:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Mar 2021 22:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46256 X-GNU-PR-Package: emacs Original-Received: via spool by 46256-submit@debbugs.gnu.org id=B46256.16151554628747 (code B ref 46256); Sun, 07 Mar 2021 22:18:02 +0000 Original-Received: (at 46256) by debbugs.gnu.org; 7 Mar 2021 22:17:42 +0000 Original-Received: from localhost ([127.0.0.1]:41695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ1iX-0002Gy-MR for submit@debbugs.gnu.org; Sun, 07 Mar 2021 17:17:41 -0500 Original-Received: from mail-oi1-f180.google.com ([209.85.167.180]:42470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ1iV-0002Gl-Q0 for 46256@debbugs.gnu.org; Sun, 07 Mar 2021 17:17:40 -0500 Original-Received: by mail-oi1-f180.google.com with SMTP id x135so4555721oia.9 for <46256@debbugs.gnu.org>; Sun, 07 Mar 2021 14:17:39 -0800 (PST) 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; bh=Tm3xyXvPvlTd8p4OAirP/4SzScsIH92KgR6OSVbVXvU=; b=SVXwGgImVWwaYheVjcYmyoBTM/Jk03MohmkmX4OFWoTfJxvsoK54j5vNYff6bxujq4 koF4gAXiDbB+y0jGR46sxMCBx65J8QB8gldLfynk+/IQK5sf+n2DQiot1JOxCTMATV0p Mgu9bIfcGLOpkNgSBpb0c5/i7fQ41R6bc+8YWpfL9HWpg2vbA3/cFG4jzNjVIC+JtbF0 mbjVsrI1L/msMPa8V3m9sBhFZA6hUpIGZUtBHHPwe4ah36ZXUgQOReZEUiOj20gxiDvZ UPxTdpwVhsiPmwlAQdsO+Hk1jPJZrMdPgWIuBsmOyp6sT/QLmo0oIRzSFV7UpoI9wVMl Ix1A== 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; bh=Tm3xyXvPvlTd8p4OAirP/4SzScsIH92KgR6OSVbVXvU=; b=QTd7itC5aH4GLiRhsNhDYsYtnvydDJZ0Jnz7tC/u1cjacYPqRn1RrV1Zgcwz3F+SAX kzxmb9KmnG8AymFbXQf0FhYPi070jqjtt/1QpGKuWRj2akMnlCz3342+daTFTx1+a396 W6OsIHLW737D6woxVU17NPmdf36OJ24bkr8FgF/rf9y6MSoF7YpuNKf8TAteUv3rjucw 6g9HDgLPR1mj5X6zzur9fDWVXbJDR7mkjoUEI9373CNiQQvMywlE8udgQmbFS3B06aIK lf8UimMUmhFcyZrC5RUR+5bbSVhRQX+QgalPWMn3u+xNkHcNE/7wvtAO+D1g13ydoMm5 /nbQ== X-Gm-Message-State: AOAM530N1ZjGitgYEgGHjHS5WPju1xFxe2PS5as574pE1ZO8230udBHZ 0At+R1j0VvLMInW5zgUFVp5m9h6cXfBb/Zgzxp0= X-Google-Smtp-Source: ABdhPJxxmjSKvgp9dKqQ7oOZHSFSxRbpJdToqy+kLM2YF/4e+z5Lp8+zSTybQ+L4vbBGMXmKookuBwBsXCJGooEKYwE= X-Received: by 2002:a54:4196:: with SMTP id 22mr4683916oiy.30.1615155454125; Sun, 07 Mar 2021 14:17:34 -0800 (PST) In-Reply-To: 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:201791 Archived-At: On Sun, Mar 7, 2021 at 9:51 PM Andrea Corallo wrote: > Pip Cet writes: > > On Sun, Mar 7, 2021 at 8:17 PM Andrea Corallo via Bug reports for GNU > > Emacs, the Swiss army knife of text editors > > wrote: > >> Eli Zaretskii writes: > >> >> From: Andrea Corallo > >> >> Cc: 46256@debbugs.gnu.org, andrewjmoreton@gmail.com > >> >> Date: Sun, 07 Mar 2021 18:53:50 +0000 > >> What I think is going on here: > >> > >> The same .eln file is loaded two times, we detect that and try to reuse > >> the same compilation unit (the Lisp object) instead of a new one. > >> > >> We keep a pointer to the compilation unit representing the .eln file in > >> each .eln. Here we read it and we have it into 'saved_cu', we try to > >> dereference it and extract the CU with XNATIVE_COMP_UNIT but something > >> goes wrong. > >> > >> This object might have been GC'ed for some reason and we might be > >> looking at the same GC issue I've seen on 32bit wide-int (my guess). > >> *If* this is the case the question is: why is the CU GC'ed? > > > > Why wouldn't it be? I'm trying to follow along here :-) > > If the CU was GC'ed the eln should have been dlclosed. Wait, I thought this was on Windows? > If that's the > case at the next load we should get a fresh handle You're assuming 1. FreeLibrary() succeeded 2. The module's refcount was 1 3. The module wasn't pinned. If any of these assumptions is violated, the behavior would be precisely as observed. It's easy enough to test this: we can put a printf in dynlib_open which tells us whether we see the same handle more than once. > and 'saved_cu' should > be NULL (ops! Qnil... :/) because static allocated. Well, for one reason or another, it wasn't reset to Qnil. > Here what we see is that we are loading two times without dlclosing and > the object pointed by 'cu_saved' has some issue. I don't think so. I think we called dynlib_close(), it didn't actually unmap the library, and everything else follows. > So thinking about: the fact that the eln was never dlclosed should be > prove that the CU was not GC'ed and so I was wrong. I don't think you were wrong. Pip