From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: bignum branch Date: Sat, 11 Aug 2018 23:15:28 +0100 Message-ID: <86eff4turj.fsf@gmail.com> References: <87o9fbbw1t.fsf@tromey.com> <87zhxwig5k.fsf@tromey.com> <86lg9gl7vy.fsf@gmail.com> <87tvo4i9em.fsf@tromey.com> <86k1ozl0yd.fsf@gmail.com> <83in4iojva.fsf@gnu.org> <86bmaasm39.fsf@gmail.com> <83a7puo8oq.fsf@gnu.org> <83zhxummef.fsf@gnu.org> <83lg9em1v6.fsf@gnu.org> <86r2j5q67t.fsf@gmail.com> <83r2j4lvyo.fsf@gnu.org> <86va8gj12l.fsf@gmail.com> <83k1owlscr.fsf@gnu.org> <86mutsiy80.fsf@gmail.com> <83eff4lqon.fsf@gnu.org> <86eff4ixcj.fsf@gmail.com> <83a7pslnzz.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1534025653 20845 195.159.176.226 (11 Aug 2018 22:14:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Aug 2018 22:14:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 12 00:14:09 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1foc9B-0005K4-4y for ged-emacs-devel@m.gmane.org; Sun, 12 Aug 2018 00:14:09 +0200 Original-Received: from localhost ([::1]:33401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1focBH-0006DD-Qx for ged-emacs-devel@m.gmane.org; Sat, 11 Aug 2018 18:16:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1focAg-0006D8-QH for emacs-devel@gnu.org; Sat, 11 Aug 2018 18:15:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1focAc-0003E3-Pk for emacs-devel@gnu.org; Sat, 11 Aug 2018 18:15:42 -0400 Original-Received: from [195.159.176.226] (port=44676 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1focAc-0003Ca-IH for emacs-devel@gnu.org; Sat, 11 Aug 2018 18:15:38 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1foc8S-0004XF-FT for emacs-devel@gnu.org; Sun, 12 Aug 2018 00:13:24 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 75 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:sgqeGPy9IAMlPYCniqGE74vYPUM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228435 Archived-At: On Sat 11 Aug 2018, Eli Zaretskii wrote: > Interesting: all the other GMP functions are referenced by their name, > and only __gmpn_popcount is referenced through the DLL import... Indeed. As building with "-O0" works and building with "-Og" fails, it seems that inlining could be involved. mpn_popcount is only called from the inlined mpz_popcount. > In the dependency walker display, which functions are shown in the > upper-right window (the "parent import function list"), the one that > shows "C" icons with green background, when you click on libgmp-10.dll > in the top-left window, the one that shows the dependency DLLs? As far as I can tell, all of the GMP exports used in emacs are listed there, including __gmpn_popcount. As Tom has completed merging to master, I have switched to the master branch and rebuilt from a clean tree (after "git clean -Xdf"). Stepping through the code in gdb, I see: (gdb) stepi 0x000000040016ebcb 1845 __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize); (gdb) 0x000000046ace5dc0 in ?? () (gdb) Thread 1 received signal SIGSEGV, Segmentation fault. 0x000000046ace5dc0 in ?? () (gdb) p mpn_popcount $5 = {} 0x401e61484 <__imp___gmpn_popcount> (gdb) x/xg mpn_popcount 0x401e61484 <__imp___gmpn_popcount>: 0x000000006ace5dc0 (gdb) disas 0x000000006ace5dc0,+0x80 Dump of assembler code from 0x6ace5dc0 to 0x6ace5e40: 0x000000006ace5dc0: push %rdi 0x000000006ace5dc1: push %rsi 0x000000006ace5dc2: mov %rcx,%rdi 0x000000006ace5dc5: mov %rdx,%rsi 0x000000006ace5dc8: push %r12 0x000000006ace5dca: push %r13 0x000000006ace5dcc: movabs $0x5555555555555555,%r10 0x000000006ace5dd6: movabs $0x3333333333333333,%r11 0x000000006ace5de0: movabs $0xf0f0f0f0f0f0f0f,%rcx 0x000000006ace5dea: movabs $0x101010101010101,%rdx 0x000000006ace5df4: lea (%rdi,%rsi,8),%rdi 0x000000006ace5df8: neg %rsi 0x000000006ace5dfb: xor %eax,%eax 0x000000006ace5dfd: bt $0x0,%esi 0x000000006ace5e01: jae 0x6ace5e50 0x000000006ace5e03: mov (%rdi,%rsi,8),%r8 0x000000006ace5e07: mov %r8,%r9 0x000000006ace5e0a: shr %r8 0x000000006ace5e0d: and %r10,%r8 0x000000006ace5e10: sub %r8,%r9 0x000000006ace5e13: mov %r9,%r8 0x000000006ace5e16: shr $0x2,%r9 0x000000006ace5e1a: and %r11,%r8 0x000000006ace5e1d: and %r11,%r9 0x000000006ace5e20: add %r8,%r9 0x000000006ace5e23: mov %r9,%r8 0x000000006ace5e26: shr $0x4,%r9 0x000000006ace5e2a: and %rcx,%r8 0x000000006ace5e2d: and %rcx,%r9 0x000000006ace5e30: add %r8,%r9 0x000000006ace5e33: imul %rdx,%r9 0x000000006ace5e37: shr $0x38,%r9 0x000000006ace5e3b: mov %r9,%rax 0x000000006ace5e3e: add $0x1,%rsi End of assembler dump. The disassembly above matches the start of mpn_popcount in the GMP sources in gmp-6.1.2/mpn/x86_64/popham.asm. AndyM