Skip to content

Commit

Permalink
deleted MEM_BLOCK_START; removed corner case from collector
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenmeker committed Nov 28, 2024
1 parent 9a0d44b commit f89f156
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
3 changes: 0 additions & 3 deletions include/runtime/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 1 addition & 16 deletions runtime/collect/collect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit f89f156

Please sign in to comment.