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

ruby-changes:63980

From: Koichi <ko1@a...>
Date: Mon, 7 Dec 2020 08:29:03 +0900 (JST)
Subject: [ruby-changes:63980] bef3eb5440 (master): fix decl of ruby_single_main_ractor

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

From bef3eb544025cc4bd4c9c7b87a8ffe4966db6faa Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Mon, 7 Dec 2020 00:07:30 +0900
Subject: fix decl of ruby_single_main_ractor

On windows, MJIT doesn't work without this patch because of
the declaration of ruby_single_main_ractor. This patch fix this
issue and move the definition of it from ractor.c to vm.c to locate
near place of ruby_current_vm_ptr.

diff --git a/ractor.c b/ractor.c
index 64e20b4..72e1e09 100644
--- a/ractor.c
+++ b/ractor.c
@@ -30,13 +30,6 @@ rb_ractor_error_class(void) https://github.com/ruby/ruby/blob/trunk/ractor.c#L30
     return rb_eRactorError;
 }
 
-RUBY_SYMBOL_EXPORT_BEGIN
-
-// to share with MJIT
-rb_ractor_t *ruby_single_main_ractor;
-
-RUBY_SYMBOL_EXPORT_END
-
 static void vm_ractor_blocking_cnt_inc(rb_vm_t *vm, rb_ractor_t *r, const char *file, int line);
 
 static void
diff --git a/vm.c b/vm.c
index bdca822..1e8056a 100644
--- a/vm.c
+++ b/vm.c
@@ -378,6 +378,7 @@ VALUE rb_block_param_proxy; https://github.com/ruby/ruby/blob/trunk/vm.c#L378
 #define ruby_vm_redefined_flag GET_VM()->redefined_flag
 VALUE ruby_vm_const_missing_count = 0;
 rb_vm_t *ruby_current_vm_ptr = NULL;
+rb_ractor_t *ruby_single_main_ractor;
 
 #ifdef RB_THREAD_LOCAL_SPECIFIER
 RB_THREAD_LOCAL_SPECIFIER rb_execution_context_t *ruby_current_ec;
diff --git a/vm_core.h b/vm_core.h
index 6b975ac..f451723 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1733,6 +1733,7 @@ rb_execution_context_t *rb_vm_main_ractor_ec(rb_vm_t *vm); // ractor.c https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1733
 #if RUBY_VM_THREAD_MODEL == 2
 RUBY_SYMBOL_EXPORT_BEGIN
 
+RUBY_EXTERN struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
 RUBY_EXTERN rb_vm_t *ruby_current_vm_ptr;
 RUBY_EXTERN rb_event_flag_t ruby_vm_event_flags;
 RUBY_EXTERN rb_event_flag_t ruby_vm_event_enabled_global_flags;
@@ -1799,8 +1800,6 @@ rb_current_thread(void) https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1800
     return rb_ec_thread_ptr(ec);
 }
 
-extern struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
-
 static inline rb_ractor_t *
 rb_current_ractor(void)
 {
diff --git a/vm_sync.h b/vm_sync.h
index 8244b61..14b63f3 100644
--- a/vm_sync.h
+++ b/vm_sync.h
@@ -31,7 +31,7 @@ void rb_vm_barrier(void); https://github.com/ruby/ruby/blob/trunk/vm_sync.h#L31
 #include "vm_core.h"
 #endif
 
-extern struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
+RUBY_EXTERN struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
 
 static inline bool
 rb_multi_ractor_p(void)
-- 
cgit v0.10.2


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

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