From e794f1e7a4ef7ebd14621473420010c0db210235 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 8 Feb 2018 11:41:45 +0300 Subject: Change type of hb_sz field (of hblkhdr) from size_t to word This is needed to make the size of hb_sz to be the same as of AO_t. * allchblk.c [USE_MUNMAP] (GC_unmap_old): Cast hhdr->hb_sz to size_t when passed to GC_unmap(). * allchblk.c (GC_allochblk_nth): Cast hhdr->hb_sz to signed_word when assigned to size_avail. * allchblk.c [USE_MUNMAP] (GC_allochblk_nth): Cast hhdr->hb_sz to size_t when passed to GC_remap(). * alloc.c (GC_set_fl_marks, GC_clear_fl_marks): Change type of sz and bit_no local variables from size_t/unsigned to word. * dbg_mlc.c (GC_check_heap_block): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (per_object_helper): Cast hhdr->hb_sz to size_t; change type of i local variables from int to size_t. * checksums.c [CHECKSUMS] (GC_on_free_list): Change type of sz local variable from size_t to word. * mark.c (GC_push_marked, GC_push_unconditionally, GC_block_was_dirty): Likewise. * reclaim.c (GC_reclaim_small_nonempty_block, GC_disclaim_and_reclaim_or_free_small_block, GC_reclaim_block, GC_n_set_marks): Likewise. * checksums.c [CHECKSUMS] (GC_add_block): Remove bytes local variable (to avoid casting of hhdr->hb_sz). * dbg_mlc.c (GC_debug_free): Change type of i and obj_sz local variables from size_t to word. * dbg_mlc.c (GC_check_leaked): Likewise. * extra/pcr_interface.c (GC_enumerate_block): Change type of sz local variable from int to size_t. * extra/pcr_interface.c (GC_enumerate_block): Cast hhdr->hb_sz to size_t when assigned to sz. * mallocx.c (GC_realloc): Likewise. * mark.c (GC_set_hdr_marks): Likewise. * reclaim.c (GC_do_enumerate_reachable_objects): Likewise. * include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR): Cast hhdr->hb_sz to size_t in assignment of obj_displ. * include/private/gc_priv.h (struct hblkhdr): Change type of hb_sz from size_t to word. * include/private/gc_priv.h (MARK_BIT_NO): Cast offset argument to word instead of unsigned. * malloc.c (GC_free): Cast hhdr->hb_sz to size_t. * mallocx.c (GC_get_kind_and_size): Likewise. * mark.c (GC_clear_hdr_marks): Likewise. * misc.c (GC_size): Likewise. * misc.c (GC_do_blocking): Remove redundant cast of hhdr->hb_sz. * reclaim.c (GC_reclaim_clear, GC_reclaim_uninit, GC_disclaim_and_reclaim, GC_continue_reclaim): Change type of sz argument from size_t to word. * typd_mlc.c (GC_array_mark_proc): Change type of sz and nwords local variables from size_t to word. --- malloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'malloc.c') diff --git a/malloc.c b/malloc.c index eb0e80f1..b62fd3ea 100644 --- a/malloc.c +++ b/malloc.c @@ -600,7 +600,7 @@ GC_API void GC_CALL GC_free(void * p) if (0 == hhdr) return; # endif GC_ASSERT(GC_base(p) == p); - sz = hhdr -> hb_sz; + sz = (size_t)hhdr->hb_sz; ngranules = BYTES_TO_GRANULES(sz); knd = hhdr -> hb_obj_kind; ok = &GC_obj_kinds[knd]; @@ -650,7 +650,7 @@ GC_API void GC_CALL GC_free(void * p) h = HBLKPTR(p); hhdr = HDR(h); knd = hhdr -> hb_obj_kind; - sz = hhdr -> hb_sz; + sz = (size_t)hhdr->hb_sz; ngranules = BYTES_TO_GRANULES(sz); ok = &GC_obj_kinds[knd]; if (ngranules <= MAXOBJGRANULES) { -- cgit v1.2.1