diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-08-03 07:53:47 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-08-03 21:26:18 +0300 |
commit | a7b3a08d30e0498de3ad44c5e75bc21600ef9ff8 (patch) | |
tree | 5b9b28d7894dfdc9875ddd9967db4fe06a4da6dc /allchblk.c | |
parent | 89308bed1754cafe54e713ef950ef04727c17299 (diff) | |
download | bdwgc-a7b3a08d30e0498de3ad44c5e75bc21600ef9ff8.tar.gz |
Use modHBLKSZ where possible
(refactoring)
* allchblk.c (GC_remove_from_fl_at, GC_add_to_fl, GC_get_first_part):
Replace v&(HBLKSIZE-1) to modHBLKSZ(v).
* allchblk.c [!GC_DISABLE_INCREMENTAL] (GC_allochblk_nth): Likewise.
* include/private/gc_priv.h (HBLKDISPL): Likewise.
* include/private/gc_hdrs.h (MAX_JUMP): Remove spaces in HBLKSIZE-1
(to match similar expressions).
* include/private/gc_priv.h (OBJ_SZ_TO_BLOCKS_CHECKED): Likewise.
* misc.c (block_add_size): Likewise.
* os_dep.c [!MSWIN_XBOX1 && !MSWINCE && (USE_WINALLOC || CYGWIN32)]
(GC_win32_get_mem): Likewise.
* include/private/gc_priv.h (HBLKMASK): Remove.
* include/private/gc_priv.h (obj_link): Remove extra space in the
expression.
* malloc.c (GC_generic_malloc_uncollectable): Replace
(word)op&(HBLKSIZE-1) to HBLKDISPL(op).
* mallocx.c (GC_realloc): Replace HBLKMASK to (HBLKSIZE-1).
Diffstat (limited to 'allchblk.c')
-rw-r--r-- | allchblk.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -301,7 +301,7 @@ static GC_bool setup_header(hdr * hhdr, struct hblk *block, size_t byte_sz, /* Remove hhdr from the free list (it is assumed to specified by index). */ STATIC void GC_remove_from_fl_at(hdr *hhdr, int index) { - GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0); + GC_ASSERT(modHBLKSZ(hhdr -> hb_sz) == 0); if (hhdr -> hb_prev == 0) { GC_ASSERT(HDR(GC_hblkfreelist[index]) == hhdr); GC_hblkfreelist[index] = hhdr -> hb_next; @@ -385,7 +385,7 @@ STATIC void GC_add_to_fl(struct hblk *h, hdr *hhdr) GC_ASSERT(prev == 0 || !HBLK_IS_FREE(prevhdr) || (GC_heapsize & SIGNB) != 0); # endif - GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0); + GC_ASSERT(modHBLKSZ(hhdr -> hb_sz) == 0); GC_hblkfreelist[index] = h; GC_free_bytes[index] += hhdr -> hb_sz; GC_ASSERT(GC_free_bytes[index] <= GC_large_free_bytes); @@ -590,7 +590,7 @@ STATIC struct hblk * GC_get_first_part(struct hblk *h, hdr *hhdr, GC_ASSERT(I_HOLD_LOCK()); total_size = hhdr -> hb_sz; - GC_ASSERT((total_size & (HBLKSIZE-1)) == 0); + GC_ASSERT(modHBLKSZ(total_size) == 0); GC_remove_from_fl_at(hhdr, index); if (total_size == bytes) return h; rest = (struct hblk *)((word)h + bytes); @@ -908,7 +908,7 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, int may_split) /* if it is avoidable. This also ensures that newly allocated */ /* blocks are treated as dirty. Necessary since we don't */ /* protect free blocks. */ - GC_ASSERT((size_needed & (HBLKSIZE-1)) == 0); + GC_ASSERT(modHBLKSZ(size_needed) == 0); GC_remove_protection(hbp, divHBLKSZ(size_needed), (hhdr -> hb_descr == 0) /* pointer-free */); # endif |