rename SHAPE_BITS to SHAPE_ID_NUM_BITS

This commit is contained in:
Aaron Patterson 2022-11-18 10:29:41 -08:00 committed by Aaron Patterson
parent ba3b40a9ae
commit 6582f34831
Notes: git 2022-11-18 20:04:29 +00:00
5 changed files with 14 additions and 14 deletions

View File

@ -158,10 +158,6 @@ module RubyVM::MJIT
Primitive.cexpr! %q{ INT2NUM(VM_METHOD_TYPE_ISEQ) } Primitive.cexpr! %q{ INT2NUM(VM_METHOD_TYPE_ISEQ) }
end end
def C.SHAPE_BITS
Primitive.cexpr! %q{ UINT2NUM(SHAPE_BITS) }
end
def C.SHAPE_CAPACITY_CHANGE def C.SHAPE_CAPACITY_CHANGE
Primitive.cexpr! %q{ UINT2NUM(SHAPE_CAPACITY_CHANGE) } Primitive.cexpr! %q{ UINT2NUM(SHAPE_CAPACITY_CHANGE) }
end end
@ -174,6 +170,10 @@ module RubyVM::MJIT
Primitive.cexpr! %q{ UINT2NUM(SHAPE_FROZEN) } Primitive.cexpr! %q{ UINT2NUM(SHAPE_FROZEN) }
end end
def C.SHAPE_ID_NUM_BITS
Primitive.cexpr! %q{ UINT2NUM(SHAPE_ID_NUM_BITS) }
end
def C.SHAPE_INITIAL_CAPACITY def C.SHAPE_INITIAL_CAPACITY
Primitive.cexpr! %q{ UINT2NUM(SHAPE_INITIAL_CAPACITY) } Primitive.cexpr! %q{ UINT2NUM(SHAPE_INITIAL_CAPACITY) }
end end

View File

@ -290,7 +290,7 @@ rb_ractor_id(const rb_ractor_t *r)
#if RACTOR_CHECK_MODE > 0 #if RACTOR_CHECK_MODE > 0
uint32_t rb_ractor_current_id(void); uint32_t rb_ractor_current_id(void);
// If ractor check mode is enabled, shape bits needs to be smaller // If ractor check mode is enabled, shape bits needs to be smaller
STATIC_ASSERT(shape_bits, SHAPE_BITS == 16); STATIC_ASSERT(shape_bits, SHAPE_ID_NUM_BITS == 16);
static inline void static inline void
rb_ractor_setup_belonging_to(VALUE obj, uint32_t rid) rb_ractor_setup_belonging_to(VALUE obj, uint32_t rid)

View File

@ -665,7 +665,7 @@ Init_shape(void)
rb_define_const(rb_cShape, "SHAPE_T_OBJECT", INT2NUM(SHAPE_T_OBJECT)); rb_define_const(rb_cShape, "SHAPE_T_OBJECT", INT2NUM(SHAPE_T_OBJECT));
rb_define_const(rb_cShape, "SHAPE_IVAR_UNDEF", INT2NUM(SHAPE_IVAR_UNDEF)); rb_define_const(rb_cShape, "SHAPE_IVAR_UNDEF", INT2NUM(SHAPE_IVAR_UNDEF));
rb_define_const(rb_cShape, "SHAPE_FROZEN", INT2NUM(SHAPE_FROZEN)); rb_define_const(rb_cShape, "SHAPE_FROZEN", INT2NUM(SHAPE_FROZEN));
rb_define_const(rb_cShape, "SHAPE_BITS", INT2NUM(SHAPE_BITS)); rb_define_const(rb_cShape, "SHAPE_ID_NUM_BITS", INT2NUM(SHAPE_ID_NUM_BITS));
rb_define_const(rb_cShape, "SHAPE_FLAG_SHIFT", INT2NUM(SHAPE_FLAG_SHIFT)); rb_define_const(rb_cShape, "SHAPE_FLAG_SHIFT", INT2NUM(SHAPE_FLAG_SHIFT));
rb_define_const(rb_cShape, "SPECIAL_CONST_SHAPE_ID", INT2NUM(SPECIAL_CONST_SHAPE_ID)); rb_define_const(rb_cShape, "SPECIAL_CONST_SHAPE_ID", INT2NUM(SPECIAL_CONST_SHAPE_ID));

14
shape.h
View File

@ -15,25 +15,25 @@ typedef uint16_t attr_index_t;
#if RUBY_DEBUG || (defined(VM_CHECK_MODE) && VM_CHECK_MODE > 0) #if RUBY_DEBUG || (defined(VM_CHECK_MODE) && VM_CHECK_MODE > 0)
# if SIZEOF_SHAPE_T == 4 # if SIZEOF_SHAPE_T == 4
typedef uint32_t shape_id_t; typedef uint32_t shape_id_t;
# define SHAPE_BITS 16 # define SHAPE_ID_NUM_BITS 16
# else # else
typedef uint16_t shape_id_t; typedef uint16_t shape_id_t;
# define SHAPE_BITS 16 # define SHAPE_ID_NUM_BITS 16
# endif # endif
#else #else
# if SIZEOF_SHAPE_T == 4 # if SIZEOF_SHAPE_T == 4
typedef uint32_t shape_id_t; typedef uint32_t shape_id_t;
# define SHAPE_BITS 32 # define SHAPE_ID_NUM_BITS 32
# else # else
typedef uint16_t shape_id_t; typedef uint16_t shape_id_t;
# define SHAPE_BITS 16 # define SHAPE_ID_NUM_BITS 16
# endif # endif
#endif #endif
# define SHAPE_MASK (((uintptr_t)1 << SHAPE_BITS) - 1) # define SHAPE_MASK (((uintptr_t)1 << SHAPE_ID_NUM_BITS) - 1)
# define SHAPE_FLAG_MASK (((VALUE)-1) >> SHAPE_BITS) # define SHAPE_FLAG_MASK (((VALUE)-1) >> SHAPE_ID_NUM_BITS)
# define SHAPE_FLAG_SHIFT ((SIZEOF_VALUE * 8) - SHAPE_BITS) # define SHAPE_FLAG_SHIFT ((SIZEOF_VALUE * 8) - SHAPE_ID_NUM_BITS)
# define SHAPE_BITMAP_SIZE 16384 # define SHAPE_BITMAP_SIZE 16384

View File

@ -346,7 +346,7 @@ generator = BindingGenerator.new(
VM_METHOD_TYPE_ISEQ VM_METHOD_TYPE_ISEQ
], ],
UINT: %w[ UINT: %w[
SHAPE_BITS SHAPE_ID_NUM_BITS
SHAPE_CAPACITY_CHANGE SHAPE_CAPACITY_CHANGE
SHAPE_FLAG_SHIFT SHAPE_FLAG_SHIFT
SHAPE_FROZEN SHAPE_FROZEN