Fix amd64 MSVC warning

This commit is contained in:
Yinan Zhang 2019-10-17 16:46:45 -07:00
parent 4fbbc817c1
commit 4fe50bc7d0
4 changed files with 40 additions and 27 deletions

View File

@ -120,8 +120,8 @@ cache_bin_ncached_max_get(szind_t ind) {
static inline cache_bin_sz_t static inline cache_bin_sz_t
cache_bin_ncached_get(cache_bin_t *bin, szind_t ind) { cache_bin_ncached_get(cache_bin_t *bin, szind_t ind) {
cache_bin_sz_t n = (tcache_bin_info[ind].stack_size + cache_bin_sz_t n = (cache_bin_sz_t)((tcache_bin_info[ind].stack_size +
bin->full_position - bin->cur_ptr.lowbits) / sizeof(void *); bin->full_position - bin->cur_ptr.lowbits) / sizeof(void *));
assert(n <= cache_bin_ncached_max_get(ind)); assert(n <= cache_bin_ncached_max_get(ind));
assert(n == 0 || *(bin->cur_ptr.ptr) != NULL); assert(n == 0 || *(bin->cur_ptr.ptr) != NULL);
@ -158,7 +158,8 @@ static inline cache_bin_sz_t
cache_bin_low_water_get(cache_bin_t *bin, szind_t ind) { cache_bin_low_water_get(cache_bin_t *bin, szind_t ind) {
cache_bin_sz_t ncached_max = cache_bin_ncached_max_get(ind); cache_bin_sz_t ncached_max = cache_bin_ncached_max_get(ind);
cache_bin_sz_t low_water = ncached_max - cache_bin_sz_t low_water = ncached_max -
(bin->low_water_position - bin->full_position) / sizeof(void *); (cache_bin_sz_t)((bin->low_water_position - bin->full_position) /
sizeof(void *));
assert(low_water <= ncached_max); assert(low_water <= ncached_max);
assert(low_water <= cache_bin_ncached_get(bin, ind)); assert(low_water <= cache_bin_ncached_get(bin, ind));
assert(bin->low_water_position >= bin->cur_ptr.lowbits); assert(bin->low_water_position >= bin->cur_ptr.lowbits);

View File

@ -3,7 +3,7 @@
void safety_check_fail(const char *format, ...); void safety_check_fail(const char *format, ...);
/* Can set to NULL for a default. */ /* Can set to NULL for a default. */
void safety_check_set_abort(void (*abort_fn)()); void safety_check_set_abort(void (*abort_fn)(const char *));
JEMALLOC_ALWAYS_INLINE void JEMALLOC_ALWAYS_INLINE void
safety_check_set_redzone(void *ptr, size_t usize, size_t bumped_usize) { safety_check_set_redzone(void *ptr, size_t usize, size_t bumped_usize) {

View File

@ -452,7 +452,7 @@ prof_emitter_write_cb(void *opaque, const char *to_write) {
return; return;
} }
#endif #endif
arg->ret = write(arg->fd, (void *)to_write, bytes); arg->ret = malloc_write_fd(arg->fd, to_write, bytes);
} }
/* /*

View File

@ -118,7 +118,7 @@ mutex_stats_init_cols(emitter_row_t *row, const char *table_name,
#define WIDTH_uint32_t 12 #define WIDTH_uint32_t 12
#define WIDTH_uint64_t 16 #define WIDTH_uint64_t 16
#define OP(counter, counter_type, human, derived, base_counter) \ #define OP(counter, counter_type, human, derived, base_counter) \
col = &col_##counter_type[k_##counter_type]; \ col = &col_##counter_type[k_##counter_type]; \
++k_##counter_type; \ ++k_##counter_type; \
emitter_col_init(col, row); \ emitter_col_init(col, row); \
@ -145,16 +145,20 @@ mutex_stats_read_global(const char *name, emitter_col_t *col_name,
emitter_col_t *dst; emitter_col_t *dst;
#define EMITTER_TYPE_uint32_t emitter_type_uint32 #define EMITTER_TYPE_uint32_t emitter_type_uint32
#define EMITTER_TYPE_uint64_t emitter_type_uint64 #define EMITTER_TYPE_uint64_t emitter_type_uint64
#define OP(counter, counter_type, human, derived, base_counter) \ #define OP(counter, counter_type, human, derived, base_counter) \
dst = &col_##counter_type[mutex_counter_##counter]; \ dst = &col_##counter_type[mutex_counter_##counter]; \
dst->type = EMITTER_TYPE_##counter_type; \ dst->type = EMITTER_TYPE_##counter_type; \
if (!derived) { \ if (!derived) { \
gen_mutex_ctl_str(cmd, MUTEX_CTL_STR_MAX_LENGTH, \ gen_mutex_ctl_str(cmd, MUTEX_CTL_STR_MAX_LENGTH, \
"mutexes", name, #counter); \ "mutexes", name, #counter); \
CTL_GET(cmd, (counter_type *)&dst->bool_val, counter_type); \ CTL_GET(cmd, (counter_type *)&dst->bool_val, \
} else { \ counter_type); \
emitter_col_t *base = &col_##counter_type[mutex_counter_##base_counter]; \ } else { \
dst->counter_type##_val = rate_per_second(base->counter_type##_val, uptime); \ emitter_col_t *base = \
&col_##counter_type[mutex_counter_##base_counter]; \
dst->counter_type##_val = \
(counter_type)rate_per_second( \
base->counter_type##_val, uptime); \
} }
MUTEX_PROF_COUNTERS MUTEX_PROF_COUNTERS
#undef OP #undef OP
@ -175,16 +179,21 @@ mutex_stats_read_arena(unsigned arena_ind, mutex_prof_arena_ind_t mutex_ind,
emitter_col_t *dst; emitter_col_t *dst;
#define EMITTER_TYPE_uint32_t emitter_type_uint32 #define EMITTER_TYPE_uint32_t emitter_type_uint32
#define EMITTER_TYPE_uint64_t emitter_type_uint64 #define EMITTER_TYPE_uint64_t emitter_type_uint64
#define OP(counter, counter_type, human, derived, base_counter) \ #define OP(counter, counter_type, human, derived, base_counter) \
dst = &col_##counter_type[mutex_counter_##counter]; \ dst = &col_##counter_type[mutex_counter_##counter]; \
dst->type = EMITTER_TYPE_##counter_type; \ dst->type = EMITTER_TYPE_##counter_type; \
if (!derived) { \ if (!derived) { \
gen_mutex_ctl_str(cmd, MUTEX_CTL_STR_MAX_LENGTH, \ gen_mutex_ctl_str(cmd, MUTEX_CTL_STR_MAX_LENGTH, \
"arenas.0.mutexes", arena_mutex_names[mutex_ind], #counter);\ "arenas.0.mutexes", arena_mutex_names[mutex_ind], \
CTL_M2_GET(cmd, arena_ind, (counter_type *)&dst->bool_val, counter_type); \ #counter); \
} else { \ CTL_M2_GET(cmd, arena_ind, \
emitter_col_t *base = &col_##counter_type[mutex_counter_##base_counter]; \ (counter_type *)&dst->bool_val, counter_type); \
dst->counter_type##_val = rate_per_second(base->counter_type##_val, uptime); \ } else { \
emitter_col_t *base = \
&col_##counter_type[mutex_counter_##base_counter]; \
dst->counter_type##_val = \
(counter_type)rate_per_second( \
base->counter_type##_val, uptime); \
} }
MUTEX_PROF_COUNTERS MUTEX_PROF_COUNTERS
#undef OP #undef OP
@ -202,17 +211,20 @@ mutex_stats_read_arena_bin(unsigned arena_ind, unsigned bin_ind,
#define EMITTER_TYPE_uint32_t emitter_type_uint32 #define EMITTER_TYPE_uint32_t emitter_type_uint32
#define EMITTER_TYPE_uint64_t emitter_type_uint64 #define EMITTER_TYPE_uint64_t emitter_type_uint64
#define OP(counter, counter_type, human, derived, base_counter) \ #define OP(counter, counter_type, human, derived, base_counter) \
dst = &col_##counter_type[mutex_counter_##counter]; \ dst = &col_##counter_type[mutex_counter_##counter]; \
dst->type = EMITTER_TYPE_##counter_type; \ dst->type = EMITTER_TYPE_##counter_type; \
if (!derived) { \ if (!derived) { \
gen_mutex_ctl_str(cmd, MUTEX_CTL_STR_MAX_LENGTH, \ gen_mutex_ctl_str(cmd, MUTEX_CTL_STR_MAX_LENGTH, \
"arenas.0.bins.0","mutex", #counter); \ "arenas.0.bins.0","mutex", #counter); \
CTL_M2_M4_GET(cmd, arena_ind, bin_ind, \ CTL_M2_M4_GET(cmd, arena_ind, bin_ind, \
(counter_type *)&dst->bool_val, counter_type); \ (counter_type *)&dst->bool_val, counter_type); \
} else { \ } else { \
emitter_col_t *base = &col_##counter_type[mutex_counter_##base_counter]; \ emitter_col_t *base = \
dst->counter_type##_val = rate_per_second(base->counter_type##_val, uptime); \ &col_##counter_type[mutex_counter_##base_counter]; \
dst->counter_type##_val = \
(counter_type)rate_per_second( \
base->counter_type##_val, uptime); \
} }
MUTEX_PROF_COUNTERS MUTEX_PROF_COUNTERS
#undef OP #undef OP