Let SHAPE_BITS take 32 bits on debug builds

The ractor_belonging_id has been moved out of the headers, so object
shapes can take the top 32 bits of the flags on debug builds.
This commit is contained in:
Peter Zhu 2022-11-18 10:39:09 -05:00
parent 5f95228c76
commit 09423876f9
Notes: git 2022-11-21 16:26:52 +00:00
2 changed files with 2 additions and 14 deletions

View File

@ -291,8 +291,6 @@ rb_ractor_id(const rb_ractor_t *r)
# define RACTOR_BELONGING_ID(obj) (*(uint32_t *)(((uintptr_t)(obj)) + rb_gc_obj_slot_size(obj)))
uint32_t rb_ractor_current_id(void);
// If ractor check mode is enabled, shape bits needs to be smaller
STATIC_ASSERT(shape_bits, SHAPE_ID_NUM_BITS == 16);
static inline void
rb_ractor_setup_belonging_to(VALUE obj, uint32_t rid)

14
shape.h
View File

@ -12,22 +12,12 @@ typedef uint16_t attr_index_t;
#define MAX_IVARS (attr_index_t)(-1)
#if RUBY_DEBUG || (defined(VM_CHECK_MODE) && VM_CHECK_MODE > 0)
# if SIZEOF_SHAPE_T == 4
typedef uint32_t shape_id_t;
# define SHAPE_ID_NUM_BITS 16
# else
typedef uint16_t shape_id_t;
# define SHAPE_ID_NUM_BITS 16
# endif
#else
# if SIZEOF_SHAPE_T == 4
#if SIZEOF_SHAPE_T == 4
typedef uint32_t shape_id_t;
# define SHAPE_ID_NUM_BITS 32
# else
#else
typedef uint16_t shape_id_t;
# define SHAPE_ID_NUM_BITS 16
# endif
#endif
# define SHAPE_MASK (((uintptr_t)1 << SHAPE_ID_NUM_BITS) - 1)