summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-10-27 14:10:39 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2020-10-28 08:41:39 -0700
commit0bbbb5a6578fc3c6ebfb2150a0fffe96880ae515 (patch)
treebc97a908a4ec21b44b68c49918be55c7a85894c1 /object.c
parentfb3c711df34ef9ded92e2716da842fbe7003e92a (diff)
`dest` is always embedded so we can remove this check
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3713
Diffstat (limited to 'object.c')
-rw-r--r--object.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/object.c b/object.c
index 572bfd5a5b..3bc6725552 100644
--- a/object.c
+++ b/object.c
@@ -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;