From a75b2853db82a86ddd82bab52d0db5bb17fdb7c7 Mon Sep 17 00:00:00 2001 From: Steven Eker Date: Thu, 28 Nov 2024 03:14:11 +0100 Subject: [PATCH] deleted MEM_BLOCK_START; removed corner case from collector --- include/runtime/arena.h | 3 --- runtime/collect/collect.cpp | 17 +---------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/runtime/arena.h b/include/runtime/arena.h index 464cc60f0..a9ef9fc75 100644 --- a/include/runtime/arena.h +++ b/include/runtime/arena.h @@ -150,9 +150,6 @@ class arena { // 127. #define REGISTER_ARENA(name, id) static thread_local arena name(id) -#define MEM_BLOCK_START(ptr) \ - ((char *)(((uintptr_t)(ptr)-1) & ~(BLOCK_SIZE - 1))) - #ifdef __MACH__ // // thread_local disabled for Apple diff --git a/runtime/collect/collect.cpp b/runtime/collect/collect.cpp index cc596d205..c439fdd0e 100644 --- a/runtime/collect/collect.cpp +++ b/runtime/collect/collect.cpp @@ -316,22 +316,7 @@ void kore_collect( if (collect_old || !previous_oldspace_alloc_ptr) { scan_ptr = oldspace_ptr(); } else { - if (MEM_BLOCK_START(previous_oldspace_alloc_ptr + 1) - == previous_oldspace_alloc_ptr) { - // this means that the previous oldspace allocation pointer points to an - // address that is megabyte-aligned. This can only happen if we have just - // filled up a block but have not yet allocated the next block in the - // sequence at the start of the collection cycle. This means that the - // allocation pointer is invalid and does not actually point to the next - // address that would have been allocated at, according to the logic of - // kore_arena_alloc, which will have allocated a fresh memory block and put - // the allocation at the start of it. Thus, we use arena::move_ptr with a size - // of zero to adjust and get the true address of the allocation. - scan_ptr - = arena::move_ptr(previous_oldspace_alloc_ptr, 0, *old_alloc_ptr()); - } else { - scan_ptr = previous_oldspace_alloc_ptr; - } + scan_ptr = previous_oldspace_alloc_ptr; } if (scan_ptr != *old_alloc_ptr()) { MEM_LOG("Evacuating old generation\n");