diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2014-03-30 11:24:12 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2014-03-30 11:24:12 +0400 |
commit | 5a4bcb2aa28f7af312922b1ecbb2f729c94caab1 (patch) | |
tree | 9a8ca423774aef14a795fdd8c68c00db86cc9b0d /malloc.c | |
parent | ff6c3d9fb8e7065ffe74cb780b2c1f54868152e2 (diff) | |
download | bdwgc-5a4bcb2aa28f7af312922b1ecbb2f729c94caab1.tar.gz |
Define ROUNDUP_PAGESIZE, ROUNDUP_GRANULE_SIZE macros (code refactoring)
* alloc.c (GC_expand_hp_inner): Use ROUNDUP_PAGESIZE().
* checksums.c (GC_record_fault, GC_was_faulted): Likewise.
* os_dep.c (GC_unix_mmap_get_mem, GC_wince_get_mem, GC_unmap_start,
GC_remove_protection): Likewise.
* headers.c (GC_scratch_alloc): Use ROUNDUP_GRANULE_SIZE().
* malloc.c (GC_alloc_large): Likewise.
* mallocx.c (GC_malloc_many): Likewise.
* headers.c (GC_scratch_alloc): Use ROUNDUP_PAGESIZE() (only if
USE_MMAP).
* include/private/gc_priv.h (ROUNDUP_GRANULE_SIZE, ROUNDUP_PAGESIZE):
Define macro to round up a value to a multiple of a granule or a page,
respectively.
Diffstat (limited to 'malloc.c')
-rw-r--r-- | malloc.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -46,8 +46,7 @@ GC_INNER ptr_t GC_alloc_large(size_t lb, int k, unsigned flags) ptr_t result; GC_bool retry = FALSE; - /* Round up to a multiple of a granule. */ - lb = (lb + GRANULE_BYTES - 1) & ~(GRANULE_BYTES - 1); + lb = ROUNDUP_GRANULE_SIZE(lb); n_blocks = OBJ_SZ_TO_BLOCKS(lb); if (!EXPECT(GC_is_initialized, TRUE)) GC_init(); /* Do our share of marking work */ |