diff --git a/benchmarks/allocator/allocator_shared_object_file.c b/benchmarks/allocator/allocator_shared_object_file.c index 49bb96f..0eca7c0 100644 --- a/benchmarks/allocator/allocator_shared_object_file.c +++ b/benchmarks/allocator/allocator_shared_object_file.c @@ -256,31 +256,31 @@ static void INITREGULARALLOC(void) { int notrun = 0; // Quick malloc implementation with mmap -// void *malloc(size_t sz) -// { -// // If malloc is called for the first time then allocate huge page -// // if (notrun == 0) { -// // INITREGULARALLOC(); -// // notrun = 1; -// // } -// sz = __builtin_align_up(sz, _Alignof(max_align_t)); +void* malloc(size_t sz) +{ + // If malloc is called for the first time then allocate huge page +// if (notrun == 0) { +// INITREGULARALLOC(); +// notrun = 1; +// } + sz = __builtin_align_up(sz, _Alignof(max_align_t)); -// // printf("%d \n", sz); -// // printf("%d Malloc counter\n", MallocCounter); + // printf("%d \n", sz); + // printf("%d Malloc counter\n", MallocCounter); -// MallocCounter -= sz; -// void *ptrLink = &ptr[MallocCounter]; -// ptrLink = cheri_setbounds(ptrLink, sz); + MallocCounter -= sz; + void *ptrLink = &ptr[MallocCounter]; + ptrLink = cheri_setbounds(ptrLink, sz); -// return ptrLink; + return ptrLink; -// // if (heap + sz > heap_start + HEAP_SIZE) return NULL; -// // heap += sz; -// // return heap - sz; +// if (heap + sz > heap_start + HEAP_SIZE) return NULL; +// heap += sz; +// return heap - sz; -// } +} -// // Quick cheri free implementation +// Quick cheri free implementation // void free(void *ptr) { // // printf("free called \n");