summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gc.c b/gc.c
index cbfd3d9..f868709 100644
--- a/gc.c
+++ b/gc.c
@@ -2113,11 +2113,20 @@ newobj_init(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int wb_prote
#endif
/* OBJSETUP */
- RBASIC(obj)->flags = flags;
- RBASIC_SET_CLASS_RAW(obj, klass);
- RANY(obj)->as.values.v1 = v1;
- RANY(obj)->as.values.v2 = v2;
- RANY(obj)->as.values.v3 = v3;
+ struct RVALUE buf = {
+ .as = {
+ .values = {
+ .basic = {
+ .flags = flags,
+ .klass = klass,
+ },
+ .v1 = v1,
+ .v2 = v2,
+ .v3 = v3,
+ },
+ },
+ };
+ MEMCPY(RANY(obj), &buf, RVALUE, 1);
#if RGENGC_CHECK_MODE
GC_ASSERT(RVALUE_MARKED(obj) == FALSE);