ruby-changes:63462
From: Aaron <ko1@a...>
Date: Thu, 29 Oct 2020 00:42:06 +0900 (JST)
Subject: [ruby-changes:63462] 0bbbb5a657 (master): `dest` is always embedded so we can remove this check
https://git.ruby-lang.org/ruby.git/commit/?id=0bbbb5a657 From 0bbbb5a6578fc3c6ebfb2150a0fffe96880ae515 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 27 Oct 2020 14:10:39 -0700 Subject: `dest` is always embedded so we can remove this check diff --git a/object.c b/object.c index 572bfd5..3bc6725 100644 --- a/object.c +++ b/object.c @@ -36,6 +36,7 @@ https://github.com/ruby/ruby/blob/trunk/object.c#L36 #include "ruby/encoding.h" #include "ruby/st.h" #include "ruby/util.h" +#include "ruby/assert.h" #include "builtin.h" /*! @@ -324,12 +325,8 @@ rb_obj_singleton_class(VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L325 MJIT_FUNC_EXPORTED void rb_obj_copy_ivar(VALUE dest, VALUE obj) { - if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_IVPTR(dest)) { - xfree(ROBJECT_IVPTR(dest)); - ROBJECT(dest)->as.heap.ivptr = 0; - ROBJECT(dest)->as.heap.numiv = 0; - ROBJECT(dest)->as.heap.iv_index_tbl = 0; - } + RUBY_ASSERT(RBASIC(dest)->flags & ROBJECT_EMBED); + if (RBASIC(obj)->flags & ROBJECT_EMBED) { MEMCPY(ROBJECT(dest)->as.ary, ROBJECT(obj)->as.ary, VALUE, ROBJECT_EMBED_LEN_MAX); RBASIC(dest)->flags |= ROBJECT_EMBED; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/