Use asm volatile during benchmarks.

This commit is contained in:
guangli-dai 2022-12-15 10:54:33 -08:00 committed by Qi Wang
parent e8b28908de
commit 09e4b38fb1
6 changed files with 51 additions and 7 deletions

View file

@ -58,3 +58,14 @@ compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
dallocx(p, 0);
}
static inline void *
no_opt_ptr(void *ptr) {
#ifdef JEMALLOC_HAVE_ASM_VOLATILE
asm volatile("" : "+r"(ptr));
#else
void *volatile dup = ptr;
ptr = dup;
#endif
return ptr;
}