ruby-changes:62943
From: Koichi <ko1@a...>
Date: Tue, 15 Sep 2020 00:05:29 +0900 (JST)
Subject: [ruby-changes:62943] 74ddac1c82 (master): relax dependency
https://git.ruby-lang.org/ruby.git/commit/?id=74ddac1c82 From 74ddac1c822697b442646f433d60e2c099db3c3b Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Fri, 11 Sep 2020 18:30:27 +0900 Subject: relax dependency vm_sync.h does not need to include vm_core.h and ractor_pub.h. diff --git a/vm_core.h b/vm_core.h index 1d86961..88dc905 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1838,6 +1838,10 @@ void rb_fiber_close(rb_fiber_t *fib); https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1838 void Init_native_thread(rb_thread_t *th); int rb_vm_check_ints_blocking(rb_execution_context_t *ec); +// vm_sync.h +void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond); +void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec); + #define RUBY_VM_CHECK_INTS(ec) rb_vm_check_ints(ec) static inline void rb_vm_check_ints(rb_execution_context_t *ec) diff --git a/vm_sync.c b/vm_sync.c index d5b25e5..e3d0ffe 100644 --- a/vm_sync.c +++ b/vm_sync.c @@ -12,7 +12,7 @@ vm_locked(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm_sync.c#L12 return vm->ractor.sync.lock_owner == GET_RACTOR(); } -#if VM_CHECK_MODE > 0 +#if RUBY_DEBUG > 0 void ASSERT_vm_locking(void) { @@ -21,9 +21,7 @@ ASSERT_vm_locking(void) https://github.com/ruby/ruby/blob/trunk/vm_sync.c#L21 VM_ASSERT(vm_locked(vm)); } } -#endif -#if VM_CHECK_MODE > 0 void ASSERT_vm_unlocking(void) { diff --git a/vm_sync.h b/vm_sync.h index f601143..2e174bf 100644 --- a/vm_sync.h +++ b/vm_sync.h @@ -2,9 +2,8 @@ https://github.com/ruby/ruby/blob/trunk/vm_sync.h#L2 #ifndef RUBY_VM_SYNC_H #define RUBY_VM_SYNC_H -#include "vm_core.h" #include "vm_debug.h" -#include "ractor_pub.h" +RUBY_EXTERN bool ruby_multi_ractor; #if USE_RUBY_DEBUG_LOG #define LOCATION_ARGS const char *file, int line @@ -24,15 +23,18 @@ void rb_vm_unlock_body(LOCATION_ARGS); https://github.com/ruby/ruby/blob/trunk/vm_sync.h#L23 void rb_vm_lock_enter_body(unsigned int *lev APPEND_LOCATION_ARGS); void rb_vm_lock_leave_body(unsigned int *lev APPEND_LOCATION_ARGS); void rb_vm_barrier(void); -void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond); -void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec); + +#if RUBY_DEBUG +// GET_VM() +#include "vm_core.h" +#endif static inline bool rb_multi_ractor_p(void) { if (LIKELY(!ruby_multi_ractor)) { // 0 on boot time. - VM_ASSERT(GET_VM()->ractor.cnt <= 1); + RUBY_ASSERT(GET_VM()->ractor.cnt <= 1); return false; } else { @@ -84,7 +86,7 @@ rb_vm_lock_leave(unsigned int *lev, const char *file, int line) https://github.com/ruby/ruby/blob/trunk/vm_sync.h#L86 #define RB_VM_LOCK_ENTER() { unsigned int _lev; RB_VM_LOCK_ENTER_LEV(&_lev); #define RB_VM_LOCK_LEAVE() RB_VM_LOCK_LEAVE_LEV(&_lev); } -#if VM_CHECK_MODE > 0 +#if RUBY_DEBUG > 0 void ASSERT_vm_locking(void); void ASSERT_vm_unlocking(void); #else -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/