@@ -157,7 +157,7 @@ static inline bool RCLASS_PRIME_CLASSEXT_READABLE_P(VALUE obj);
157157static inline bool RCLASS_PRIME_CLASSEXT_WRITABLE_P (VALUE obj );
158158static inline void RCLASS_SET_PRIME_CLASSEXT_WRITABLE (VALUE obj , bool writable );
159159
160- #define RCLASS_EXT (c ) (&((struct RClass_and_rb_classext_t*)(c))->classext)
160+ #define RCLASS_EXT_PRIME (c ) (&((struct RClass_and_rb_classext_t*)(c))->classext)
161161#define RCLASS_EXT_PRIME_P (ext , c ) (&((struct RClass_and_rb_classext_t*)(c))->classext == ext)
162162
163163static inline rb_classext_t * RCLASS_EXT_READABLE_IN_NS (VALUE obj , const rb_namespace_t * ns );
@@ -200,17 +200,17 @@ static inline void RCLASSEXT_SET_ORIGIN(rb_classext_t *ext, VALUE klass, VALUE o
200200static inline void RCLASSEXT_SET_INCLUDER (rb_classext_t * ext , VALUE klass , VALUE includer );
201201
202202/* Prime classext entry accessor for very specific reason */
203- #define RCLASS_PRIME_NS (c ) (RCLASS_EXT (c)->ns)
203+ #define RCLASS_PRIME_NS (c ) (RCLASS_EXT_PRIME (c)->ns)
204204// To invalidate CC by inserting&invalidating method entry into tables containing the target cme
205205// See clear_method_cache_by_id_in_class()
206- #define RCLASS_PRIME_FIELDS (c ) (RCLASS_EXT (c)->fields)
207- #define RCLASS_PRIME_M_TBL (c ) (RCLASS_EXT (c)->m_tbl)
208- #define RCLASS_PRIME_CONST_TBL (c ) (RCLASS_EXT (c)->const_tbl)
209- #define RCLASS_PRIME_CALLABLE_M_TBL (c ) (RCLASS_EXT (c)->callable_m_tbl)
210- #define RCLASS_PRIME_CC_TBL (c ) (RCLASS_EXT (c)->cc_tbl)
211- #define RCLASS_M_TBL_NOT_PRIME_P (c , tbl ) (RCLASS_EXT (c)->m_tbl != tbl)
212- #define RCLASS_CALLABLE_M_TBL_NOT_PRIME_P (c , tbl ) (RCLASS_EXT (c)->callable_m_tbl != tbl)
213- #define RCLASS_CC_TBL_NOT_PRIME_P (c , tbl ) (RCLASS_EXT (c)->cc_tbl != tbl)
206+ #define RCLASS_PRIME_FIELDS (c ) (RCLASS_EXT_PRIME (c)->fields)
207+ #define RCLASS_PRIME_M_TBL (c ) (RCLASS_EXT_PRIME (c)->m_tbl)
208+ #define RCLASS_PRIME_CONST_TBL (c ) (RCLASS_EXT_PRIME (c)->const_tbl)
209+ #define RCLASS_PRIME_CALLABLE_M_TBL (c ) (RCLASS_EXT_PRIME (c)->callable_m_tbl)
210+ #define RCLASS_PRIME_CC_TBL (c ) (RCLASS_EXT_PRIME (c)->cc_tbl)
211+ #define RCLASS_M_TBL_NOT_PRIME_P (c , tbl ) (RCLASS_EXT_PRIME (c)->m_tbl != tbl)
212+ #define RCLASS_CALLABLE_M_TBL_NOT_PRIME_P (c , tbl ) (RCLASS_EXT_PRIME (c)->callable_m_tbl != tbl)
213+ #define RCLASS_CC_TBL_NOT_PRIME_P (c , tbl ) (RCLASS_EXT_PRIME (c)->cc_tbl != tbl)
214214
215215// Read accessor, regarding namespaces
216216#define RCLASS_SUPER (c ) (RCLASS_EXT_READABLE(c)->super)
@@ -235,9 +235,9 @@ static inline void RCLASSEXT_SET_INCLUDER(rb_classext_t *ext, VALUE klass, VALUE
235235#define RCLASS_CLASSPATH (c ) (RCLASS_EXT_READABLE(c)->classpath)
236236
237237// namespaces don't make changes on these refined_class/attached_object/includer
238- #define RCLASS_REFINED_CLASS (c ) (RCLASS_EXT (c)->refined_class)
239- #define RCLASS_ATTACHED_OBJECT (c ) (RCLASS_EXT (c)->as.singleton_class.attached_object)
240- #define RCLASS_INCLUDER (c ) (RCLASS_EXT (c)->includer)
238+ #define RCLASS_REFINED_CLASS (c ) (RCLASS_EXT_PRIME (c)->refined_class)
239+ #define RCLASS_ATTACHED_OBJECT (c ) (RCLASS_EXT_PRIME (c)->as.singleton_class.attached_object)
240+ #define RCLASS_INCLUDER (c ) (RCLASS_EXT_PRIME (c)->includer)
241241
242242// Writable classext entries (instead of RCLASS_SET_*) because member data will be operated directly
243243#define RCLASS_WRITABLE_M_TBL (c ) (RCLASS_EXT_WRITABLE(c)->m_tbl)
@@ -369,7 +369,7 @@ RCLASS_EXT_READABLE_LOOKUP(VALUE obj, const rb_namespace_t *ns)
369369 if (ext )
370370 return ext ;
371371 // Classext for the ns not found. Refer the prime one instead.
372- return RCLASS_EXT (obj );
372+ return RCLASS_EXT_PRIME (obj );
373373}
374374
375375static inline rb_classext_t *
@@ -378,7 +378,7 @@ RCLASS_EXT_READABLE_IN_NS(VALUE obj, const rb_namespace_t *ns)
378378 if (!ns
379379 || NAMESPACE_BUILTIN_P (ns )
380380 || RCLASS_PRIME_CLASSEXT_READABLE_P (obj )) {
381- return RCLASS_EXT (obj );
381+ return RCLASS_EXT_PRIME (obj );
382382 }
383383 return RCLASS_EXT_READABLE_LOOKUP (obj , ns );
384384}
@@ -388,12 +388,12 @@ RCLASS_EXT_READABLE(VALUE obj)
388388{
389389 const rb_namespace_t * ns ;
390390 if (RCLASS_PRIME_CLASSEXT_READABLE_P (obj )) {
391- return RCLASS_EXT (obj );
391+ return RCLASS_EXT_PRIME (obj );
392392 }
393393 // delay namespace loading to optimize for unmodified classes
394394 ns = rb_current_namespace ();
395395 if (!ns || NAMESPACE_BUILTIN_P (ns )) {
396- return RCLASS_EXT (obj );
396+ return RCLASS_EXT_PRIME (obj );
397397 }
398398 return RCLASS_EXT_READABLE_LOOKUP (obj , ns );
399399}
@@ -417,7 +417,7 @@ RCLASS_EXT_WRITABLE_LOOKUP(VALUE obj, const rb_namespace_t *ns)
417417 // re-check the classext is not created to avoid the multi-thread race
418418 ext = RCLASS_EXT_TABLE_LOOKUP_INTERNAL (obj , ns );
419419 if (!ext ) {
420- ext = rb_class_duplicate_classext (RCLASS_EXT (obj ), obj , ns );
420+ ext = rb_class_duplicate_classext (RCLASS_EXT_PRIME (obj ), obj , ns );
421421 first_set = RCLASS_SET_NAMESPACE_CLASSEXT (obj , ns , ext );
422422 if (first_set ) {
423423 RCLASS_SET_PRIME_CLASSEXT_WRITABLE (obj , false);
@@ -434,7 +434,7 @@ RCLASS_EXT_WRITABLE_IN_NS(VALUE obj, const rb_namespace_t *ns)
434434 if (!ns
435435 || NAMESPACE_BUILTIN_P (ns )
436436 || RCLASS_PRIME_CLASSEXT_WRITABLE_P (obj )) {
437- return RCLASS_EXT (obj );
437+ return RCLASS_EXT_PRIME (obj );
438438 }
439439 return RCLASS_EXT_WRITABLE_LOOKUP (obj , ns );
440440}
@@ -444,14 +444,14 @@ RCLASS_EXT_WRITABLE(VALUE obj)
444444{
445445 const rb_namespace_t * ns ;
446446 if (RCLASS_PRIME_CLASSEXT_WRITABLE_P (obj )) {
447- return RCLASS_EXT (obj );
447+ return RCLASS_EXT_PRIME (obj );
448448 }
449449 // delay namespace loading to optimize for unmodified classes
450450 ns = rb_current_namespace ();
451451 if (!ns || NAMESPACE_BUILTIN_P (ns )) {
452452 // If no namespace is specified, Ruby VM is in bootstrap
453453 // and the clean class definition is under construction.
454- return RCLASS_EXT (obj );
454+ return RCLASS_EXT_PRIME (obj );
455455 }
456456 return RCLASS_EXT_WRITABLE_LOOKUP (obj , ns );
457457}
@@ -521,7 +521,7 @@ RCLASS_SINGLETON_P(VALUE klass)
521521static inline void
522522RCLASS_SET_SUPER (VALUE klass , VALUE super )
523523{
524- RB_OBJ_WRITE (klass , & RCLASSEXT_SUPER (RCLASS_EXT (klass )), super );
524+ RB_OBJ_WRITE (klass , & RCLASSEXT_SUPER (RCLASS_EXT_PRIME (klass )), super );
525525}
526526
527527static inline void
@@ -551,7 +551,7 @@ RCLASS_SET_FIELDS_HASH(VALUE obj, const st_table *tbl)
551551{
552552 RUBY_ASSERT (RB_TYPE_P (obj , RUBY_T_CLASS ) || RB_TYPE_P (obj , RUBY_T_MODULE ));
553553 RUBY_ASSERT (rb_shape_obj_too_complex_p (obj ));
554- RCLASSEXT_FIELDS (RCLASS_EXT (obj )) = (VALUE * )tbl ;
554+ RCLASSEXT_FIELDS (RCLASS_EXT_PRIME (obj )) = (VALUE * )tbl ;
555555}
556556
557557static inline void
@@ -591,7 +591,7 @@ static inline void
591591RCLASS_SET_M_TBL_WORKAROUND (VALUE klass , struct rb_id_table * table , bool check_promoted )
592592{
593593 RUBY_ASSERT (!check_promoted || !RB_OBJ_PROMOTED (klass ));
594- RCLASSEXT_M_TBL (RCLASS_EXT (klass )) = table ;
594+ RCLASSEXT_M_TBL (RCLASS_EXT_PRIME (klass )) = table ;
595595}
596596
597597#define RCLASS_WRITE_M_TBL_EVEN_WHEN_PROMOTED (klass , table ) RCLASS_WRITE_M_TBL_WORKAROUND(klass, table, false)
@@ -609,7 +609,7 @@ RCLASS_WRITE_M_TBL_WORKAROUND(VALUE klass, struct rb_id_table *table, bool check
609609static inline void
610610RCLASS_SET_CONST_TBL (VALUE klass , struct rb_id_table * table , bool shared )
611611{
612- rb_classext_t * ext = RCLASS_EXT (klass );
612+ rb_classext_t * ext = RCLASS_EXT_PRIME (klass );
613613 RCLASSEXT_CONST_TBL (ext ) = table ;
614614 if (shared )
615615 RCLASSEXT_SHARED_CONST_TBL (ext ) = true;
@@ -639,7 +639,7 @@ RCLASS_WRITE_CC_TBL(VALUE klass, struct rb_id_table *table)
639639static inline void
640640RCLASS_SET_CVC_TBL (VALUE klass , struct rb_id_table * table )
641641{
642- RCLASSEXT_CVC_TBL (RCLASS_EXT (klass )) = table ;
642+ RCLASSEXT_CVC_TBL (RCLASS_EXT_PRIME (klass )) = table ;
643643}
644644
645645static inline void
@@ -651,7 +651,7 @@ RCLASS_WRITE_CVC_TBL(VALUE klass, struct rb_id_table *table)
651651static inline void
652652RCLASS_SET_REFINED_CLASS (VALUE klass , VALUE refined )
653653{
654- RB_OBJ_WRITE (klass , & RCLASSEXT_REFINED_CLASS (RCLASS_EXT (klass )), refined );
654+ RB_OBJ_WRITE (klass , & RCLASSEXT_REFINED_CLASS (RCLASS_EXT_PRIME (klass )), refined );
655655}
656656
657657static inline rb_alloc_func_t
@@ -660,20 +660,20 @@ RCLASS_ALLOCATOR(VALUE klass)
660660 if (RCLASS_SINGLETON_P (klass )) {
661661 return 0 ;
662662 }
663- return RCLASS_EXT (klass )-> as .class .allocator ;
663+ return RCLASS_EXT_PRIME (klass )-> as .class .allocator ;
664664}
665665
666666static inline void
667667RCLASS_SET_ALLOCATOR (VALUE klass , rb_alloc_func_t allocator )
668668{
669669 assert (!RCLASS_SINGLETON_P (klass ));
670- RCLASS_EXT (klass )-> as .class .allocator = allocator ; // Allocator is set only on the initial definition
670+ RCLASS_EXT_PRIME (klass )-> as .class .allocator = allocator ; // Allocator is set only on the initial definition
671671}
672672
673673static inline void
674674RCLASS_SET_ORIGIN (VALUE klass , VALUE origin )
675675{
676- rb_classext_t * ext = RCLASS_EXT (klass );
676+ rb_classext_t * ext = RCLASS_EXT_PRIME (klass );
677677 RB_OBJ_WRITE (klass , & RCLASSEXT_ORIGIN (ext ), origin );
678678 if (klass != origin ) RCLASSEXT_ICLASS_IS_ORIGIN (RCLASS_EXT_WRITABLE (origin )) = true;
679679}
@@ -689,7 +689,7 @@ RCLASS_WRITE_ORIGIN(VALUE klass, VALUE origin)
689689static inline void
690690RICLASS_SET_ORIGIN_SHARED_MTBL (VALUE iclass )
691691{
692- RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL (RCLASS_EXT (iclass )) = true;
692+ RCLASSEXT_ICLASS_ORIGIN_SHARED_MTBL (RCLASS_EXT_PRIME (iclass )) = true;
693693}
694694
695695static inline void
@@ -724,7 +724,7 @@ RCLASS_WRITE_SUPERCLASSES(VALUE klass, size_t depth, VALUE *superclasses, bool o
724724static inline void
725725RCLASS_SET_SUBCLASSES (VALUE klass , struct rb_subclass_anchor * anchor )
726726{
727- rb_classext_t * ext = RCLASS_EXT (klass );
727+ rb_classext_t * ext = RCLASS_EXT_PRIME (klass );
728728 RCLASSEXT_SUBCLASSES (ext ) = anchor ;
729729}
730730
@@ -773,14 +773,14 @@ RCLASS_SET_ATTACHED_OBJECT(VALUE klass, VALUE attached_object)
773773{
774774 assert (RCLASS_SINGLETON_P (klass ));
775775
776- RB_OBJ_WRITE (klass , & RCLASS_EXT (klass )-> as .singleton_class .attached_object , attached_object );
776+ RB_OBJ_WRITE (klass , & RCLASS_EXT_PRIME (klass )-> as .singleton_class .attached_object , attached_object );
777777 return attached_object ;
778778}
779779
780780static inline void
781781RCLASS_SET_MAX_IV_COUNT (VALUE klass , attr_index_t count )
782782{
783- RCLASSEXT_MAX_IV_COUNT (RCLASS_EXT (klass )) = count ;
783+ RCLASSEXT_MAX_IV_COUNT (RCLASS_EXT_PRIME (klass )) = count ;
784784}
785785
786786static inline void
@@ -792,7 +792,7 @@ RCLASS_WRITE_MAX_IV_COUNT(VALUE klass, attr_index_t count)
792792static inline void
793793RCLASS_SET_CLONED (VALUE klass , bool cloned )
794794{
795- RCLASSEXT_CLONED (RCLASS_EXT (klass )) = cloned ;
795+ RCLASSEXT_CLONED (RCLASS_EXT_PRIME (klass )) = cloned ;
796796}
797797
798798#endif /* INTERNAL_CLASS_H */
0 commit comments