summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2021-11-10 21:33:17 +0000
committerPeter Zhu <peter@peterzhu.ca>2021-11-11 13:47:45 -0500
commita9a94540d68b523ecc4e2181e50b320cd5d176f1 (patch)
tree4294632b83889625c3fbf5ba117f7fbc22ee1a8a /class.c
parentd08d13700c6527eb117af5df0a6c16e40aba6348 (diff)
Remove RCLASS(obj)->ptr when RVARGC is enabled
With RVARGC we always store the rb_classext_t in the same slot as the RClass struct that refers to it. So we don't need to store the pointer or access through the pointer anymore and can switch the RCLASS_EXT macro to use an offset
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5101
Diffstat (limited to 'class.c')
-rw-r--r--class.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/class.c b/class.c
index f5090d7f0f..01939f5008 100644
--- a/class.c
+++ b/class.c
@@ -177,9 +177,7 @@ class_alloc(VALUE flags, VALUE klass)
RVARGC_NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0), alloc_size);
-#if USE_RVARGC
- obj->ptr = (rb_classext_t *)((char *)obj + sizeof(struct RClass));
-#else
+#if !USE_RVARGC
obj->ptr = ZALLOC(rb_classext_t);
#endif