Optimize edata_cmp_summary_compare when __uint128_t is available
This commit is contained in:
parent
734f29ce56
commit
0181aaa495
15
configure.ac
15
configure.ac
|
@ -562,6 +562,21 @@ AC_CACHE_CHECK([asm volatile support],
|
|||
if test "x${je_cv_asm_volatile}" = "xyes"; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_ASM_VOLATILE], [ ], [ ])
|
||||
fi
|
||||
AC_CACHE_CHECK([__int128 support],
|
||||
[je_cv_int128],
|
||||
AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
]],
|
||||
[[
|
||||
__int128 temp = 0;
|
||||
return temp;
|
||||
]])],
|
||||
[je_cv_int128=yes],
|
||||
[je_cv_int128=no],
|
||||
[je_cv_int128=no]))
|
||||
if test "x${je_cv_int128}" = "xyes"; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_INT128], [ ], [ ])
|
||||
fi
|
||||
|
||||
LD_PRELOAD_VAR="LD_PRELOAD"
|
||||
so="so"
|
||||
|
|
|
@ -666,6 +666,21 @@ edata_cmp_summary_get(const edata_t *edata) {
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef JEMALLOC_HAVE_INT128
|
||||
JEMALLOC_ALWAYS_INLINE unsigned __int128
|
||||
edata_cmp_summary_encode(edata_cmp_summary_t src) {
|
||||
return ((unsigned __int128)src.sn << 64) | src.addr;
|
||||
}
|
||||
|
||||
static inline int
|
||||
edata_cmp_summary_comp(edata_cmp_summary_t a, edata_cmp_summary_t b) {
|
||||
unsigned __int128 a_encoded = edata_cmp_summary_encode(a);
|
||||
unsigned __int128 b_encoded = edata_cmp_summary_encode(b);
|
||||
if (a_encoded < b_encoded) return -1;
|
||||
if (a_encoded == b_encoded) return 0;
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
static inline int
|
||||
edata_cmp_summary_comp(edata_cmp_summary_t a, edata_cmp_summary_t b) {
|
||||
/*
|
||||
|
@ -683,6 +698,7 @@ edata_cmp_summary_comp(edata_cmp_summary_t a, edata_cmp_summary_t b) {
|
|||
return (2 * ((a.sn > b.sn) - (a.sn < b.sn))) +
|
||||
((a.addr > b.addr) - (a.addr < b.addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
edata_snad_comp(const edata_t *a, const edata_t *b) {
|
||||
|
|
|
@ -454,6 +454,9 @@
|
|||
*/
|
||||
#undef JEMALLOC_HAVE_RDTSCP
|
||||
|
||||
/* If defined, use __int128 for optimization. */
|
||||
#undef JEMALLOC_HAVE_INT128
|
||||
|
||||
#include "jemalloc/internal/jemalloc_internal_overrides.h"
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||
|
|
Loading…
Reference in New Issue