Skip to content

Commit

Permalink
Applying changes from refactoring before adding MMTk
Browse files Browse the repository at this point in the history
  • Loading branch information
udesou committed Sep 25, 2024
1 parent c26632e commit c283442
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/gc-stock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -699,4 +714,5 @@ void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect

#endif


#endif // !MMTK_GC
2 changes: 1 addition & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/stackwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c283442

Please sign in to comment.