diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2023-03-22 11:50:40 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2023-03-22 11:50:40 +0300 |
commit | b02839a6d6327f7f6fec313b355c2c1c18d8be9c (patch) | |
tree | 0a50c3e76ec555d0d0210fd1123e849f8fd2c952 /mallocx.c | |
parent | 276a0e7cbc87d4217d7eabf58b3421e5b29f1349 (diff) | |
download | bdwgc-b02839a6d6327f7f6fec313b355c2c1c18d8be9c.tar.gz |
Move increment of GC_bytes_allocd to GC_alloc_large
(refactoring)
* include/private/gc_priv.h (GC_alloc_large): Update comment (mention
that GC_bytes_allocd is updated too).
* malloc.c (GC_alloc_large_and_clear): Likewise.
* include/private/gc_priv.h (GC_allocobj): Rename sz argument to gran;
update comment.
* malloc.c (GC_alloc_large): Increment GC_bytes_allocd (by rounded lb).
* malloc.c (GC_generic_malloc_inner): Reformat code; remove lb_adjusted
local variable.
* malloc.c (GC_generic_malloc_inner_ignore_off_page,
GC_generic_malloc_inner, GC_generic_malloc_aligned): Do not update
GC_bytes_allocd.
* mallocx.c (GC_generic_malloc_ignore_off_page): Likewise.
* malloc.c (GC_generic_malloc_inner_ignore_off_page): Remove op and
lb_adjusted local variables.
* mallocx.c (GC_generic_malloc_ignore_off_page): Remove lb_rounded
local variable.
Diffstat (limited to 'mallocx.c')
-rw-r--r-- | mallocx.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -195,7 +195,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL { void *result; size_t lg; - size_t lb_rounded; word n_blocks; GC_bool init; @@ -203,8 +202,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL return GC_generic_malloc(lb, k); GC_ASSERT(k < MAXOBJKINDS); lg = ROUNDED_UP_GRANULES(lb); - lb_rounded = GRANULES_TO_BYTES(lg); - n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded); + n_blocks = OBJ_SZ_TO_BLOCKS(GRANULES_TO_BYTES(lg)); init = GC_obj_kinds[k].ok_init; if (EXPECT(get_have_errors(), FALSE)) GC_print_all_errors(); @@ -230,7 +228,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL ((word *)result)[GRANULES_TO_WORDS(lg)-2] = 0; # endif } - GC_bytes_allocd += lb_rounded; UNLOCK(); if (init && !GC_debugging_started) { BZERO(result, n_blocks * HBLKSIZE); |