diff --git a/ractor.c b/ractor.c index 0a9033c5b6..bfc61f99fe 100644 --- a/ractor.c +++ b/ractor.c @@ -413,7 +413,7 @@ ractor_queue_enq(rb_ractor_t *r, struct rb_ractor_queue *rq, struct rb_ractor_ba rq->size *= 2; } rq->baskets[(rq->start + rq->cnt++) % rq->size] = *basket; - // fprintf(stderr, "%s %p->cnt:%d\n", __func__, (void *)rq, rq->cnt); + // fprintf(stderr, "%s %p->cnt:%d\n", RUBY_FUNCTION_NAME_STRING, (void *)rq, rq->cnt); } static void @@ -502,7 +502,7 @@ ractor_wakeup(rb_ractor_t *r, enum ractor_wait_status wait_status, enum ractor_w { ASSERT_ractor_locking(r); - // fprintf(stderr, "%s r:%p status:%s/%s wakeup_status:%s/%s\n", __func__, (void *)r, + // fprintf(stderr, "%s r:%p status:%s/%s wakeup_status:%s/%s\n", RUBY_FUNCTION_NAME_STRING, (void *)r, // wait_status_str(r->sync.wait.status), wait_status_str(wait_status), // wakeup_status_str(r->sync.wait.wakeup_status), wakeup_status_str(wakeup_status)); @@ -582,7 +582,7 @@ ractor_sleep(rb_execution_context_t *ec, rb_ractor_t *cr) { VM_ASSERT(GET_RACTOR() == cr); VM_ASSERT(cr->sync.wait.status != wait_none); - // fprintf(stderr, "%s r:%p status:%s, wakeup_status:%s\n", __func__, (void *)cr, + // fprintf(stderr, "%s r:%p status:%s, wakeup_status:%s\n", RUBY_FUNCTION_NAME_STRING, (void *)cr, // wait_status_str(cr->sync.wait.status), wakeup_status_str(cr->sync.wait.wakeup_status)); RACTOR_UNLOCK(cr); diff --git a/vm_debug.h b/vm_debug.h index a2647273a0..d8f4fcbe24 100644 --- a/vm_debug.h +++ b/vm_debug.h @@ -94,18 +94,20 @@ bool ruby_debug_log_filter(const char *func_name); // convenient macro to log even if the USE_RUBY_DEBUG_LOG macro is not specified. // You can use this macro for temporary usage (you should not commit it). -#define _RUBY_DEBUG_LOG(...) ruby_debug_log(__FILE__, __LINE__, __func__, "" __VA_ARGS__) +#define _RUBY_DEBUG_LOG(...) ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__) #if USE_RUBY_DEBUG_LOG +# define RUBY_DEBUG_LOG_ENABLED(func_name) \ + (ruby_debug_log_mode && ruby_debug_log_filter(func_name)) #define RUBY_DEBUG_LOG(...) do { \ - if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \ - ruby_debug_log(__FILE__, __LINE__, __func__, "" __VA_ARGS__); \ + if (RUBY_DEBUG_LOG_ENABLED(RUBY_FUNCTION_NAME_STRING)) \ + ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__); \ } while (0) #define RUBY_DEBUG_LOG2(file, line, ...) do { \ - if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \ - ruby_debug_log(file, line, __func__, "" __VA_ARGS__); \ + if (RUBY_DEBUG_LOG_ENABLED(RUBY_FUNCTION_NAME_STRING)) \ + ruby_debug_log(file, line, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__); \ } while (0) #else