From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#46256: [feature/native-comp] AOT eln files ignored if run from build tree Date: Sun, 07 Mar 2021 20:16:40 +0000 Message-ID: References: <865z3866my.fsf@gmail.com> <865z38a9vo.fsf@gmail.com> <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> Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28761"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 46256@debbugs.gnu.org, andrewjmoreton@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 21:17:12 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 1lIzpv-0007MI-NF for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 21:17:11 +0100 Original-Received: from localhost ([::1]:44386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIzpu-0002Mt-LV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 15:17:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIzpm-0002LP-Cm for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:17:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lIzpm-0004JO-4l for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lIzpm-0007f3-0p for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Mar 2021 20:17:01 +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.161514820429422 (code B ref 46256); Sun, 07 Mar 2021 20:17:01 +0000 Original-Received: (at 46256) by debbugs.gnu.org; 7 Mar 2021 20:16:44 +0000 Original-Received: from localhost ([127.0.0.1]:41578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIzpT-0007eU-NN for submit@debbugs.gnu.org; Sun, 07 Mar 2021 15:16:44 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:63129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIzpR-0007eM-Oy for 46256@debbugs.gnu.org; Sun, 07 Mar 2021 15:16:42 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 127KGepg002172 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Sun, 7 Mar 2021 20:16:40 GMT In-Reply-To: <83zgzesrku.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Mar 2021 21:15:45 +0200") 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:201773 Archived-At: Eli Zaretskii writes: >> From: Andrea Corallo >> Cc: 46256@debbugs.gnu.org, andrewjmoreton@gmail.com >> Date: Sun, 07 Mar 2021 18:53:50 +0000 >> >> > (I must say that the way the async compilations are run makes it hard >> > to track down fatal errors, because I don't even have an easy way of >> > knowing which .el file was being compiled when the crash happened. >> > Any enhancements of the logging and the diagnostic messages to help in >> > these matters will be very welcome. E.g., how about introducing an >> > intermediate log level that would just show the currently compiled .el >> > file's name?) >> >> Setting `comp-async-jobs-number' to 1 and looking into the >> *Async-native-compile-log* what we are looking for in this case? > > Will try that next time. But meanwhile, I got the same problem while > rebuilding after your comp.c change. This time I clearly saw that > cc-mode.el is being compiled: > > Dumping under the name emacs.pdmp > Dumping fingerprint: 3869e2b5d74557015002c58022bce8f2e19ba06f1636f4182d7837703d6 > 22982 > Dump complete > Byte counts: header=100 hot=7960440 discardable=158256 cold=4873352 > Reloc counts: hot=501593 discardable=5154 > Adding name emacs-28.0.50.22.exe > Adding name emacs-28.0.50.22.pdmp > cp -f emacs.pdmp bootstrap-emacs.pdmp > make[1]: Leaving directory `/d/gnu/git/emacs/native-comp/src' > make -C lisp all > make[1]: Entering directory `/d/gnu/git/emacs/native-comp/lisp' > make -C ../leim all EMACS="../src/emacs.exe" > make -C ../admin/grammars all EMACS="../../src/emacs.exe" > make[2]: Entering directory `/d/gnu/git/emacs/native-comp/admin/grammars' > make[2]: Nothing to be done for `all'. > make[2]: Leaving directory `/d/gnu/git/emacs/native-comp/admin/grammars' > make[2]: Entering directory `/d/gnu/git/emacs/native-comp/leim' > make[2]: Nothing to be done for `all'. > make[2]: Leaving directory `/d/gnu/git/emacs/native-comp/leim' > make[2]: Entering directory `/d/gnu/git/emacs/native-comp/lisp' > make[2]: Nothing to be done for `compile-targets'. > make[2]: Leaving directory `/d/gnu/git/emacs/native-comp/lisp' > make[2]: Entering directory `/d/gnu/git/emacs/native-comp/lisp' > make[2]: Nothing to be done for `compile-targets'. > make[2]: Leaving directory `/d/gnu/git/emacs/native-comp/lisp' > make[2]: Entering directory `/d/gnu/git/emacs/native-comp/lisp' > ELC progmodes/cc-mode.elc > > comp.h:70: Emacs fatal error: assertion failed: NATIVE_COMP_UNITP (a) > > Attaching a debugger produces the backtrace shown below. I will leave > this process captured in the debugger, in case you want me to look at > some variables and report their values. > > Thread 1 received signal SIGTRAP, Trace/breakpoint trap. > [Switching to Thread 5500.0x114c] > 0x7c90120f in ntdll!DbgBreakPoint () from C:\WINDOWS\system32\ntdll.dll > (gdb) bt > #0 0x7c90120f in ntdll!DbgBreakPoint () from C:\WINDOWS\system32\ntdll.dll > #1 0x0135a63b in emacs_abort () at w32fns.c:10914 > #2 0x0115c637 in terminate_due_to_signal (sig=22, backtrace_limit=2147483647) > at emacs.c:417 > #3 0x0121c026 in die (msg=0x1782af2 "NATIVE_COMP_UNITP (a)", > file=0x1782aeb "comp.h", line=70) at alloc.c:7452 > #4 0x012cf582 in XNATIVE_COMP_UNIT (a=XIL(0x6f04860091b9000)) at comp.h:70 > #5 0x012df324 in load_comp_unit (comp_u=0x6f33918, loading_dump=false, > late_load=false) at comp.c:4821 > #6 0x012e0c55 in Fnative_elisp_load (filename=XIL(0x80000000092db190), > late_load=XIL(0)) at comp.c:5122 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? Thanks Andrea