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

@ -151,10 +151,14 @@ mutex_stats_read_global(const char *name, emitter_col_t *col_name,
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, \
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
@ -180,11 +184,16 @@ mutex_stats_read_arena(unsigned arena_ind, mutex_prof_arena_ind_t mutex_ind,
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); \
CTL_M2_GET(cmd, arena_ind, \
(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
@ -211,8 +220,11 @@ mutex_stats_read_arena_bin(unsigned arena_ind, unsigned bin_ind,
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