From c283442edf340d882b13c9ec887a6d9bd44b2527 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Wed, 25 Sep 2024 01:24:44 +0000 Subject: [PATCH] Applying changes from refactoring before adding MMTk --- src/gc-stock.h | 16 ++++++++++++++++ src/julia.h | 2 +- src/julia_internal.h | 2 +- src/stackwalk.c | 2 -- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/gc-stock.h b/src/gc-stock.h index 8e563f32ab9d3..6f75dcd014176 100644 --- a/src/gc-stock.h +++ b/src/gc-stock.h @@ -423,6 +423,21 @@ STATIC_INLINE int gc_ith_parallel_collector_thread_id(int i) JL_NOTSAFEPOINT return gc_first_tid + i; } +STATIC_INLINE int gc_is_parallel_collector_thread(int tid) JL_NOTSAFEPOINT +{ + return tid >= gc_first_tid && tid <= gc_last_parallel_collector_thread_id(); +} + +STATIC_INLINE int gc_is_concurrent_collector_thread(int tid) JL_NOTSAFEPOINT +{ + if (jl_n_sweepthreads == 0) { + return 0; + } + int last_parallel_collector_thread_id = gc_last_parallel_collector_thread_id(); + int concurrent_collector_thread_id = last_parallel_collector_thread_id + 1; + return tid == concurrent_collector_thread_id; +} + STATIC_INLINE int gc_random_parallel_collector_thread_id(jl_ptls_t ptls) JL_NOTSAFEPOINT { assert(jl_n_markthreads > 0); @@ -699,4 +714,5 @@ void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect #endif + #endif // !MMTK_GC diff --git a/src/julia.h b/src/julia.h index db57db1fbeb38..abb8a57ff13b0 100644 --- a/src/julia.h +++ b/src/julia.h @@ -850,7 +850,7 @@ static inline jl_value_t *jl_to_typeof(uintptr_t t) return (jl_value_t*)t; } #else -extern JL_DLLEXPORT jl_datatype_t *ijl_small_typeof[(jl_max_tags << 4) / sizeof(jl_datatype_t*)]; +extern JL_HIDDEN jl_datatype_t *ijl_small_typeof[(jl_max_tags << 4) / sizeof(jl_datatype_t*)]; static inline jl_value_t *jl_to_typeof(uintptr_t t) { if (t < (jl_max_tags << 4)) diff --git a/src/julia_internal.h b/src/julia_internal.h index d5013601a9124..e677f40907dfd 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -1052,7 +1052,7 @@ STATIC_INLINE int jl_addr_is_safepoint(uintptr_t addr) return addr >= safepoint_addr && addr < safepoint_addr + jl_page_size * 4; } extern _Atomic(uint32_t) jl_gc_running; -extern JL_DLLEXPORT _Atomic(uint32_t) jl_gc_disable_counter; +extern _Atomic(uint32_t) jl_gc_disable_counter; // All the functions are safe to be called from within a signal handler // provided that the thread will not be interrupted by another asynchronous // signal. diff --git a/src/stackwalk.c b/src/stackwalk.c index e6fc2c7bbf56a..a1de3a6d61a07 100644 --- a/src/stackwalk.c +++ b/src/stackwalk.c @@ -1294,8 +1294,6 @@ JL_DLLEXPORT void jl_print_backtrace(void) JL_NOTSAFEPOINT } extern int gc_first_tid; -extern int gc_is_parallel_collector_thread(int tid) JL_NOTSAFEPOINT; -extern int gc_is_concurrent_collector_thread(int tid) JL_NOTSAFEPOINT; // Print backtraces for all live tasks, for all threads, to jl_safe_printf stderr JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT