Skip to content

Commit

Permalink
don't use thread_local for time_for_collection on Mac - fix arena.h/a…
Browse files Browse the repository at this point in the history
…rena.cpp
  • Loading branch information
stevenmeker committed Nov 4, 2024
1 parent e4e34ff commit f96eb8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/runtime/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ using memory_block_header = struct {
#define MEM_BLOCK_START(ptr) \
((char *)(((uintptr_t)(ptr)-1) & ~(BLOCK_SIZE - 1)))

#ifdef __MACH__
//
// thread_local disabled for Apple
//
extern bool time_for_collection;
#else
extern thread_local bool time_for_collection;
#endif

size_t get_gc_threshold();

Expand Down
7 changes: 7 additions & 0 deletions runtime/alloc/arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ void free_all_memory() {
munmap(hyperblock_ptr, HYPERBLOCK_SIZE);
}

#ifdef __MACH__
//
// thread_local disabled for Apple
//
bool time_for_collection;
#else
thread_local bool time_for_collection;
#endif

static void fresh_block(struct arena *arena) {
char *next_block = nullptr;
Expand Down

0 comments on commit f96eb8f

Please sign in to comment.