diff options
| author | Jun Aruga <jaruga@redhat.com> | 2025-09-04 18:59:42 +0100 |
|---|---|---|
| committer | Jun Aruga <junaruga@users.noreply.github.com> | 2025-09-16 11:37:26 +0100 |
| commit | 971174054a26be0a4becbe7c67a7cc980158abf2 (patch) | |
| tree | 41ee6cf7f3f32cce1de99f967dba24f2467e50c4 /thread_pthread.h | |
| parent | 1213adfe5526d65cce81a9fb127074130c8faea7 (diff) | |
Add a macro to manage the condition of no-inline version rb_current_ec
Add the macro `RB_THREAD_CURRENT_EC_NOINLINE` to manage the condition to use
no-inline version rb_current_ec for a better maintainability.
Note that the `vm_core.h` includes the `THREAD_IMPL_H` by the
`#include THREAD_IMPL_H`. The `THREAD_IMPL_H` can be `thread_none.h`,
`thread_pthread.h` or `thread_win32.h` according to the
`tool/m4/ruby_thread.m4` creating the `THREAD_IMPL_H`.
The change in this commit only defining the `RB_THREAD_CURRENT_EC_NOINLINE` in
the `thread_pthread.h` is okay in this situation. Because in the
`thread_none.h` case, the thread feature is not used at all, including
Thread-Local Storage (TLS), and in the `thread_win32.h` case, the
`RB_THREAD_LOCAL_SPECIFIER` is not defined. In the `thread_pthread.h` case, the
`RB_THREAD_LOCAL_SPECIFIER` is defined in the `configure.ac`. In the
`thread_none.h` case, the `RB_THREAD_LOCAL_SPECIFIER` is defined in the
`thread_none.h`.
Diffstat (limited to 'thread_pthread.h')
| -rw-r--r-- | thread_pthread.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/thread_pthread.h b/thread_pthread.h index 20a3876759..d635948c4b 100644 --- a/thread_pthread.h +++ b/thread_pthread.h @@ -17,6 +17,11 @@ #define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER #define RB_NATIVETHREAD_COND_INIT PTHREAD_COND_INITIALIZER +// TLS can not be accessed across .so on arm64 and perhaps ppc64le too. +#if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__) +# define RB_THREAD_CURRENT_EC_NOINLINE +#endif + // this data should be protected by timer_th.waiting_lock struct rb_thread_sched_waiting { enum thread_sched_waiting_flag { @@ -133,8 +138,7 @@ struct rb_thread_sched { #ifdef RB_THREAD_LOCAL_SPECIFIER NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *)); - # if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__) - // TLS can not be accessed across .so on arm64 and perhaps ppc64le too. + # ifdef RB_THREAD_CURRENT_EC_NOINLINE NOINLINE(struct rb_execution_context_struct *rb_current_ec(void)); # else RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec; |
