From 31e01a98f159926493158cde6453cde55f21c42b Mon Sep 17 00:00:00 2001 From: guangli-dai Date: Wed, 14 Dec 2022 17:23:41 -0800 Subject: Fix the rdtscp detection bug and add prefix for the macro. --- configure.ac | 4 ++-- include/jemalloc/internal/jemalloc_internal_defs.h.in | 6 ++++++ include/jemalloc/internal/jemalloc_internal_inlines_a.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f38b72d6..ec7a97cb 100644 --- a/configure.ac +++ b/configure.ac @@ -522,10 +522,10 @@ typedef unsigned __int32 uint32_t; return 0; ]])], [je_cv_rdtscp=yes], - [je_cv_rdstcp=no], + [je_cv_rdtscp=no], [je_cv_rdtscp=no])) if test "x${je_cv_rdtscp}" = "xyes"; then - AC_DEFINE([HAVE_RDTSCP], 1, []) + AC_DEFINE([JEMALLOC_HAVE_RDTSCP], [ ], [ ]) fi fi ;; diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index 41e40ccf..87845a48 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -443,4 +443,10 @@ /* If defined, use volatile asm during benchmarks. */ #undef JEMALLOC_HAVE_ASM_VOLATILE +/* + * If defined, support the use of rdtscp to get the time stamp counter + * and the processor ID. + */ +#undef JEMALLOC_HAVE_RDTSCP + #endif /* JEMALLOC_INTERNAL_DEFS_H_ */ diff --git a/include/jemalloc/internal/jemalloc_internal_inlines_a.h b/include/jemalloc/internal/jemalloc_internal_inlines_a.h index 7686a9b7..cb6d78fa 100644 --- a/include/jemalloc/internal/jemalloc_internal_inlines_a.h +++ b/include/jemalloc/internal/jemalloc_internal_inlines_a.h @@ -14,7 +14,7 @@ malloc_getcpu(void) { return GetCurrentProcessorNumber(); #elif defined(JEMALLOC_HAVE_SCHED_GETCPU) return (malloc_cpuid_t)sched_getcpu(); -#elif defined(HAVE_RDTSCP) +#elif defined(JEMALLOC_HAVE_RDTSCP) unsigned int ax, cx, dx; asm volatile("rdtscp" : "=a"(ax), "=d"(dx), "=c"(cx) ::); return (malloc_cpuid_t)(dx & 0xfff); -- cgit v1.2.1