diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2020-10-27 14:10:39 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2020-10-28 08:41:39 -0700 |
commit | 0bbbb5a6578fc3c6ebfb2150a0fffe96880ae515 (patch) | |
tree | bc97a908a4ec21b44b68c49918be55c7a85894c1 /object.c | |
parent | fb3c711df34ef9ded92e2716da842fbe7003e92a (diff) | |
download | ruby-0bbbb5a6578fc3c6ebfb2150a0fffe96880ae515.tar.gz |
`dest` is always embedded so we can remove this check
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -36,6 +36,7 @@ #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) 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; |