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

ruby-changes:52477

From: k0kubun <ko1@a...>
Date: Tue, 11 Sep 2018 23:38:15 +0900 (JST)
Subject: [ruby-changes:52477] k0kubun:r64686 (trunk): mjit_worker.c: atomically print main message and \n

k0kubun	2018-09-11 23:38:05 +0900 (Tue, 11 Sep 2018)

  New Revision: 64686

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

  Log:
    mjit_worker.c: atomically print main message and \n
    
    To attempt to fix CI failure on rubyci freebsd:
    https://rubyci.org/logs/rubyci.s3.amazonaws.com/freebsd11zfs/ruby-trunk/log/20180911T123001Z.fail.html.gz
    
    ```
    JIT success (68.7ms): mjit9@(eval):1 -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u9.c
    JIT compaction (25.1ms): Compacted 10 methods -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u10.soToo many JIT code -- 1 units unloaded
    
    JIT success (68.2ms): mjit10@(eval):1 -> /usr/home/hsbt/chkbuild/tmp/build/20180911T123001Z/tmp/jit_test_unload_units_20180911-96427-13cagj9/_ruby_mjit_p99188u11.c
    ```

  Modified files:
    trunk/mjit_worker.c
Index: mjit_worker.c
===================================================================
--- mjit_worker.c	(revision 64685)
+++ mjit_worker.c	(revision 64686)
@@ -290,11 +290,17 @@ verbose(int level, const char *format, . https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L290
 {
     if (mjit_opts.verbose >= level) {
         va_list args;
+        size_t len = strlen(format);
+        char *full_format = alloca(sizeof(char) * (len + 2));
+
+        /* Creating `format + '\n'` to atomically print format and '\n'. */
+        memcpy(full_format, format, len);
+        full_format[len] = '\n';
+        full_format[len+1] = '\0';
 
         va_start(args, format);
-        vfprintf(stderr, format, args);
+        vfprintf(stderr, full_format, args);
         va_end(args);
-        fprintf(stderr, "\n");
     }
 }
 

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

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