1#ifndef INTERNAL_CLASS_H
2#define INTERNAL_CLASS_H
13#include "internal/namespace.h"
14#include "internal/serial.h"
15#include "internal/static_assert.h"
16#include "internal/variable.h"
21#include "ruby_assert.h"
39 return ns_sub->refcount;
53 if (ns_sub->refcount == 0) {
54 st_free_table(ns_sub->tbl);
74 rb_serial_t global_cvar_state;
110 const VALUE refined_class;
116 VALUE attached_object;
119 const VALUE includer;
122 attr_index_t max_iv_count;
123 uint16_t superclass_depth;
124 unsigned char variation_count;
125 bool permanent_classpath : 1;
127 bool shared_const_tbl : 1;
128 bool iclass_is_origin : 1;
129 bool iclass_origin_shared_mtbl : 1;
130 bool superclasses_with_self : 1;
135STATIC_ASSERT(shape_max_variations, SHAPE_MAX_VARIATIONS < (1 << (
sizeof(((
rb_classext_t *)0)->variation_count) * CHAR_BIT)));
151#if SIZEOF_VALUE >= SIZEOF_LONG_LONG
162static const uint16_t RCLASS_MAX_SUPERCLASS_DEPTH = ((uint16_t)-1);
164static inline bool RCLASS_SINGLETON_P(
VALUE klass);
166static inline bool RCLASS_PRIME_CLASSEXT_READABLE_P(
VALUE obj);
167static inline bool RCLASS_PRIME_CLASSEXT_WRITABLE_P(
VALUE obj);
168static inline void RCLASS_SET_PRIME_CLASSEXT_WRITABLE(
VALUE obj,
bool writable);
170#define RCLASS_EXT_PRIME(c) (&((struct RClass_and_rb_classext_t*)(c))->classext)
171#define RCLASS_EXT_PRIME_P(ext, c) (&((struct RClass_and_rb_classext_t*)(c))->classext == ext)
179#define RCLASSEXT_NS(ext) (ext->ns)
180#define RCLASSEXT_SUPER(ext) (ext->super)
181#define RCLASSEXT_FIELDS(ext) (ext->fields_obj ? ROBJECT_FIELDS(ext->fields_obj) : NULL)
182#define RCLASSEXT_FIELDS_OBJ(ext) (ext->fields_obj)
183#define RCLASSEXT_M_TBL(ext) (ext->m_tbl)
184#define RCLASSEXT_CONST_TBL(ext) (ext->const_tbl)
185#define RCLASSEXT_CALLABLE_M_TBL(ext) (ext->callable_m_tbl)
186#define RCLASSEXT_CC_TBL(ext) (ext->cc_tbl)
187#define RCLASSEXT_CVC_TBL(ext) (ext->cvc_tbl)
188#define RCLASSEXT_SUPERCLASS_DEPTH(ext) (ext->superclass_depth)
189#define RCLASSEXT_SUPERCLASSES(ext) (ext->superclasses)
190#define RCLASSEXT_SUBCLASSES(ext) (ext->subclasses)
191#define RCLASSEXT_NS_SUPER_SUBCLASSES(ext) (ext->ns_super_subclasses)
192#define RCLASSEXT_NS_MODULE_SUBCLASSES(ext) (ext->ns_module_subclasses)
193#define RCLASSEXT_ORIGIN(ext) (ext->origin_)
194#define RCLASSEXT_REFINED_CLASS(ext) (ext->refined_class)
196#define RCLASSEXT_INCLUDER(ext) (ext->as.iclass.includer)
197#define RCLASSEXT_PERMANENT_CLASSPATH(ext) (ext->permanent_classpath)
198#define RCLASSEXT_CLONED(ext) (ext->cloned)
199#define RCLASSEXT_SHARED_CONST_TBL(ext) (ext->shared_const_tbl)
200#define RCLASSEXT_ICLASS_IS_ORIGIN(ext) (ext->iclass_is_origin)
201#define RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(ext) (ext->iclass_origin_shared_mtbl)
202#define RCLASSEXT_SUPERCLASSES_WITH_SELF(ext) (ext->superclasses_with_self)
203#define RCLASSEXT_CLASSPATH(ext) (ext->classpath)
209#define RCLASS_PRIME_NS(c) (RCLASS_EXT_PRIME(c)->ns)
212#define RCLASS_PRIME_FIELDS_OBJ(c) (RCLASS_EXT_PRIME(c)->fields_obj)
213#define RCLASS_PRIME_M_TBL(c) (RCLASS_EXT_PRIME(c)->m_tbl)
214#define RCLASS_PRIME_CONST_TBL(c) (RCLASS_EXT_PRIME(c)->const_tbl)
215#define RCLASS_PRIME_CALLABLE_M_TBL(c) (RCLASS_EXT_PRIME(c)->callable_m_tbl)
216#define RCLASS_PRIME_CC_TBL(c) (RCLASS_EXT_PRIME(c)->cc_tbl)
217#define RCLASS_M_TBL_NOT_PRIME_P(c, tbl) (RCLASS_EXT_PRIME(c)->m_tbl != tbl)
218#define RCLASS_CALLABLE_M_TBL_NOT_PRIME_P(c, tbl) (RCLASS_EXT_PRIME(c)->callable_m_tbl != tbl)
219#define RCLASS_CC_TBL_NOT_PRIME_P(c, tbl) (RCLASS_EXT_PRIME(c)->cc_tbl != tbl)
222#define RCLASS_SUPER(c) (RCLASS_EXT_READABLE(c)->super)
223#define RCLASS_M_TBL(c) (RCLASS_EXT_READABLE(c)->m_tbl)
224#define RCLASS_CONST_TBL(c) (RCLASS_EXT_READABLE(c)->const_tbl)
229#define RCLASS_CVC_TBL(c) (RCLASS_EXT_READABLE(c)->cvc_tbl)
230#define RCLASS_SUBCLASSES_X(c) (RCLASS_EXT_READABLE(c)->subclasses)
231#define RCLASS_SUBCLASSES_FIRST(c) (RCLASS_EXT_READABLE(c)->subclasses->head->next)
232#define RCLASS_ORIGIN(c) (RCLASS_EXT_READABLE(c)->origin_)
233#define RICLASS_IS_ORIGIN_P(c) (RCLASS_EXT_READABLE(c)->iclass_is_origin)
234#define RCLASS_PERMANENT_CLASSPATH_P(c) (RCLASS_EXT_READABLE(c)->permanent_classpath)
235#define RCLASS_CLONED_P(c) (RCLASS_EXT_READABLE(c)->cloned)
236#define RCLASS_CLASSPATH(c) (RCLASS_EXT_READABLE(c)->classpath)
239#define RCLASS_SUPERCLASS_DEPTH(c) (RCLASS_EXT_PRIME(c)->superclass_depth)
240#define RCLASS_SUPERCLASSES(c) (RCLASS_EXT_PRIME(c)->superclasses)
241#define RCLASS_SUPERCLASSES_WITH_SELF_P(c) (RCLASS_EXT_PRIME(c)->superclasses_with_self)
244#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT_PRIME(c)->refined_class)
245#define RCLASS_ATTACHED_OBJECT(c) (RCLASS_EXT_PRIME(c)->as.singleton_class.attached_object)
246#define RCLASS_INCLUDER(c) (RCLASS_EXT_PRIME(c)->as.iclass.includer)
249#define RCLASS_MAX_IV_COUNT(ext) (RCLASS_EXT_PRIME(ext)->max_iv_count)
250#define RCLASS_VARIATION_COUNT(ext) (RCLASS_EXT_PRIME(ext)->variation_count)
253#define RCLASS_WRITABLE_M_TBL(c) (RCLASS_EXT_WRITABLE(c)->m_tbl)
254#define RCLASS_WRITABLE_CONST_TBL(c) (RCLASS_EXT_WRITABLE(c)->const_tbl)
255#define RCLASS_WRITABLE_CALLABLE_M_TBL(c) (RCLASS_EXT_WRITABLE(c)->callable_m_tbl)
256#define RCLASS_WRITABLE_CC_TBL(c) (RCLASS_EXT_WRITABLE(c)->cc_tbl)
257#define RCLASS_WRITABLE_CVC_TBL(c) (RCLASS_EXT_WRITABLE(c)->cvc_tbl)
258#define RCLASS_WRITABLE_SUBCLASSES(c) (RCLASS_EXT_WRITABLE(c)->subclasses)
260static inline void RCLASS_SET_SUPER(
VALUE klass,
VALUE super);
261static inline void RCLASS_WRITE_SUPER(
VALUE klass,
VALUE super);
263static inline void RCLASS_SET_M_TBL_WORKAROUND(
VALUE klass,
struct rb_id_table *table,
bool check_promoted);
264static inline void RCLASS_WRITE_M_TBL_WORKAROUND(
VALUE klass,
struct rb_id_table *table,
bool check_promoted);
265static inline void RCLASS_SET_CONST_TBL(
VALUE klass,
struct rb_id_table *table,
bool shared);
266static inline void RCLASS_WRITE_CONST_TBL(
VALUE klass,
struct rb_id_table *table,
bool shared);
267static inline void RCLASS_WRITE_CALLABLE_M_TBL(
VALUE klass,
struct rb_id_table *table);
268static inline void RCLASS_WRITE_CC_TBL(
VALUE klass,
struct rb_id_table *table);
269static inline void RCLASS_SET_CVC_TBL(
VALUE klass,
struct rb_id_table *table);
270static inline void RCLASS_WRITE_CVC_TBL(
VALUE klass,
struct rb_id_table *table);
272static inline void RCLASS_WRITE_SUPERCLASSES(
VALUE klass,
size_t depth,
VALUE *superclasses,
bool with_self);
277static inline void RCLASS_SET_ORIGIN(
VALUE klass,
VALUE origin);
278static inline void RCLASS_WRITE_ORIGIN(
VALUE klass,
VALUE origin);
279static inline void RICLASS_SET_ORIGIN_SHARED_MTBL(
VALUE iclass);
280static inline void RICLASS_WRITE_ORIGIN_SHARED_MTBL(
VALUE iclass);
281static inline bool RICLASS_OWNS_M_TBL_P(
VALUE iclass);
283static inline void RCLASS_SET_REFINED_CLASS(
VALUE klass,
VALUE refined);
286static inline VALUE RCLASS_SET_ATTACHED_OBJECT(
VALUE klass,
VALUE attached_object);
288static inline void RCLASS_SET_INCLUDER(
VALUE iclass,
VALUE klass);
289static inline void RCLASS_SET_MAX_IV_COUNT(
VALUE klass, attr_index_t count);
290static inline void RCLASS_SET_CLONED(
VALUE klass,
bool cloned);
291static inline void RCLASS_SET_CLASSPATH(
VALUE klass,
VALUE classpath,
bool permanent);
292static inline void RCLASS_WRITE_CLASSPATH(
VALUE klass,
VALUE classpath,
bool permanent);
294#define RCLASS_IS_ROOT FL_USER0
296#define RCLASS_PRIME_CLASSEXT_WRITABLE FL_USER2
297#define RCLASS_IS_INITIALIZED FL_USER3
299#define RCLASS_NAMESPACEABLE FL_USER4
302RCLASS_CLASSEXT_TBL(
VALUE klass)
306 return ns_klass->ns_classext_tbl;
316 ns_klass->ns_classext_tbl = tbl;
321void rb_class_ensure_writable(
VALUE obj);
327 st_table *tbl = RCLASS_CLASSEXT_TBL(obj);
328 VM_ASSERT(NAMESPACE_USER_P(ns));
329 VM_ASSERT(ns->ns_object);
330 VM_ASSERT(RCLASSEXT_NS(ext) == ns);
332 tbl = st_init_numtable_with_size(1);
333 RCLASS_SET_CLASSEXT_TBL(obj, tbl);
335 if (rb_st_table_size(tbl) == 0) {
338 rb_st_insert(tbl, (st_data_t)ns->ns_object, (st_data_t)ext);
343RCLASS_PRIME_CLASSEXT_READABLE_P(
VALUE klass)
347 return !
FL_TEST_RAW(klass, RCLASS_NAMESPACEABLE) || RCLASS_CLASSEXT_TBL(klass) == NULL;
351RCLASS_PRIME_CLASSEXT_WRITABLE_P(
VALUE klass)
354 return FL_TEST(klass, RCLASS_PRIME_CLASSEXT_WRITABLE);
358RCLASS_SET_PRIME_CLASSEXT_WRITABLE(
VALUE klass,
bool writable)
363 FL_SET(klass, RCLASS_PRIME_CLASSEXT_WRITABLE);
366 FL_UNSET(klass, RCLASS_PRIME_CLASSEXT_WRITABLE);
373 st_data_t classext_ptr;
374 st_table *classext_tbl = RCLASS_CLASSEXT_TBL(obj);
376 if (rb_st_lookup(classext_tbl, (st_data_t)ns->ns_object, &classext_ptr)) {
386 rb_classext_t *ext = RCLASS_EXT_TABLE_LOOKUP_INTERNAL(obj, ns);
390 return RCLASS_EXT_PRIME(obj);
397 || NAMESPACE_BUILTIN_P(ns)
398 || RCLASS_PRIME_CLASSEXT_READABLE_P(obj)) {
399 return RCLASS_EXT_PRIME(obj);
401 return RCLASS_EXT_READABLE_LOOKUP(obj, ns);
405RCLASS_EXT_READABLE(
VALUE obj)
408 if (RCLASS_PRIME_CLASSEXT_READABLE_P(obj)) {
409 return RCLASS_EXT_PRIME(obj);
412 ns = rb_current_namespace();
413 if (!ns || NAMESPACE_BUILTIN_P(ns)) {
414 return RCLASS_EXT_PRIME(obj);
416 return RCLASS_EXT_READABLE_LOOKUP(obj, ns);
425 ext = RCLASS_EXT_TABLE_LOOKUP_INTERNAL(obj, ns);
431 ext = RCLASS_EXT_TABLE_LOOKUP_INTERNAL(obj, ns);
433 ext = rb_class_duplicate_classext(RCLASS_EXT_PRIME(obj), obj, ns);
434 first_set = RCLASS_SET_NAMESPACE_CLASSEXT(obj, ns, ext);
436 RCLASS_SET_PRIME_CLASSEXT_WRITABLE(obj,
false);
447 || NAMESPACE_BUILTIN_P(ns)
448 || RCLASS_PRIME_CLASSEXT_WRITABLE_P(obj)) {
449 return RCLASS_EXT_PRIME(obj);
451 return RCLASS_EXT_WRITABLE_LOOKUP(obj, ns);
455RCLASS_EXT_WRITABLE(
VALUE obj)
458 if (LIKELY(RCLASS_PRIME_CLASSEXT_WRITABLE_P(obj))) {
459 return RCLASS_EXT_PRIME(obj);
462 ns = rb_current_namespace();
463 if (!ns || NAMESPACE_BUILTIN_P(ns)) {
466 return RCLASS_EXT_PRIME(obj);
468 return RCLASS_EXT_WRITABLE_LOOKUP(obj, ns);
481 RB_OBJ_WRITE(klass, &(RCLASSEXT_INCLUDER(ext)), includer);
485typedef void rb_class_classext_foreach_callback_func(
rb_classext_t *classext,
bool is_prime,
VALUE namespace,
void *arg);
486void rb_class_classext_foreach(
VALUE klass, rb_class_classext_foreach_callback_func *func,
void *arg);
487void rb_class_subclass_add(
VALUE super,
VALUE klass);
488void rb_class_remove_from_super_subclasses(
VALUE);
489void rb_class_remove_from_module_subclasses(
VALUE);
492void rb_class_detach_subclasses(
VALUE);
493void rb_class_detach_module_subclasses(
VALUE);
494void rb_class_update_superclasses(
VALUE);
495size_t rb_class_superclasses_memsize(
VALUE);
496void rb_class_remove_subclass_head(
VALUE);
497int rb_singleton_class_internal_p(
VALUE sklass);
502void rb_class_set_initialized(
VALUE klass);
503void rb_module_check_initializable(
VALUE module);
511VALUE rb_class_undefined_instance_methods(
VALUE mod);
515void rb_undef_methods_from(
VALUE klass,
VALUE super);
517VALUE rb_keyword_error_new(
const char *,
VALUE);
519RUBY_SYMBOL_EXPORT_BEGIN
524unsigned char rb_class_variation_count(
VALUE klass);
526RUBY_SYMBOL_EXPORT_END
529RCLASS_SINGLETON_P(
VALUE klass)
537 RB_OBJ_WRITE(klass, &RCLASSEXT_SUPER(RCLASS_EXT_PRIME(klass)), super);
543 RB_OBJ_WRITE(klass, &RCLASSEXT_SUPER(RCLASS_EXT_WRITABLE(klass)), super);
547RCLASS_WRITABLE_ENSURE_FIELDS_OBJ(
VALUE obj)
551 if (!ext->fields_obj) {
554 return ext->fields_obj;
558RCLASS_WRITABLE_FIELDS_OBJ(
VALUE obj)
561 return RCLASSEXT_FIELDS_OBJ(RCLASS_EXT_WRITABLE(obj));
569 VALUE old_fields_obj = ext->fields_obj;
575RCLASS_WRITABLE_SET_FIELDS_OBJ(
VALUE obj,
VALUE fields_obj)
579 RCLASSEXT_SET_FIELDS_OBJ(obj, RCLASS_EXT_WRITABLE(obj), fields_obj);
582static inline uint32_t
583RCLASS_FIELDS_COUNT(
VALUE obj)
587 VALUE fields_obj = RCLASS_WRITABLE_FIELDS_OBJ(obj);
589 if (rb_shape_obj_too_complex_p(fields_obj)) {
590 return (uint32_t)rb_st_table_size(rb_imemo_fields_complex_tbl(fields_obj));
593 return RSHAPE_LEN(RBASIC_SHAPE_ID(fields_obj));
599#define RCLASS_SET_M_TBL_EVEN_WHEN_PROMOTED(klass, table) RCLASS_SET_M_TBL_WORKAROUND(klass, table, false)
600#define RCLASS_SET_M_TBL(klass, table) RCLASS_SET_M_TBL_WORKAROUND(klass, table, true)
603RCLASS_SET_M_TBL_WORKAROUND(
VALUE klass,
struct rb_id_table *table,
bool check_promoted)
606 RCLASSEXT_M_TBL(RCLASS_EXT_PRIME(klass)) = table;
609#define RCLASS_WRITE_M_TBL_EVEN_WHEN_PROMOTED(klass, table) RCLASS_WRITE_M_TBL_WORKAROUND(klass, table, false)
610#define RCLASS_WRITE_M_TBL(klass, table) RCLASS_WRITE_M_TBL_WORKAROUND(klass, table, true)
613RCLASS_WRITE_M_TBL_WORKAROUND(
VALUE klass,
struct rb_id_table *table,
bool check_promoted)
618 RCLASSEXT_M_TBL(RCLASS_EXT_WRITABLE(klass)) = table;
625 RCLASSEXT_CONST_TBL(ext) = table;
627 RCLASSEXT_SHARED_CONST_TBL(ext) =
true;
634 RCLASSEXT_CONST_TBL(ext) = table;
636 RCLASSEXT_SHARED_CONST_TBL(ext) =
true;
642 RCLASSEXT_CALLABLE_M_TBL(RCLASS_EXT_WRITABLE(klass)) = table;
648 RCLASSEXT_CC_TBL(RCLASS_EXT_WRITABLE(klass)) = table;
654 RCLASSEXT_CVC_TBL(RCLASS_EXT_PRIME(klass)) = table;
660 RCLASSEXT_CVC_TBL(RCLASS_EXT_WRITABLE(klass)) = table;
664RCLASS_SET_REFINED_CLASS(
VALUE klass,
VALUE refined)
666 RB_OBJ_WRITE(klass, &RCLASSEXT_REFINED_CLASS(RCLASS_EXT_PRIME(klass)), refined);
670RCLASS_ALLOCATOR(
VALUE klass)
676 return RCLASS_EXT_PRIME(klass)->as.class.allocator;
684 RCLASS_EXT_PRIME(klass)->as.class.allocator = allocator;
692 if (klass != origin) RCLASSEXT_ICLASS_IS_ORIGIN(RCLASS_EXT_WRITABLE(origin)) =
true;
700 if (klass != origin) RCLASSEXT_ICLASS_IS_ORIGIN(RCLASS_EXT_WRITABLE(origin)) =
true;
704RICLASS_SET_ORIGIN_SHARED_MTBL(
VALUE iclass)
706 RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(RCLASS_EXT_PRIME(iclass)) =
true;
710RICLASS_WRITE_ORIGIN_SHARED_MTBL(
VALUE iclass)
712 RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(RCLASS_EXT_WRITABLE(iclass)) =
true;
716RICLASS_OWNS_M_TBL_P(
VALUE iclass)
719 return RCLASSEXT_ICLASS_IS_ORIGIN(ext) && !RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL(ext);
730RCLASS_WRITE_SUPERCLASSES(
VALUE klass,
size_t depth,
VALUE *superclasses,
bool with_self)
735 RCLASSEXT_SUPERCLASS_DEPTH(ext) = depth;
736 RCLASSEXT_SUPERCLASSES(ext) = superclasses;
737 RCLASSEXT_SUPERCLASSES_WITH_SELF(ext) = with_self;
744 RCLASSEXT_SUBCLASSES(ext) = anchor;
751 if (RCLASSEXT_NS_SUPER_SUBCLASSES(ext))
752 rb_ns_subclasses_ref_dec(RCLASSEXT_NS_SUPER_SUBCLASSES(ext));
753 RCLASSEXT_NS_SUPER_SUBCLASSES(ext) = rb_ns_subclasses_ref_inc(ns_subclasses);
760 if (RCLASSEXT_NS_MODULE_SUBCLASSES(ext))
761 rb_ns_subclasses_ref_dec(RCLASSEXT_NS_MODULE_SUBCLASSES(ext));
762 RCLASSEXT_NS_MODULE_SUBCLASSES(ext) = rb_ns_subclasses_ref_inc(ns_subclasses);
766RCLASS_SET_CLASSPATH(
VALUE klass,
VALUE classpath,
bool permanent)
772 RB_OBJ_WRITE(klass, &(RCLASSEXT_CLASSPATH(ext)), classpath);
773 RCLASSEXT_PERMANENT_CLASSPATH(ext) = permanent;
777RCLASS_WRITE_CLASSPATH(
VALUE klass,
VALUE classpath,
bool permanent)
783 RB_OBJ_WRITE(klass, &(RCLASSEXT_CLASSPATH(ext)), classpath);
784 RCLASSEXT_PERMANENT_CLASSPATH(ext) = permanent;
788RCLASS_SET_ATTACHED_OBJECT(
VALUE klass,
VALUE attached_object)
790 assert(RCLASS_SINGLETON_P(klass));
792 RB_OBJ_WRITE(klass, &RCLASS_EXT_PRIME(klass)->as.singleton_class.attached_object, attached_object);
793 return attached_object;
797RCLASS_SET_MAX_IV_COUNT(
VALUE klass, attr_index_t count)
799 RCLASS_MAX_IV_COUNT(klass) = count;
803RCLASS_SET_CLONED(
VALUE klass,
bool cloned)
805 RCLASSEXT_CLONED(RCLASS_EXT_PRIME(klass)) = cloned;
809RCLASS_INITIALIZED_P(
VALUE klass)
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
#define RUBY_ATOMIC_VALUE_SET(var, val)
Identical to RUBY_ATOMIC_SET, except it expects its arguments are VALUE.
VALUE rb_singleton_class(VALUE obj)
Finds or creates the singleton class of the passed object.
VALUE rb_class_boot(VALUE)
A utility function that wraps class_alloc.
VALUE rb_class_inherited(VALUE, VALUE)
Calls Class::inherited.
VALUE rb_singleton_class_get(VALUE obj)
Returns the singleton class of obj, or nil if obj is not a singleton object.
#define FL_SINGLETON
Old name of RUBY_FL_SINGLETON.
#define T_STRING
Old name of RUBY_T_STRING.
#define xfree
Old name of ruby_xfree.
#define T_MODULE
Old name of RUBY_T_MODULE.
#define T_ICLASS
Old name of RUBY_T_ICLASS.
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
#define FL_SET
Old name of RB_FL_SET.
#define T_CLASS
Old name of RUBY_T_CLASS.
#define BUILTIN_TYPE
Old name of RB_BUILTIN_TYPE.
#define FL_TEST
Old name of RB_FL_TEST.
#define FL_UNSET
Old name of RB_FL_UNSET.
#define RB_OBJ_WRITTEN(old, oldv, young)
Identical to RB_OBJ_WRITE(), except it doesn't write any values, but only a WB declaration.
#define RB_OBJ_WRITE(old, slot, young)
Declaration of a "back" pointer.
static bool RB_OBJ_PROMOTED(VALUE obj)
Tests if the object is "promoted" – that is, whether the object experienced one or more GC marks.
VALUE(* rb_alloc_func_t)(VALUE klass)
This is the type of functions that ruby calls when trying to allocate an object.
Ruby object's base components.
struct rb_subclass_anchor * subclasses
The head of subclasses is a blank (w/o klass) entry to be referred from anchor (and be never deleted)...
rb_ns_subclasses_t * ns_module_subclasses
In the case that this is an ICLASS, ns_module_subclasses points to the link in the module's subclasse...
rb_ns_subclasses_t * ns_super_subclasses
The ns_super_subclasses points the ns_subclasses struct to retreive the subclasses of the super class...
Internal header for Namespace.
Internal header for Class.
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.