From 531bae84e50c49e37c00961d992ba9724eea4500 Mon Sep 17 00:00:00 2001 From: Steven Eker Date: Tue, 10 Dec 2024 03:25:15 +0100 Subject: [PATCH] arena_start_ptr() -> start_ptr(); arena_end_ptr() -> end_ptr() --- include/runtime/arena.h | 6 +++--- runtime/collect/collect.cpp | 12 ++++++------ runtime/lto/alloc.cpp | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/runtime/arena.h b/include/runtime/arena.h index 4bb5ac315..3d3e7dcf4 100644 --- a/include/runtime/arena.h +++ b/include/runtime/arena.h @@ -30,12 +30,12 @@ class arena { // Returns the address of the first byte that belongs in the given arena. // Returns nullptr if nothing has been allocated ever in that arena. - char *arena_start_ptr() const { return current_addr_ptr; } + char *start_ptr() const { return current_addr_ptr; } // Returns a pointer to a location holding the address of last allocated // byte in the given arena plus 1. // This address is nullptr if nothing has been allocated ever in that arena. - char *arena_end_ptr() { return allocation_ptr; } + char *end_ptr() { return allocation_ptr; } // Clears the current allocation space by setting its start back to its first // block. It is used during garbage collection to effectively collect all of the @@ -173,7 +173,7 @@ inline void arena::arena_clear() { // // We set the allocation pointer to the first available address. // - allocation_ptr = arena_start_ptr(); + allocation_ptr = current_addr_ptr; // // If the number of blocks we've touched is >= threshold, we want to trigger // a garbage collection if we get within 1 block of the end of this area. diff --git a/runtime/collect/collect.cpp b/runtime/collect/collect.cpp index 25a580ccb..c357fa0b1 100644 --- a/runtime/collect/collect.cpp +++ b/runtime/collect/collect.cpp @@ -255,7 +255,7 @@ char *arena::evacuate(char *scan_ptr) { migrate_child(curr_block, layout_data->args, i, false); } } - return move_ptr(scan_ptr, get_size(hdr, layout_int), arena_end_ptr()); + return move_ptr(scan_ptr, get_size(hdr, layout_int), end_ptr()); } // Contains the decision logic for collecting the old generation. @@ -293,7 +293,7 @@ void kore_collect( if (!last_alloc_ptr) { last_alloc_ptr = youngspace_ptr(); } - char *current_alloc_ptr = youngspace.arena_end_ptr(); + char *current_alloc_ptr = youngspace.end_ptr(); #endif kore_alloc_swap(collect_old); #ifdef GC_DBG @@ -301,13 +301,13 @@ void kore_collect( numBytesLiveAtCollection[i] = 0; } #endif - char *previous_oldspace_alloc_ptr = oldspace.arena_end_ptr(); + char *previous_oldspace_alloc_ptr = oldspace.end_ptr(); for (int i = 0; i < nroots; i++) { migrate_root(roots, type_info, i); } migrate_static_roots(); char *scan_ptr = youngspace_ptr(); - if (scan_ptr != youngspace.arena_end_ptr()) { + if (scan_ptr != youngspace.end_ptr()) { MEM_LOG("Evacuating young generation\n"); while (scan_ptr) { scan_ptr = youngspace.evacuate(scan_ptr); @@ -318,7 +318,7 @@ void kore_collect( } else { scan_ptr = previous_oldspace_alloc_ptr; } - if (scan_ptr != oldspace.arena_end_ptr()) { + if (scan_ptr != oldspace.end_ptr()) { MEM_LOG("Evacuating old generation\n"); while (scan_ptr) { scan_ptr = oldspace.evacuate(scan_ptr); @@ -329,7 +329,7 @@ void kore_collect( = arena::ptr_diff(current_alloc_ptr, last_alloc_ptr); assert(numBytesAllocedSinceLastCollection >= 0); fwrite(&numBytesAllocedSinceLastCollection, sizeof(ssize_t), 1, stderr); - last_alloc_ptr = youngspace.arena_end_ptr(); + last_alloc_ptr = youngspace.end_ptr(); fwrite( numBytesLiveAtCollection, sizeof(numBytesLiveAtCollection[0]), sizeof(numBytesLiveAtCollection) / sizeof(numBytesLiveAtCollection[0]), diff --git a/runtime/lto/alloc.cpp b/runtime/lto/alloc.cpp index aaafc932d..3d7f0663a 100644 --- a/runtime/lto/alloc.cpp +++ b/runtime/lto/alloc.cpp @@ -16,11 +16,11 @@ REGISTER_ARENA(oldspace, OLDSPACE_ID); REGISTER_ARENA(alwaysgcspace, ALWAYSGCSPACE_ID); char *youngspace_ptr() { - return youngspace.arena_start_ptr(); + return youngspace.start_ptr(); } char *oldspace_ptr() { - return oldspace.arena_start_ptr(); + return oldspace.start_ptr(); } char youngspace_collection_id() { @@ -73,7 +73,7 @@ kore_resize_last_alloc(void *oldptr, size_t newrequest, size_t last_size) { newrequest = (newrequest + 7) & ~7; last_size = (last_size + 7) & ~7; - if (oldptr != youngspace.arena_end_ptr() - last_size) { + if (oldptr != youngspace.end_ptr() - last_size) { MEM_LOG( "May only reallocate last allocation. Tried to reallocate %p to %zd\n", oldptr, newrequest);