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

ruby-changes:52038

From: k0kubun <ko1@a...>
Date: Thu, 9 Aug 2018 20:39:13 +0900 (JST)
Subject: [ruby-changes:52038] k0kubun:r64254 (trunk): process.c: don't wait JIT queue flush on rb_f_exec

k0kubun	2018-08-09 20:39:07 +0900 (Thu, 09 Aug 2018)

  New Revision: 64254

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

  Log:
    process.c: don't wait JIT queue flush on rb_f_exec
    
    This wasn't intended in r64253.

  Modified files:
    trunk/internal.h
    trunk/mjit.c
    trunk/process.c
    trunk/vm.c
Index: mjit.c
===================================================================
--- mjit.c	(revision 64253)
+++ mjit.c	(revision 64254)
@@ -1782,19 +1782,8 @@ stop_worker(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1782
 
 /* Stop JIT-compiling methods but compiled code is kept available. */
 VALUE
-mjit_pause(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
+mjit_pause(int wait_p)
 {
-    VALUE options = Qnil;
-    VALUE wait = Qtrue;
-    rb_scan_args(argc, argv, "0:", &options);
-
-    if (!NIL_P(options)) {
-        static ID keyword_ids[1];
-        if (!keyword_ids[0])
-            keyword_ids[0] = rb_intern("wait");
-        rb_get_kwargs(options, keyword_ids, 0, 1, &wait);
-    }
-
     if (!mjit_enabled) {
         rb_raise(rb_eRuntimeError, "MJIT is not enabled");
     }
@@ -1802,8 +1791,8 @@ mjit_pause(int argc, VALUE *argv, RB_UNU https://github.com/ruby/ruby/blob/trunk/mjit.c#L1791
         return Qfalse;
     }
 
-    /* Flush all queued units with `wait: true` (default) */
-    if (RTEST(wait)) {
+    /* Flush all queued units with no option or `wait: true` */
+    if (wait_p) {
         struct timeval tv;
         tv.tv_sec = 0;
         tv.tv_usec = 1000;
Index: process.c
===================================================================
--- process.c	(revision 64253)
+++ process.c	(revision 64254)
@@ -2883,7 +2883,7 @@ rb_f_exec(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L2883
 
     execarg_obj = rb_execarg_new(argc, argv, TRUE, FALSE);
     eargp = rb_execarg_get(execarg_obj);
-    if (mjit_enabled) mjit_pause(0, NULL, Qnil); /* do not leak children */
+    if (mjit_enabled) mjit_pause(FALSE); /* do not leak children */
     before_exec(); /* stop timer thread before redirects */
     rb_execarg_parent_start(execarg_obj);
     fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
Index: internal.h
===================================================================
--- internal.h	(revision 64253)
+++ internal.h	(revision 64254)
@@ -1401,7 +1401,7 @@ VALUE rb_math_sqrt(VALUE); https://github.com/ruby/ruby/blob/trunk/internal.h#L1401
 
 /* mjit.c */
 extern int mjit_enabled;
-VALUE mjit_pause(int argc, VALUE *argv, VALUE recv);
+VALUE mjit_pause(int wait_p);
 VALUE mjit_resume(void);
 
 /* newline.c */
Index: vm.c
===================================================================
--- vm.c	(revision 64253)
+++ vm.c	(revision 64254)
@@ -2770,6 +2770,23 @@ mjit_enabled_p(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L2770
     return mjit_enabled ? Qtrue : Qfalse;
 }
 
+static VALUE
+mjit_pause_m(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
+{
+    VALUE options = Qnil;
+    VALUE wait = Qtrue;
+    rb_scan_args(argc, argv, "0:", &options);
+
+    if (!NIL_P(options)) {
+        static ID keyword_ids[1];
+        if (!keyword_ids[0])
+            keyword_ids[0] = rb_intern("wait");
+        rb_get_kwargs(options, keyword_ids, 0, 1, &wait);
+    }
+
+    return mjit_pause(RTEST(wait));
+}
+
 extern VALUE *rb_gc_stack_start;
 extern size_t rb_gc_stack_maxsize;
 #ifdef __ia64
@@ -2858,7 +2875,7 @@ Init_VM(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L2875
     /* RubyVM::MJIT */
     mjit = rb_define_module_under(rb_cRubyVM, "MJIT");
     rb_define_singleton_method(mjit, "enabled?", mjit_enabled_p, 0);
-    rb_define_singleton_method(mjit, "pause", mjit_pause, -1);
+    rb_define_singleton_method(mjit, "pause", mjit_pause_m, -1);
     rb_define_singleton_method(mjit, "resume", mjit_resume, 0);
 
     /*

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

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