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

ruby-changes:55892

From: Takashi <ko1@a...>
Date: Wed, 29 May 2019 08:58:40 +0900 (JST)
Subject: [ruby-changes:55892] Takashi Kokubun: 797d7efde1 (trunk): Prevent MJIT compilation from running while moving

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

From 797d7efde18c5f7acf5264047842fd974f383ca9 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 29 May 2019 08:56:26 +0900
Subject: Prevent MJIT compilation from running while moving

pointers.

Instead of 4fe908c1643c3f355edd787bb651aefb53b996c0, just locking the MJIT
worker may be fine for this case. And also we might have the same issue
in all `gc_compact_after_gc` calls.

diff --git a/gc.c b/gc.c
index cd784ef..6f518b7 100644
--- a/gc.c
+++ b/gc.c
@@ -8272,6 +8272,8 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8272
 {
     if (0) fprintf(stderr, "gc_compact_after_gc: %d,%d,%d\n", use_toward_empty, use_double_pages, use_verifier);
 
+    mjit_gc_start_hook(); // prevent MJIT from running while moving pointers related to ISeq
+
     if (use_verifier) {
         gc_verify_internal_consistency(Qnil);
     }
@@ -8315,6 +8317,8 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8317
     (void)moved_list;
 #endif
 
+    mjit_gc_exit_hook(); // unlock MJIT here, because `rb_gc()` calls `mjit_gc_start_hook()` again.
+
     /* GC after compaction to eliminate T_MOVED */
     rb_gc();
 }
-- 
cgit v0.10.2


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

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