[ruby/stringio] Update write-barrier at copying
http://ci.rvm.jp/results/trunk-asserts@ruby-sp2-docker/4552803 ``` verify_internal_consistency_reachable_i: WB miss (O->Y) 0x00007f752ddd5550 [3LM ] strio (StringIO)strio -> 0x00007f752d19b7d0 [0 ] T_STRING (String) len: 8, capa: 15 "to_strio" <internal:/tmp/ruby/src/trunk-asserts/lib/rubygems/core_ext/kernel_require.rb>:53: [BUG] gc_verify_internal_consistency: found internal inconsistency. ``` https://github.com/ruby/stringio/commit/2e8ab43cba
This commit is contained in:
parent
32cc6301b3
commit
409a13e9ea
@ -698,15 +698,19 @@ strio_eof(VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
strio_copy(VALUE copy, VALUE orig)
|
strio_copy(VALUE copy, VALUE orig)
|
||||||
{
|
{
|
||||||
struct StringIO *ptr;
|
struct StringIO *ptr, *old_ptr;
|
||||||
|
VALUE old_string = Qundef;
|
||||||
|
|
||||||
orig = rb_convert_type(orig, T_DATA, "StringIO", "to_strio");
|
orig = rb_convert_type(orig, T_DATA, "StringIO", "to_strio");
|
||||||
if (copy == orig) return copy;
|
if (copy == orig) return copy;
|
||||||
ptr = StringIO(orig);
|
ptr = StringIO(orig);
|
||||||
if (check_strio(copy)) {
|
old_ptr = check_strio(copy);
|
||||||
strio_free(DATA_PTR(copy));
|
if (old_ptr) {
|
||||||
|
old_string = old_ptr->string;
|
||||||
|
strio_free(old_ptr);
|
||||||
}
|
}
|
||||||
DATA_PTR(copy) = ptr;
|
DATA_PTR(copy) = ptr;
|
||||||
|
RB_OBJ_WRITTEN(copy, old_string, ptr->string);
|
||||||
RBASIC(copy)->flags &= ~STRIO_READWRITE;
|
RBASIC(copy)->flags &= ~STRIO_READWRITE;
|
||||||
RBASIC(copy)->flags |= RBASIC(orig)->flags & STRIO_READWRITE;
|
RBASIC(copy)->flags |= RBASIC(orig)->flags & STRIO_READWRITE;
|
||||||
++ptr->count;
|
++ptr->count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user