[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bignum branch
From: |
Andy Moreton |
Subject: |
Re: bignum branch |
Date: |
Sat, 11 Aug 2018 23:15:28 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) |
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 = {<text variable, no debug info>} 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
- Re: bignum branch, (continued)
- Re: bignum branch, Eli Zaretskii, 2018/08/11
- Re: bignum branch, Andy Moreton, 2018/08/11
- Re: bignum branch, Eli Zaretskii, 2018/08/11
- Re: bignum branch, Andy Moreton, 2018/08/11
- Re: bignum branch, Eli Zaretskii, 2018/08/11
- Re: bignum branch, Andy Moreton, 2018/08/11
- Re: bignum branch, Eli Zaretskii, 2018/08/11
- Re: bignum branch,
Andy Moreton <=
- Re: bignum branch, Eli Zaretskii, 2018/08/12
- Re: bignum branch, Andy Moreton, 2018/08/12
- Re: bignum branch, Eli Zaretskii, 2018/08/13
- Re: bignum branch, Andy Moreton, 2018/08/13
- Re: bignum branch, Eli Zaretskii, 2018/08/14
- Re: bignum branch, Andy Moreton, 2018/08/14
- Re: bignum branch, Eli Zaretskii, 2018/08/14
- Re: bignum branch, Andy Moreton, 2018/08/14
- Re: bignum branch, Eli Zaretskii, 2018/08/15
- Re: bignum branch, Andy Moreton, 2018/08/11