From 45cc672af182e73482c1b65780791efe50a70e75 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 6 May 2023 00:53:35 +0300 Subject: [PATCH] move allocation log message to before allocating and print result --- src/opt/mm_buddyTemplate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/opt/mm_buddyTemplate.c b/src/opt/mm_buddyTemplate.c index 0eed58d0..93d5d418 100644 --- a/src/opt/mm_buddyTemplate.c +++ b/src/opt/mm_buddyTemplate.c @@ -66,10 +66,15 @@ static NOINLINE void* BN(allocateMore)(i64 bucket, u8 type, i64 from, i64 to) { thrOOM(); } + #if LOG_GC || LOG_MM_MORE + fprintf(stderr, "allocating "N64u" more " str1(BN()) " heap (from allocation of "N64u"B/bucket %d)", sz, (u64)BSZ(bucket), (int)bucket); + #endif #if NO_MMAP EmptyValue* c = calloc(sz+getPageSize(), 1); + fprintf(stderr, "\n"); #else u8* mem = MMAP(sz); + fprintf(stderr, ": got %p\n", mem); if (mem==MAP_FAILED) thrOOM(); if (ptr2u64(mem)+sz > (1ULL<<48)) err("mmap returned address range above 2⋆48"); #if ALLOC_MODE==0 @@ -80,9 +85,6 @@ static NOINLINE void* BN(allocateMore)(i64 bucket, u8 type, i64 from, i64 to) { #endif mm_heapAlloc+= sz; - #if LOG_GC || LOG_MM_MORE - fprintf(stderr, "allocating "N64u" more " str1(BN()) " heap (from allocation of "N64u"B/bucket %d)\n", sz, (u64)BSZ(bucket), (int)bucket); - #endif if (alSize+1>=alCap) { alCap = alCap? alCap*2 : 1024; al = realloc(al, sizeof(AllocInfo)*alCap);