[前][次][番号順一覧][スレッド一覧]

ruby-changes:71929

From: Koichi <ko1@a...>
Date: Tue, 24 May 2022 02:23:04 +0900 (JST)
Subject: [ruby-changes:71929] 37ccf91bfb (master): cleanup by `RUBY_DEBUG_LOG2` and `VM_ASSERT`

https://git.ruby-lang.org/ruby.git/commit/?id=37ccf91bfb

From 37ccf91bfb73a225cc60413645788ea55e5e852a Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Tue, 24 May 2022 01:44:17 +0900
Subject: cleanup by `RUBY_DEBUG_LOG2` and `VM_ASSERT`

---
 ractor_core.h | 17 +++++------------
 1 file 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) https://github.com/ruby/ruby/blob/trunk/ractor_core.h#L256
     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) https://github.com/ruby/ruby/blob/trunk/ractor_core.h#L270
 #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;
 }
 
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]