summaryrefslogtreecommitdiff
path: root/mallocx.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-03-22 11:50:40 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-03-22 11:50:40 +0300
commitb02839a6d6327f7f6fec313b355c2c1c18d8be9c (patch)
tree0a50c3e76ec555d0d0210fd1123e849f8fd2c952 /mallocx.c
parent276a0e7cbc87d4217d7eabf58b3421e5b29f1349 (diff)
downloadbdwgc-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.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/mallocx.c b/mallocx.c
index cd0fc527..8dee11b3 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -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);