ruby-changes:29478
From: ko1 <ko1@a...>
Date: Fri, 21 Jun 2013 19:15:32 +0900 (JST)
Subject: [ruby-changes:29478] ko1:r41530 (trunk): * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
ko1 2013-06-21 19:14:04 +0900 (Fri, 21 Jun 2013) New Revision: 41530 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41530 Log: * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP. Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h trunk/re.c Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 41529) +++ include/ruby/ruby.h (revision 41530) @@ -715,6 +715,9 @@ VALUE rb_obj_setup(VALUE obj, VALUE klas https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L715 #ifndef RGENGC_WB_PROTECTED_OBJECT #define RGENGC_WB_PROTECTED_OBJECT 1 #endif +#ifndef RGENGC_WB_PROTECTED_REGEXP +#define RGENGC_WB_PROTECTED_REGEXP 1 +#endif #ifndef RGENGC_WB_PROTECTED_CLASS #define RGENGC_WB_PROTECTED_CLASS 1 #endif @@ -971,7 +974,7 @@ struct RArray { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L974 struct RRegexp { struct RBasic basic; struct re_pattern_buffer *ptr; - VALUE src; + const VALUE src; unsigned long usecnt; }; #define RREGEXP_SRC(r) RREGEXP(r)->src Index: ChangeLog =================================================================== --- ChangeLog (revision 41529) +++ ChangeLog (revision 41530) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@a...> + + * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP. + Fri Jun 21 18:56:58 2013 Tanaka Akira <akr@f...> * bignum.c (bigsub_int): Use bdigit_roomof. Index: re.c =================================================================== --- re.c (revision 41529) +++ re.c (revision 41530) @@ -2438,7 +2438,7 @@ rb_reg_initialize(VALUE obj, const char https://github.com/ruby/ruby/blob/trunk/re.c#L2438 options & ARG_REG_OPTION_MASK, err, sourcefile, sourceline); if (!re->ptr) return -1; - re->src = rb_enc_str_new(s, len, enc); + OBJ_WRITE(obj, (VALUE *)&re->src, rb_enc_str_new(s, len, enc)); OBJ_FREEZE(re->src); RB_GC_GUARD(unescaped); return 0; @@ -2470,10 +2470,10 @@ rb_reg_initialize_str(VALUE obj, VALUE s https://github.com/ruby/ruby/blob/trunk/re.c#L2470 static VALUE rb_reg_s_alloc(VALUE klass) { - NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP); + NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP | (RGENGC_WB_PROTECTED_REGEXP ? FL_WB_PROTECTED : 0)); re->ptr = 0; - re->src = 0; + OBJ_WRITE(re, (VALUE *)&re->src, 0); re->usecnt = 0; return (VALUE)re; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/