diff options
author | Matt Valentine-House <[email protected]> | 2021-11-10 21:33:17 +0000 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2021-11-11 13:47:45 -0500 |
commit | a9a94540d68b523ecc4e2181e50b320cd5d176f1 (patch) | |
tree | 4294632b83889625c3fbf5ba117f7fbc22ee1a8a /internal/class.h | |
parent | d08d13700c6527eb117af5df0a6c16e40aba6348 (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 'internal/class.h')
-rw-r--r-- | internal/class.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/class.h b/internal/class.h index a949bfb3e6..ee36ad1967 100644 --- a/internal/class.h +++ b/internal/class.h @@ -66,7 +66,9 @@ struct rb_classext_struct { struct RClass { struct RBasic basic; VALUE super; +#if !USE_RVARGC struct rb_classext_struct *ptr; +#endif #if SIZEOF_SERIAL_T == SIZEOF_VALUE /* Class serial is as wide as VALUE. Place it here. */ rb_serial_t class_serial; @@ -79,7 +81,11 @@ struct RClass { typedef struct rb_subclass_entry rb_subclass_entry_t; typedef struct rb_classext_struct rb_classext_t; -#define RCLASS_EXT(c) (RCLASS(c)->ptr) +#if USE_RVARGC +# define RCLASS_EXT(c) ((rb_classext_t *)((char *)c + sizeof(struct RClass))) +#else +# define RCLASS_EXT(c) (RCLASS(c)->ptr) +#endif #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl) #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl) #if SIZEOF_SERIAL_T == SIZEOF_VALUE |