summaryrefslogtreecommitdiff
path: root/checksums.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-02-08 11:41:45 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-02-08 11:41:45 +0300
commite794f1e7a4ef7ebd14621473420010c0db210235 (patch)
tree92902c12883ac3a8904f8d2e89bf3eccd431981c /checksums.c
parent5df7ef6c0786f3cd9b7c3208055ada6d688a0692 (diff)
downloadbdwgc-e794f1e7a4ef7ebd14621473420010c0db210235.tar.gz
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.
Diffstat (limited to 'checksums.c')
-rw-r--r--checksums.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/checksums.c b/checksums.c
index 4847661a..3af11a19 100644
--- a/checksums.c
+++ b/checksums.c
@@ -79,7 +79,7 @@ STATIC word GC_checksum(struct hblk *h)
STATIC GC_bool GC_on_free_list(struct hblk *h)
{
hdr * hhdr = HDR(h);
- size_t sz = BYTES_TO_WORDS(hhdr -> hb_sz);
+ word sz = BYTES_TO_WORDS(hhdr -> hb_sz);
ptr_t p;
if (sz > MAXOBJWORDS) return(FALSE);
@@ -148,11 +148,8 @@ word GC_bytes_in_used_blocks = 0;
STATIC void GC_add_block(struct hblk *h, word dummy GC_ATTR_UNUSED)
{
hdr * hhdr = HDR(h);
- size_t bytes = hhdr -> hb_sz;
- bytes += HBLKSIZE-1;
- bytes &= ~(HBLKSIZE-1);
- GC_bytes_in_used_blocks += bytes;
+ GC_bytes_in_used_blocks += (hhdr->hb_sz + HBLKSIZE-1) & ~(HBLKSIZE-1);
}
STATIC void GC_check_blocks(void)