Skip to content

Commit 014be9a

Browse files
committed
disable MEMZERO16X for now on riscV (due to compiler errors)
1 parent 5e4b2ce commit 014be9a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

include/mimalloc/internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,8 +1523,9 @@ static mi_decl_forceinline void* _mi_memzero_block(mi_block_t* dst, size_t bsize
15231523

15241524
// fast memzero for small sizes based on overlapping writes (and assuming non-zero size_t-multiple size, and size_t aligned)
15251525
// assumes constant memset(p,0,N) gets optimized to fast simd stores by the compiler
1526+
// note: disabled on riscv for now as a constant memset is not always replaced correctly by current compilers.
15261527
// (compile with -DMI_USE_MEMZERO16X=0 to disable this)
1527-
#if !defined(MI_USE_MEMZERO16X) || (MI_USE_MEMZERO16X != 0) // 16x MI_SIZE_SIZE (128 bytes on 64-bit)
1528+
#if (!defined(MI_USE_MEMZERO16X) && !MI_ARCH_RISCV) || (MI_USE_MEMZERO16X != 0) // 16x MI_SIZE_SIZE (128 bytes on 64-bit)
15281529
if mi_unlikely(bsize < 2*MI_SIZE_SIZE) { // bsize < 16 (8)
15291530
*((size_t*)dst) = 0;
15301531
return dst;

src/alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static mi_decl_noinline void mi_page_block_setup_padding(mi_page_t* page, mi_blo
4949
// Fast allocation in a page: just pop from the free list.
5050
// Fall back to generic allocation only if the list is empty.
5151
// Note: even though there is a lot of checks etc in the source,
52-
// in release mode the (inlined) routine is about 7 instructions with a single test.
52+
// in release mode the (inlined) routine is about 7 to 10 instructions with a single test.
5353
static mi_decl_forceinline void* mi_page_malloc_zero(mi_theap_t* theap, mi_page_t* page, size_t size, size_t sample_countdown, bool zero, mi_page_t** ppage) mi_attr_noexcept
5454
{
5555
if (page->block_size != 0) { // not the empty theap

0 commit comments

Comments
 (0)