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

ruby-changes:55415

From: tenderlove <ko1@a...>
Date: Sat, 20 Apr 2019 11:40:45 +0900 (JST)
Subject: [ruby-changes:55415] tenderlove:r67624 (trunk): Update MJIT references

tenderlove	2019-04-20 11:40:41 +0900 (Sat, 20 Apr 2019)

  New Revision: 67624

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67624

  Log:
    Update MJIT references
    
    ISeq can move, so we need to tell MJIT where the new location is.

  Modified files:
    trunk/iseq.c
    trunk/mjit.c
    trunk/mjit.h
Index: iseq.c
===================================================================
--- iseq.c	(revision 67623)
+++ iseq.c	(revision 67624)
@@ -262,6 +262,9 @@ rb_iseq_update_references(rb_iseq_t *ise https://github.com/ruby/ruby/blob/trunk/iseq.c#L262
                 }
             }
         }
+#if USE_MJIT
+        mjit_update_references(iseq);
+#endif
     }
 }
 
Index: mjit.c
===================================================================
--- mjit.c	(revision 67623)
+++ mjit.c	(revision 67624)
@@ -110,6 +110,19 @@ mjit_gc_finish_hook(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L110
     CRITICAL_SECTION_FINISH(4, "mjit_gc_finish_hook");
 }
 
+// Deal with ISeq movement from compactor
+void
+mjit_update_references(const rb_iseq_t *iseq)
+{
+    if (!mjit_enabled)
+        return;
+    CRITICAL_SECTION_START(4, "mjit_free_iseq");
+    if (iseq->body->jit_unit) {
+        iseq->body->jit_unit->iseq = (rb_iseq_t *)rb_gc_new_location(iseq->body->jit_unit->iseq);
+    }
+    CRITICAL_SECTION_FINISH(4, "mjit_free_iseq");
+}
+
 // Iseqs can be garbage collected.  This function should call when it
 // happens.  It removes iseq from the unit.
 void
Index: mjit.h
===================================================================
--- mjit.h	(revision 67623)
+++ mjit.h	(revision 67624)
@@ -84,6 +84,7 @@ extern void mjit_postponed_job_register_ https://github.com/ruby/ruby/blob/trunk/mjit.h#L84
 extern void mjit_gc_start_hook(void);
 extern void mjit_gc_finish_hook(void);
 extern void mjit_free_iseq(const rb_iseq_t *iseq);
+extern void mjit_update_references(const rb_iseq_t *iseq);
 extern void mjit_mark(void);
 extern struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec);
 extern void mjit_cont_free(struct mjit_cont *cont);

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

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