1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-09-11 14:38:05 +00:00
parent 6e3fe890d5
commit 9f6e9b40d3

View file

@ -290,11 +290,17 @@ verbose(int level, const char *format, ...)
{ {
if (mjit_opts.verbose >= level) { if (mjit_opts.verbose >= level) {
va_list args; 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); va_start(args, format);
vfprintf(stderr, format, args); vfprintf(stderr, full_format, args);
va_end(args); va_end(args);
fprintf(stderr, "\n");
} }
} }