summaryrefslogtreecommitdiff
path: root/reclaim.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 /reclaim.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 'reclaim.c')
-rw-r--r--reclaim.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/reclaim.c b/reclaim.c
index ec20a17a..6b9fe7d1 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -146,7 +146,7 @@ STATIC GC_bool GC_block_nearly_full(hdr *hhdr)
* free list. Returns the new list.
* Clears unmarked objects. Sz is in bytes.
*/
-STATIC ptr_t GC_reclaim_clear(struct hblk *hbp, hdr *hhdr, size_t sz,
+STATIC ptr_t GC_reclaim_clear(struct hblk *hbp, hdr *hhdr, word sz,
ptr_t list, signed_word *count)
{
word bit_no = 0;
@@ -193,7 +193,7 @@ STATIC ptr_t GC_reclaim_clear(struct hblk *hbp, hdr *hhdr, size_t sz,
}
/* The same thing, but don't clear objects: */
-STATIC ptr_t GC_reclaim_uninit(struct hblk *hbp, hdr *hhdr, size_t sz,
+STATIC ptr_t GC_reclaim_uninit(struct hblk *hbp, hdr *hhdr, word sz,
ptr_t list, signed_word *count)
{
word bit_no = 0;
@@ -222,7 +222,7 @@ STATIC ptr_t GC_reclaim_uninit(struct hblk *hbp, hdr *hhdr, size_t sz,
#ifdef ENABLE_DISCLAIM
/* Call reclaim notifier for block's kind on each unmarked object in */
/* block, all within a pair of corresponding enter/leave callbacks. */
- STATIC ptr_t GC_disclaim_and_reclaim(struct hblk *hbp, hdr *hhdr, size_t sz,
+ STATIC ptr_t GC_disclaim_and_reclaim(struct hblk *hbp, hdr *hhdr, word sz,
ptr_t list, signed_word *count)
{
word bit_no = 0;
@@ -331,7 +331,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp,
GC_bool report_if_found)
{
hdr *hhdr = HDR(hbp);
- size_t sz = hhdr -> hb_sz;
+ word sz = hhdr -> hb_sz;
struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
void **flh = &(ok -> ok_freelist[BYTES_TO_GRANULES(sz)]);
@@ -349,7 +349,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp,
STATIC void GC_disclaim_and_reclaim_or_free_small_block(struct hblk *hbp)
{
hdr *hhdr = HDR(hbp);
- size_t sz = hhdr -> hb_sz;
+ word sz = hhdr -> hb_sz;
struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
void **flh = &(ok -> ok_freelist[BYTES_TO_GRANULES(sz)]);
void *flh_next;
@@ -377,7 +377,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp,
STATIC void GC_reclaim_block(struct hblk *hbp, word report_if_found)
{
hdr * hhdr = HDR(hbp);
- size_t sz = hhdr -> hb_sz; /* size of objects in current block */
+ word sz = hhdr -> hb_sz; /* size of objects in current block */
struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind];
if( sz > MAXOBJBYTES ) { /* 1 big object */
@@ -385,7 +385,7 @@ STATIC void GC_reclaim_block(struct hblk *hbp, word report_if_found)
if (report_if_found) {
GC_add_leaked((ptr_t)hbp);
} else {
- size_t blocks;
+ word blocks;
# ifdef ENABLE_DISCLAIM
if (EXPECT(hhdr->hb_flags & HAS_DISCLAIM, 0)) {
@@ -481,7 +481,7 @@ int GC_n_set_marks(hdr *hhdr)
{
int result = 0;
int i;
- size_t sz = hhdr -> hb_sz;
+ word sz = hhdr -> hb_sz;
int offset = (int)MARK_BIT_OFFSET(sz);
int limit = (int)FINAL_MARK_BIT(sz);
@@ -675,7 +675,7 @@ GC_INNER void GC_start_reclaim(GC_bool report_if_found)
* appropriate free list is nonempty, or there are no more blocks to
* sweep.
*/
-GC_INNER void GC_continue_reclaim(size_t sz /* granules */, int kind)
+GC_INNER void GC_continue_reclaim(word sz /* granules */, int kind)
{
hdr * hhdr;
struct hblk * hbp;
@@ -793,7 +793,7 @@ struct enumerate_reachable_s {
STATIC void GC_do_enumerate_reachable_objects(struct hblk *hbp, word ped)
{
struct hblkhdr *hhdr = HDR(hbp);
- size_t sz = hhdr -> hb_sz;
+ size_t sz = (size_t)hhdr->hb_sz;
size_t bit_no;
char *p, *plim;