Skip to content

atomic: fix mi_atomic_yield for big-endian arm32#1050

Merged
daanx merged 1 commit intomicrosoft:devfrom
vfazio:vfazio-mi_yield_atomic-armeb
Mar 28, 2025
Merged

atomic: fix mi_atomic_yield for big-endian arm32#1050
daanx merged 1 commit intomicrosoft:devfrom
vfazio:vfazio-mi_yield_atomic-armeb

Conversation

@vfazio
Copy link
Copy Markdown
Contributor

@vfazio vfazio commented Mar 28, 2025

Previously, mi_atomic_yield would not be defined on ARM32 big-endian architectures if they were pre-ARMv7.

Rework the #ifdef guard to be more readable and collapse the ARM guards so both little and big endian are handled via the same mechanism.

Now, ARMv7+ will utilize yield while older targets will use nop regardless of endianness.

closes #1046

Previously, `mi_atomic_yield` would not be defined on ARM32 big-endian
architectures if they were pre-ARMv7.

Rework the #ifdef guard to be more readable and collapse the ARM guards
so both little and big endian are handled via the same mechanism.

Now, ARMv7+ will utilize `yield` while older targets will use `nop`
regardless of endianness.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
@vfazio
Copy link
Copy Markdown
Contributor Author

vfazio commented Mar 28, 2025

@microsoft-github-policy-service agree

@vfazio
Copy link
Copy Markdown
Contributor Author

vfazio commented Mar 28, 2025

Test builds:


Little endian

vfazio@vfazio4 ~/mimalloc $ TARGETS="4 5t 6 7 8.1-a"; for i in $TARGETS; do CC="/usr/bin/arm-linux-gnueabi-gcc-10 -march=armv$i" cmake -B buildv$i -S .; make -C buildv$i; done > build.le.log
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~

vfazio@vfazio4 ~/mimalloc $ arm-linux-gnueabi-objdump --disassemble=_mi_page_use_delayed_free build*/libmimalloc.so.1.9 

buildv4/libmimalloc.so.1.9:     file format elf32-littlearm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

00011190 <_mi_page_use_delayed_free>:
   11190:       e92d43f0        push    {r4, r5, r6, r7, r8, r9, lr}
   11194:       e59fc0d0        ldr     ip, [pc, #208]  ; 1126c <_mi_page_use_delayed_free+0xdc>
   11198:       e59f30d0        ldr     r3, [pc, #208]  ; 11270 <_mi_page_use_delayed_free+0xe0>
   1119c:       e08fc00c        add     ip, pc, ip
   111a0:       e79c3003        ldr     r3, [ip, r3]
   111a4:       e24dd00c        sub     sp, sp, #12
   111a8:       e5933000        ldr     r3, [r3]
   111ac:       e58d3004        str     r3, [sp, #4]
   111b0:       e3a03000        mov     r3, #0
   111b4:       e1a06001        mov     r6, r1
   111b8:       e280501c        add     r5, r0, #28
   111bc:       e2227001        eor     r7, r2, #1
   111c0:       e3a08000        mov     r8, #0
   111c4:       e5954000        ldr     r4, [r5]
   111c8:       eb002d7a        bl      1c7b8 <__sync_synchronize>
   111cc:       e2043003        and     r3, r4, #3
   111d0:       e3530001        cmp     r3, #1
   111d4:       e58d4000        str     r4, [sp]
   111d8:       0a000010        beq     11220 <_mi_page_use_delayed_free+0x90>
   111dc:       e1560003        cmp     r6, r3
   111e0:       0a000015        beq     1123c <_mi_page_use_delayed_free+0xac>
   111e4:       e3530003        cmp     r3, #3
   111e8:       13a02000        movne   r2, #0
   111ec:       02072001        andeq   r2, r7, #1
   111f0:       e3520000        cmp     r2, #0
   111f4:       1a000010        bne     1123c <_mi_page_use_delayed_free+0xac>
   111f8:       e59d9000        ldr     r9, [sp]
   111fc:       e3c42003        bic     r2, r4, #3
   11200:       e1a01009        mov     r1, r9
   11204:       e1a00005        mov     r0, r5
   11208:       e1822006        orr     r2, r2, r6
   1120c:       eb002d01        bl      1c618 <__sync_val_compare_and_swap_4>
   11210:       e1500009        cmp     r0, r9
   11214:       0a000008        beq     1123c <_mi_page_use_delayed_free+0xac>
   11218:       e58d0000        str     r0, [sp]
   1121c:       eaffffe8        b       111c4 <_mi_page_use_delayed_free+0x34>
   11220:       e3580003        cmp     r8, #3
   11224:       8a000002        bhi     11234 <_mi_page_use_delayed_free+0xa4>
   11228:       e2888001        add     r8, r8, #1
   1122c:       e1a00000        nop                     ; (mov r0, r0)
   11230:       eaffffe3        b       111c4 <_mi_page_use_delayed_free+0x34>
   11234:       e1a00000        nop                     ; (mov r0, r0)
   11238:       eaffffe0        b       111c0 <_mi_page_use_delayed_free+0x30>
   1123c:       e59f2030        ldr     r2, [pc, #48]   ; 11274 <_mi_page_use_delayed_free+0xe4>
   11240:       e59f3028        ldr     r3, [pc, #40]   ; 11270 <_mi_page_use_delayed_free+0xe0>
   11244:       e08f2002        add     r2, pc, r2
   11248:       e7923003        ldr     r3, [r2, r3]
   1124c:       e5932000        ldr     r2, [r3]
   11250:       e59d3004        ldr     r3, [sp, #4]
   11254:       e0332002        eors    r2, r3, r2
   11258:       e3a03000        mov     r3, #0
   1125c:       1a000001        bne     11268 <_mi_page_use_delayed_free+0xd8>
   11260:       e28dd00c        add     sp, sp, #12
   11264:       e8bd83f0        pop     {r4, r5, r6, r7, r8, r9, pc}
   11268:       ebffc9af        bl      392c <__stack_chk_fail@plt>
   1126c:       0001de5c        .word   0x0001de5c
   11270:       000001f4        .word   0x000001f4
   11274:       0001ddb4        .word   0x0001ddb4

Disassembly of section .fini:

buildv5t/libmimalloc.so.1.9:     file format elf32-littlearm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

00011128 <_mi_page_use_delayed_free>:
   11128:       e92d43f0        push    {r4, r5, r6, r7, r8, r9, lr}
   1112c:       e59fc0d0        ldr     ip, [pc, #208]  ; 11204 <_mi_page_use_delayed_free+0xdc>
   11130:       e59f30d0        ldr     r3, [pc, #208]  ; 11208 <_mi_page_use_delayed_free+0xe0>
   11134:       e08fc00c        add     ip, pc, ip
   11138:       e79c3003        ldr     r3, [ip, r3]
   1113c:       e24dd00c        sub     sp, sp, #12
   11140:       e5933000        ldr     r3, [r3]
   11144:       e58d3004        str     r3, [sp, #4]
   11148:       e3a03000        mov     r3, #0
   1114c:       e1a06001        mov     r6, r1
   11150:       e280501c        add     r5, r0, #28
   11154:       e2227001        eor     r7, r2, #1
   11158:       e3a08000        mov     r8, #0
   1115c:       e5954000        ldr     r4, [r5]
   11160:       eb002cd5        bl      1c4bc <__sync_synchronize>
   11164:       e2043003        and     r3, r4, #3
   11168:       e3530001        cmp     r3, #1
   1116c:       e58d4000        str     r4, [sp]
   11170:       0a000010        beq     111b8 <_mi_page_use_delayed_free+0x90>
   11174:       e1560003        cmp     r6, r3
   11178:       0a000015        beq     111d4 <_mi_page_use_delayed_free+0xac>
   1117c:       e3530003        cmp     r3, #3
   11180:       13a02000        movne   r2, #0
   11184:       02072001        andeq   r2, r7, #1
   11188:       e3520000        cmp     r2, #0
   1118c:       1a000010        bne     111d4 <_mi_page_use_delayed_free+0xac>
   11190:       e59d9000        ldr     r9, [sp]
   11194:       e3c42003        bic     r2, r4, #3
   11198:       e1a01009        mov     r1, r9
   1119c:       e1a00005        mov     r0, r5
   111a0:       e1822006        orr     r2, r2, r6
   111a4:       eb002c5c        bl      1c31c <__sync_val_compare_and_swap_4>
   111a8:       e1500009        cmp     r0, r9
   111ac:       0a000008        beq     111d4 <_mi_page_use_delayed_free+0xac>
   111b0:       e58d0000        str     r0, [sp]
   111b4:       eaffffe8        b       1115c <_mi_page_use_delayed_free+0x34>
   111b8:       e3580003        cmp     r8, #3
   111bc:       8a000002        bhi     111cc <_mi_page_use_delayed_free+0xa4>
   111c0:       e2888001        add     r8, r8, #1
   111c4:       e1a00000        nop                     ; (mov r0, r0)
   111c8:       eaffffe3        b       1115c <_mi_page_use_delayed_free+0x34>
   111cc:       e1a00000        nop                     ; (mov r0, r0)
   111d0:       eaffffe0        b       11158 <_mi_page_use_delayed_free+0x30>
   111d4:       e59f2030        ldr     r2, [pc, #48]   ; 1120c <_mi_page_use_delayed_free+0xe4>
   111d8:       e59f3028        ldr     r3, [pc, #40]   ; 11208 <_mi_page_use_delayed_free+0xe0>
   111dc:       e08f2002        add     r2, pc, r2
   111e0:       e7923003        ldr     r3, [r2, r3]
   111e4:       e5932000        ldr     r2, [r3]
   111e8:       e59d3004        ldr     r3, [sp, #4]
   111ec:       e0332002        eors    r2, r3, r2
   111f0:       e3a03000        mov     r3, #0
   111f4:       1a000001        bne     11200 <_mi_page_use_delayed_free+0xd8>
   111f8:       e28dd00c        add     sp, sp, #12
   111fc:       e8bd83f0        pop     {r4, r5, r6, r7, r8, r9, pc}
   11200:       ebffc9c9        bl      392c <__stack_chk_fail@plt>
   11204:       0001dec4        .word   0x0001dec4
   11208:       000001f4        .word   0x000001f4
   1120c:       0001de1c        .word   0x0001de1c

Disassembly of section .fini:

buildv6/libmimalloc.so.1.9:     file format elf32-littlearm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

00010ae0 <_mi_page_use_delayed_free>:
   10ae0:       e92d4030        push    {r4, r5, lr}
   10ae4:       e280001c        add     r0, r0, #28
   10ae8:       e2224001        eor     r4, r2, #1
   10aec:       e3a05000        mov     r5, #0
   10af0:       e590c000        ldr     ip, [r0]
   10af4:       ee070fba        mcr     15, 0, r0, cr7, cr10, {5}
   10af8:       e20c3003        and     r3, ip, #3
   10afc:       e3530001        cmp     r3, #1
   10b00:       e3cce003        bic     lr, ip, #3
   10b04:       0a00000e        beq     10b44 <_mi_page_use_delayed_free+0x64>
   10b08:       e1510003        cmp     r1, r3
   10b0c:       08bd8030        popeq   {r4, r5, pc}
   10b10:       e3530003        cmp     r3, #3
   10b14:       13a02000        movne   r2, #0
   10b18:       02042001        andeq   r2, r4, #1
   10b1c:       e3520000        cmp     r2, #0
   10b20:       18bd8030        popne   {r4, r5, pc}
   10b24:       e18ee001        orr     lr, lr, r1
   10b28:       ee070fba        mcr     15, 0, r0, cr7, cr10, {5}
   10b2c:       e1903f9f        ldrex   r3, [r0]
   10b30:       e153000c        cmp     r3, ip
   10b34:       01802f9e        strexeq r2, lr, [r0]
   10b38:       03520000        cmpeq   r2, #0
   10b3c:       08bd8030        popeq   {r4, r5, pc}
   10b40:       eaffffea        b       10af0 <_mi_page_use_delayed_free+0x10>
   10b44:       e3550003        cmp     r5, #3
   10b48:       8a000002        bhi     10b58 <_mi_page_use_delayed_free+0x78>
   10b4c:       e2855001        add     r5, r5, #1
   10b50:       e1a00000        nop                     ; (mov r0, r0)
   10b54:       eaffffe5        b       10af0 <_mi_page_use_delayed_free+0x10>
   10b58:       e1a00000        nop                     ; (mov r0, r0)
   10b5c:       eaffffe2        b       10aec <_mi_page_use_delayed_free+0xc>

Disassembly of section .fini:

buildv7/libmimalloc.so.1.9:     file format elf32-littlearm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

0000c84c <_mi_page_use_delayed_free>:
    c84c:       b530            push    {r4, r5, lr}
    c84e:       301c            adds    r0, #28
    c850:       f082 0e01       eor.w   lr, r2, #1
    c854:       2500            movs    r5, #0
    c856:       6802            ldr     r2, [r0, #0]
    c858:       f3bf 8f5b       dmb     ish
    c85c:       f002 0303       and.w   r3, r2, #3
    c860:       f022 0c03       bic.w   ip, r2, #3
    c864:       2b01            cmp     r3, #1
    c866:       d014            beq.n   c892 <_mi_page_use_delayed_free+0x46>
    c868:       4299            cmp     r1, r3
    c86a:       d011            beq.n   c890 <_mi_page_use_delayed_free+0x44>
    c86c:       2b03            cmp     r3, #3
    c86e:       bf14            ite     ne
    c870:       2400            movne   r4, #0
    c872:       f00e 0401       andeq.w r4, lr, #1
    c876:       b95c            cbnz    r4, c890 <_mi_page_use_delayed_free+0x44>
    c878:       ea4c 0c01       orr.w   ip, ip, r1
    c87c:       f3bf 8f5b       dmb     ish
    c880:       e850 3f00       ldrex   r3, [r0]
    c884:       4293            cmp     r3, r2
    c886:       bf04            itt     eq
    c888:       e840 c400       strexeq r4, ip, [r0]
    c88c:       2c00            cmpeq   r4, #0
    c88e:       d1e2            bne.n   c856 <_mi_page_use_delayed_free+0xa>
    c890:       bd30            pop     {r4, r5, pc}
    c892:       2d03            cmp     r5, #3
    c894:       d802            bhi.n   c89c <_mi_page_use_delayed_free+0x50>
    c896:       3501            adds    r5, #1
    c898:       bf10            yield
    c89a:       e7dc            b.n     c856 <_mi_page_use_delayed_free+0xa>
    c89c:       bf10            yield
    c89e:       e7d9            b.n     c854 <_mi_page_use_delayed_free+0x8>

Disassembly of section .fini:

buildv8.1-a/libmimalloc.so.1.9:     file format elf32-littlearm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

00010430 <_mi_page_use_delayed_free>:
   10430:       e92d4030        push    {r4, r5, lr}
   10434:       e280001c        add     r0, r0, #28
   10438:       e2224001        eor     r4, r2, #1
   1043c:       e3a05000        mov     r5, #0
   10440:       e190cc9f        lda     ip, [r0]
   10444:       e20c3003        and     r3, ip, #3
   10448:       e3cce003        bic     lr, ip, #3
   1044c:       e3530001        cmp     r3, #1
   10450:       0a00000d        beq     1048c <_mi_page_use_delayed_free+0x5c>
   10454:       e1510003        cmp     r1, r3
   10458:       08bd8030        popeq   {r4, r5, pc}
   1045c:       e3530003        cmp     r3, #3
   10460:       13a02000        movne   r2, #0
   10464:       02042001        andeq   r2, r4, #1
   10468:       e18ee001        orr     lr, lr, r1
   1046c:       e3520000        cmp     r2, #0
   10470:       18bd8030        popne   {r4, r5, pc}
   10474:       e1903f9f        ldrex   r3, [r0]
   10478:       e153000c        cmp     r3, ip
   1047c:       01802e9e        stlexeq r2, lr, [r0]
   10480:       03520000        cmpeq   r2, #0
   10484:       08bd8030        popeq   {r4, r5, pc}
   10488:       eaffffec        b       10440 <_mi_page_use_delayed_free+0x10>
   1048c:       e3550003        cmp     r5, #3
   10490:       8a000002        bhi     104a0 <_mi_page_use_delayed_free+0x70>
   10494:       e2855001        add     r5, r5, #1
   10498:       e320f001        yield
   1049c:       eaffffe7        b       10440 <_mi_page_use_delayed_free+0x10>
   104a0:       e320f001        yield
   104a4:       eaffffe4        b       1043c <_mi_page_use_delayed_free+0xc>

Disassembly of section .fini:

Big endian

vfazio@vfazio4 ~/mimalloc $ TARGETS="4 5t 6 7 8.1-a"; for i in $TARGETS; do CC="/mnt/development/buildroot/output/per-package/python3/host/bin/armeb-buildroot-linux-gnueabi-cc -march=armv$i" cmake -B buildv$i -S .; make -C buildv$i; done > build.log
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
In file included from /home/vfazio/mimalloc/src/static.c:37:
/home/vfazio/mimalloc/src/stats.c:221:13: warning: ‘mi_stat_total_print’ defined but not used [-Wunused-function]
  221 | static void mi_stat_total_print(const mi_stat_count_t* stat, const char* msg, int64_t unit, mi_output_fun* out, void* arg) {
      |             ^~~~~~~~~~~~~~~~~~~
      
      
      
vfazio@vfazio4 ~/mimalloc $ /mnt/development/buildroot/output/per-package/python3/host/bin/armeb-buildroot-linux-gnueabi-objdump --disassemble=_mi_page_use_delayed_free build*/libmimalloc.so.1.9 

buildv4/libmimalloc.so.1.9:     file format elf32-bigarm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

000118d8 <_mi_page_use_delayed_free>:
   118d8:       e92d41f0        push    {r4, r5, r6, r7, r8, lr}
   118dc:       e59fc0d0        ldr     ip, [pc, #208]  @ 119b4 <_mi_page_use_delayed_free+0xdc>
   118e0:       e59f30d0        ldr     r3, [pc, #208]  @ 119b8 <_mi_page_use_delayed_free+0xe0>
   118e4:       e08fc00c        add     ip, pc, ip
   118e8:       e79c3003        ldr     r3, [ip, r3]
   118ec:       e24dd008        sub     sp, sp, #8
   118f0:       e5933000        ldr     r3, [r3]
   118f4:       e58d3004        str     r3, [sp, #4]
   118f8:       e3a03000        mov     r3, #0
   118fc:       e1a05001        mov     r5, r1
   11900:       e280601c        add     r6, r0, #28
   11904:       e2227001        eor     r7, r2, #1
   11908:       e3a08000        mov     r8, #0
   1190c:       e5964000        ldr     r4, [r6]
   11910:       eb002e0e        bl      1d150 <__sync_synchronize>
   11914:       e2043003        and     r3, r4, #3
   11918:       e3c42003        bic     r2, r4, #3
   1191c:       e3530001        cmp     r3, #1
   11920:       e58d4000        str     r4, [sp]
   11924:       e1822005        orr     r2, r2, r5
   11928:       0a00000e        beq     11968 <_mi_page_use_delayed_free+0x90>
   1192c:       e1550003        cmp     r5, r3
   11930:       0a000013        beq     11984 <_mi_page_use_delayed_free+0xac>
   11934:       e3530003        cmp     r3, #3
   11938:       13a01000        movne   r1, #0
   1193c:       02071001        andeq   r1, r7, #1
   11940:       e3510000        cmp     r1, #0
   11944:       1a00000e        bne     11984 <_mi_page_use_delayed_free+0xac>
   11948:       e59d4000        ldr     r4, [sp]
   1194c:       e1a00006        mov     r0, r6
   11950:       e1a01004        mov     r1, r4
   11954:       eb002d8b        bl      1cf88 <__sync_val_compare_and_swap_4>
   11958:       e1500004        cmp     r0, r4
   1195c:       0a000008        beq     11984 <_mi_page_use_delayed_free+0xac>
   11960:       e58d0000        str     r0, [sp]
   11964:       eaffffe8        b       1190c <_mi_page_use_delayed_free+0x34>
   11968:       e3580003        cmp     r8, #3
   1196c:       8a000002        bhi     1197c <_mi_page_use_delayed_free+0xa4>
   11970:       e2888001        add     r8, r8, #1
   11974:       e1a00000        nop                     @ (mov r0, r0)
   11978:       eaffffe3        b       1190c <_mi_page_use_delayed_free+0x34>
   1197c:       e1a00000        nop                     @ (mov r0, r0)
   11980:       eaffffe0        b       11908 <_mi_page_use_delayed_free+0x30>
   11984:       e59f2030        ldr     r2, [pc, #48]   @ 119bc <_mi_page_use_delayed_free+0xe4>
   11988:       e59f3028        ldr     r3, [pc, #40]   @ 119b8 <_mi_page_use_delayed_free+0xe0>
   1198c:       e08f2002        add     r2, pc, r2
   11990:       e7923003        ldr     r3, [r2, r3]
   11994:       e5932000        ldr     r2, [r3]
   11998:       e59d3004        ldr     r3, [sp, #4]
   1199c:       e0332002        eors    r2, r3, r2
   119a0:       e3a03000        mov     r3, #0
   119a4:       1a000001        bne     119b0 <_mi_page_use_delayed_free+0xd8>
   119a8:       e28dd008        add     sp, sp, #8
   119ac:       e8bd81f0        pop     {r4, r5, r6, r7, r8, pc}
   119b0:       ebffc97d        bl      3fac <__stack_chk_fail@plt>
   119b4:       0000e714        .word   0x0000e714
   119b8:       000001f4        .word   0x000001f4
   119bc:       0000e66c        .word   0x0000e66c

Disassembly of section .fini:

buildv5t/libmimalloc.so.1.9:     file format elf32-bigarm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

00011870 <_mi_page_use_delayed_free>:
   11870:       e92d41f0        push    {r4, r5, r6, r7, r8, lr}
   11874:       e59fc0d0        ldr     ip, [pc, #208]  @ 1194c <_mi_page_use_delayed_free+0xdc>
   11878:       e59f30d0        ldr     r3, [pc, #208]  @ 11950 <_mi_page_use_delayed_free+0xe0>
   1187c:       e08fc00c        add     ip, pc, ip
   11880:       e79c3003        ldr     r3, [ip, r3]
   11884:       e24dd008        sub     sp, sp, #8
   11888:       e5933000        ldr     r3, [r3]
   1188c:       e58d3004        str     r3, [sp, #4]
   11890:       e3a03000        mov     r3, #0
   11894:       e1a05001        mov     r5, r1
   11898:       e280601c        add     r6, r0, #28
   1189c:       e2227001        eor     r7, r2, #1
   118a0:       e3a08000        mov     r8, #0
   118a4:       e5964000        ldr     r4, [r6]
   118a8:       eb002d22        bl      1cd38 <__sync_synchronize>
   118ac:       e2043003        and     r3, r4, #3
   118b0:       e3c42003        bic     r2, r4, #3
   118b4:       e3530001        cmp     r3, #1
   118b8:       e58d4000        str     r4, [sp]
   118bc:       e1822005        orr     r2, r2, r5
   118c0:       0a00000e        beq     11900 <_mi_page_use_delayed_free+0x90>
   118c4:       e1550003        cmp     r5, r3
   118c8:       0a000013        beq     1191c <_mi_page_use_delayed_free+0xac>
   118cc:       e3530003        cmp     r3, #3
   118d0:       13a01000        movne   r1, #0
   118d4:       02071001        andeq   r1, r7, #1
   118d8:       e3510000        cmp     r1, #0
   118dc:       1a00000e        bne     1191c <_mi_page_use_delayed_free+0xac>
   118e0:       e59d4000        ldr     r4, [sp]
   118e4:       e1a00006        mov     r0, r6
   118e8:       e1a01004        mov     r1, r4
   118ec:       eb002c9f        bl      1cb70 <__sync_val_compare_and_swap_4>
   118f0:       e1500004        cmp     r0, r4
   118f4:       0a000008        beq     1191c <_mi_page_use_delayed_free+0xac>
   118f8:       e58d0000        str     r0, [sp]
   118fc:       eaffffe8        b       118a4 <_mi_page_use_delayed_free+0x34>
   11900:       e3580003        cmp     r8, #3
   11904:       8a000002        bhi     11914 <_mi_page_use_delayed_free+0xa4>
   11908:       e2888001        add     r8, r8, #1
   1190c:       e1a00000        nop                     @ (mov r0, r0)
   11910:       eaffffe3        b       118a4 <_mi_page_use_delayed_free+0x34>
   11914:       e1a00000        nop                     @ (mov r0, r0)
   11918:       eaffffe0        b       118a0 <_mi_page_use_delayed_free+0x30>
   1191c:       e59f2030        ldr     r2, [pc, #48]   @ 11954 <_mi_page_use_delayed_free+0xe4>
   11920:       e59f3028        ldr     r3, [pc, #40]   @ 11950 <_mi_page_use_delayed_free+0xe0>
   11924:       e08f2002        add     r2, pc, r2
   11928:       e7923003        ldr     r3, [r2, r3]
   1192c:       e5932000        ldr     r2, [r3]
   11930:       e59d3004        ldr     r3, [sp, #4]
   11934:       e0332002        eors    r2, r3, r2
   11938:       e3a03000        mov     r3, #0
   1193c:       1a000001        bne     11948 <_mi_page_use_delayed_free+0xd8>
   11940:       e28dd008        add     sp, sp, #8
   11944:       e8bd81f0        pop     {r4, r5, r6, r7, r8, pc}
   11948:       ebffc997        bl      3fac <__stack_chk_fail@plt>
   1194c:       0000e77c        .word   0x0000e77c
   11950:       000001f4        .word   0x000001f4
   11954:       0000e6d4        .word   0x0000e6d4

Disassembly of section .fini:

buildv6/libmimalloc.so.1.9:     file format elf32-bigarm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

00011078 <_mi_page_use_delayed_free>:
   11078:       e92d4030        push    {r4, r5, lr}
   1107c:       e280001c        add     r0, r0, #28
   11080:       e2224001        eor     r4, r2, #1
   11084:       e3a05000        mov     r5, #0
   11088:       e5903000        ldr     r3, [r0]
   1108c:       ee070fba        mcr     15, 0, r0, cr7, cr10, {5}
   11090:       e203e003        and     lr, r3, #3
   11094:       e3c3c003        bic     ip, r3, #3
   11098:       e35e0001        cmp     lr, #1
   1109c:       e18cc001        orr     ip, ip, r1
   110a0:       0a00000d        beq     110dc <_mi_page_use_delayed_free+0x64>
   110a4:       e151000e        cmp     r1, lr
   110a8:       08bd8030        popeq   {r4, r5, pc}
   110ac:       e35e0003        cmp     lr, #3
   110b0:       13a02000        movne   r2, #0
   110b4:       02042001        andeq   r2, r4, #1
   110b8:       e3520000        cmp     r2, #0
   110bc:       18bd8030        popne   {r4, r5, pc}
   110c0:       ee070fba        mcr     15, 0, r0, cr7, cr10, {5}
   110c4:       e1902f9f        ldrex   r2, [r0]
   110c8:       e1520003        cmp     r2, r3
   110cc:       0180ef9c        strexeq lr, ip, [r0]
   110d0:       035e0000        cmpeq   lr, #0
   110d4:       08bd8030        popeq   {r4, r5, pc}
   110d8:       eaffffea        b       11088 <_mi_page_use_delayed_free+0x10>
   110dc:       e3550003        cmp     r5, #3
   110e0:       8a000002        bhi     110f0 <_mi_page_use_delayed_free+0x78>
   110e4:       e2855001        add     r5, r5, #1
   110e8:       e1a00000        nop                     @ (mov r0, r0)
   110ec:       eaffffe5        b       11088 <_mi_page_use_delayed_free+0x10>
   110f0:       e1a00000        nop                     @ (mov r0, r0)
   110f4:       eaffffe2        b       11084 <_mi_page_use_delayed_free+0xc>

Disassembly of section .fini:

buildv7/libmimalloc.so.1.9:     file format elf32-bigarm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

0000cd98 <_mi_page_use_delayed_free>:
    cd98:       b530            push    {r4, r5, lr}
    cd9a:       301c            adds    r0, #28
    cd9c:       f082 0401       eor.w   r4, r2, #1
    cda0:       2500            movs    r5, #0
    cda2:       6803            ldr     r3, [r0, #0]
    cda4:       f3bf 8f5b       dmb     ish
    cda8:       f003 0e03       and.w   lr, r3, #3
    cdac:       f023 0c03       bic.w   ip, r3, #3
    cdb0:       ea4c 0c01       orr.w   ip, ip, r1
    cdb4:       f1be 0f01       cmp.w   lr, #1
    cdb8:       d014            beq.n   cde4 <_mi_page_use_delayed_free+0x4c>
    cdba:       4571            cmp     r1, lr
    cdbc:       d011            beq.n   cde2 <_mi_page_use_delayed_free+0x4a>
    cdbe:       f1be 0f03       cmp.w   lr, #3
    cdc2:       bf14            ite     ne
    cdc4:       2200            movne   r2, #0
    cdc6:       f004 0201       andeq.w r2, r4, #1
    cdca:       b952            cbnz    r2, cde2 <_mi_page_use_delayed_free+0x4a>
    cdcc:       f3bf 8f5b       dmb     ish
    cdd0:       e850 2f00       ldrex   r2, [r0]
    cdd4:       429a            cmp     r2, r3
    cdd6:       bf04            itt     eq
    cdd8:       e840 ce00       strexeq lr, ip, [r0]
    cddc:       f1be 0f00       cmpeq.w lr, #0
    cde0:       d1df            bne.n   cda2 <_mi_page_use_delayed_free+0xa>
    cde2:       bd30            pop     {r4, r5, pc}
    cde4:       2d03            cmp     r5, #3
    cde6:       d802            bhi.n   cdee <_mi_page_use_delayed_free+0x56>
    cde8:       3501            adds    r5, #1
    cdea:       bf10            yield
    cdec:       e7d9            b.n     cda2 <_mi_page_use_delayed_free+0xa>
    cdee:       bf10            yield
    cdf0:       e7d6            b.n     cda0 <_mi_page_use_delayed_free+0x8>

Disassembly of section .fini:

buildv8.1-a/libmimalloc.so.1.9:     file format elf32-bigarm


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

000109ac <_mi_page_use_delayed_free>:
   109ac:       e92d4030        push    {r4, r5, lr}
   109b0:       e280001c        add     r0, r0, #28
   109b4:       e2224001        eor     r4, r2, #1
   109b8:       e3a05000        mov     r5, #0
   109bc:       e1903c9f        lda     r3, [r0]
   109c0:       e203e003        and     lr, r3, #3
   109c4:       e3c3c003        bic     ip, r3, #3
   109c8:       e35e0001        cmp     lr, #1
   109cc:       e18cc001        orr     ip, ip, r1
   109d0:       0a00000c        beq     10a08 <_mi_page_use_delayed_free+0x5c>
   109d4:       e151000e        cmp     r1, lr
   109d8:       08bd8030        popeq   {r4, r5, pc}
   109dc:       e35e0003        cmp     lr, #3
   109e0:       13a02000        movne   r2, #0
   109e4:       02042001        andeq   r2, r4, #1
   109e8:       e3520000        cmp     r2, #0
   109ec:       18bd8030        popne   {r4, r5, pc}
   109f0:       e1902f9f        ldrex   r2, [r0]
   109f4:       e1520003        cmp     r2, r3
   109f8:       0180ee9c        stlexeq lr, ip, [r0]
   109fc:       035e0000        cmpeq   lr, #0
   10a00:       08bd8030        popeq   {r4, r5, pc}
   10a04:       eaffffec        b       109bc <_mi_page_use_delayed_free+0x10>
   10a08:       e3550003        cmp     r5, #3
   10a0c:       8a000002        bhi     10a1c <_mi_page_use_delayed_free+0x70>
   10a10:       e2855001        add     r5, r5, #1
   10a14:       e320f001        yield
   10a18:       eaffffe7        b       109bc <_mi_page_use_delayed_free+0x10>
   10a1c:       e320f001        yield
   10a20:       eaffffe4        b       109b8 <_mi_page_use_delayed_free+0xc>

Disassembly of section .fini:

@vfazio vfazio marked this pull request as ready for review March 28, 2025 14:14
@daanx daanx merged commit eb992b1 into microsoft:dev Mar 28, 2025
1 check passed
@daanx
Copy link
Copy Markdown
Collaborator

daanx commented Mar 28, 2025

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

atomic.h: ARM guards are broken for mi_atomic_yield

2 participants