diff options
author | Koichi Sasada <ko1@atdot.net> | 2022-05-24 01:44:17 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2022-05-24 02:22:41 +0900 |
commit | 37ccf91bfb73a225cc60413645788ea55e5e852a (patch) | |
tree | 9fa9c6478d8345f20b00aba455d7b3125827fe5b /ractor_core.h | |
parent | d270d984bdf924f6b70dbb58f96c107b2154dbc1 (diff) |
cleanup by `RUBY_DEBUG_LOG2` and `VM_ASSERT`
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5931
Diffstat (limited to 'ractor_core.h')
-rw-r--r-- | ractor_core.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/ractor_core.h b/ractor_core.h index 8f0037b3ee..dd1b73b331 100644 --- a/ractor_core.h +++ b/ractor_core.h @@ -256,8 +256,10 @@ rb_ractor_thread_switch(rb_ractor_t *cr, rb_thread_t *th) VM_ASSERT(cr == GET_RACTOR()); } +#define rb_ractor_set_current_ec(cr, ec) rb_ractor_set_current_ec_(cr, ec, __FILE__, __LINE__) + static inline void -rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec) +rb_ractor_set_current_ec_(rb_ractor_t *cr, rb_execution_context_t *ec, const char *file, int line) { #ifdef RB_THREAD_LOCAL_SPECIFIER #ifdef __APPLE__ @@ -268,17 +270,8 @@ rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec) #else native_tls_set(ruby_current_ec_key, ec); #endif - - if (cr->threads.running_ec != ec) { - if (0) { - ruby_debug_printf("rb_ractor_set_current_ec ec:%p->%p\n", - (void *)cr->threads.running_ec, (void *)ec); - } - } - else { - VM_ASSERT(0); // should be different - } - + RUBY_DEBUG_LOG2(file, line, "ec:%p->%p", cr->threads.running_ec, ec); + VM_ASSERT(cr->threads.running_ec != ec); cr->threads.running_ec = ec; } |