ruby-changes:50593
From: k0kubun <ko1@a...>
Date: Tue, 13 Mar 2018 21:30:03 +0900 (JST)
Subject: [ruby-changes:50593] k0kubun:r62741 (trunk): mjit_compile.c: disable comment_id by default
k0kubun 2018-03-13 21:29:55 +0900 (Tue, 13 Mar 2018) New Revision: 62741 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62741 Log: mjit_compile.c: disable comment_id by default Doing `rb_ary_aref` to `global_symbols.ids` is not thread-safe and randomly causes SEGV. https://gist.github.com/k0kubun/ab60727c6be7c0e777d2b4241f59173c But it's convenient for development. So I keep it optionally available. Modified files: trunk/mjit_compile.c Index: mjit_compile.c =================================================================== --- mjit_compile.c (revision 62740) +++ mjit_compile.c (revision 62741) @@ -78,9 +78,13 @@ compile_case_dispatch_each(VALUE key, VA https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L78 return ST_CONTINUE; } +#define MJIT_COMMENT_ID 0 + +/* Calling rb_id2str in MJIT worker causes random SEGV. So this is disabled by default. */ static void comment_id(FILE *f, ID id) { +#ifdef MJIT_COMMENT_ID VALUE name = rb_id2str(id); const char *p, *e; char c, prev = '\0'; @@ -98,6 +102,7 @@ comment_id(FILE *f, ID id) https://github.com/ruby/ruby/blob/trunk/mjit_compile.c#L102 prev = c; } fputs("\" */", f); +#endif } static void compile_insns(FILE *f, const struct rb_iseq_constant_body *body, unsigned int stack_size, -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/