5#define PACKABLE_SERIAL_MASK (((uint32_t)0x3) << 30)
8#define PACKABLE_SERIAL_MASK (((uint32_t)0x7) << 29)
12const_path_pack_id(
ID id)
16 uint32_t packed_id = rb_id_to_serial(
id) << 1;
17 return DYNAMIC_ID_P(
id) ? packed_id : packed_id | PACKED_ID_STATIC_FLAG;
23 return (const_path_pack_id(
id) & PACKABLE_SERIAL_MASK) == 0;
29 if (const_path_packed_p(const_path)) {
31 if ((const_path.packed >> 33)) {
47const_path_packed1(
bool absolute,
ID id)
49 uintptr_t num = (uintptr_t)const_path_pack_id(
id);
52 .packed = (num << PACKED_SHIFT) | PACKED_FLAG
55 const_path.packed |= ABSOLUTE_FLAG;
62const_path_packed2(
bool absolute,
ID first_id,
ID second_id)
64 uintptr_t num = (uintptr_t)const_path_pack_id(first_id);
65 num |= ((uintptr_t)const_path_pack_id(second_id)) << PACKED_ID_BITS;
68 .packed = (num << PACKED_SHIFT) | PACKED_FLAG
71 const_path.packed |= ABSOLUTE_FLAG;
78rb_const_path_from_array(
VALUE arr)
84 size_t size = array_size;
99 if (packable_id_p(
id)) {
100 return const_path_packed1(absolute,
id);
111 if (packable_id_p(first_id) && packable_id_p(second_id)) {
112 return const_path_packed2(absolute, first_id, second_id);
120 for (; i < array_size; i++) {
123 heap->segments[heap->size] = const_path_pack_id(
id);
131 RUBY_ASSERT((const_path.packed & (ABSOLUTE_FLAG | PACKED_FLAG)) == 0);
133 const_path.packed |= ABSOLUTE_FLAG;
144 if (const_path_absolute_p(const_path)) {
152 for (
size_t i = 0; i < const_path_size(const_path); i++) {
#define ID2SYM
Old name of RB_ID2SYM.
#define SYM2ID
Old name of RB_SYM2ID.
#define T_ARRAY
Old name of RUBY_T_ARRAY.
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
VALUE rb_ary_new_capa(rb_len_t capa)
Identical to rb_ary_new(), except it additionally specifies how many rooms of objects it should alloc...
VALUE rb_ary_push(VALUE ary, VALUE elem)
Special case of rb_ary_cat() that it adds only one element.
#define RARRAY_LEN
Just another name of rb_array_len.
#define RARRAY_AREF(a, i)
References an object in an array.
Represent a constant's path, e.g.
long rb_len_t
A signed integer type for lengths and indices of objects such as String and Array.
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
uintptr_t VALUE
Type that represents a Ruby object.
static bool RB_TYPE_P(VALUE obj, enum ruby_value_type t)
Queries if the given object is of given type.