@@ -1267,13 +1267,13 @@ rb_gc_obj_free(void *objspace, VALUE obj)
12671267 case T_OBJECT :
12681268 if (rb_shape_obj_too_complex (obj )) {
12691269 RB_DEBUG_COUNTER_INC (obj_obj_too_complex );
1270- st_free_table (ROBJECT_IV_HASH (obj ));
1270+ st_free_table (ROBJECT_FIELDS_HASH (obj ));
12711271 }
12721272 else if (RBASIC (obj )-> flags & ROBJECT_EMBED ) {
12731273 RB_DEBUG_COUNTER_INC (obj_obj_embed );
12741274 }
12751275 else {
1276- xfree (ROBJECT (obj )-> as .heap .ivptr );
1276+ xfree (ROBJECT (obj )-> as .heap .fields );
12771277 RB_DEBUG_COUNTER_INC (obj_obj_ptr );
12781278 }
12791279 break ;
@@ -1282,10 +1282,10 @@ rb_gc_obj_free(void *objspace, VALUE obj)
12821282 rb_id_table_free (RCLASS_M_TBL (obj ));
12831283 rb_cc_table_free (obj );
12841284 if (rb_shape_obj_too_complex (obj )) {
1285- st_free_table ((st_table * )RCLASS_IVPTR (obj ));
1285+ st_free_table ((st_table * )RCLASS_FIELDS (obj ));
12861286 }
12871287 else {
1288- xfree (RCLASS_IVPTR (obj ));
1288+ xfree (RCLASS_FIELDS (obj ));
12891289 }
12901290
12911291 if (RCLASS_CONST_TBL (obj )) {
@@ -1925,10 +1925,10 @@ rb_obj_memsize_of(VALUE obj)
19251925 switch (BUILTIN_TYPE (obj )) {
19261926 case T_OBJECT :
19271927 if (rb_shape_obj_too_complex (obj )) {
1928- size += rb_st_memsize (ROBJECT_IV_HASH (obj ));
1928+ size += rb_st_memsize (ROBJECT_FIELDS_HASH (obj ));
19291929 }
19301930 else if (!(RBASIC (obj )-> flags & ROBJECT_EMBED )) {
1931- size += ROBJECT_IV_CAPACITY (obj ) * sizeof (VALUE );
1931+ size += ROBJECT_FIELDS_CAPACITY (obj ) * sizeof (VALUE );
19321932 }
19331933 break ;
19341934 case T_MODULE :
@@ -1937,7 +1937,7 @@ rb_obj_memsize_of(VALUE obj)
19371937 size += rb_id_table_memsize (RCLASS_M_TBL (obj ));
19381938 }
19391939 // class IV sizes are allocated as powers of two
1940- size += SIZEOF_VALUE << bit_length (RCLASS_IV_COUNT (obj ));
1940+ size += SIZEOF_VALUE << bit_length (RCLASS_FIELDS_COUNT (obj ));
19411941 if (RCLASS_CVC_TBL (obj )) {
19421942 size += rb_id_table_memsize (RCLASS_CVC_TBL (obj ));
19431943 }
@@ -2713,11 +2713,11 @@ rb_gc_mark_children(void *objspace, VALUE obj)
27132713 mark_cvc_tbl (objspace , obj );
27142714 rb_cc_table_mark (obj );
27152715 if (rb_shape_obj_too_complex (obj )) {
2716- gc_mark_tbl_no_pin ((st_table * )RCLASS_IVPTR (obj ));
2716+ gc_mark_tbl_no_pin ((st_table * )RCLASS_FIELDS (obj ));
27172717 }
27182718 else {
2719- for (attr_index_t i = 0 ; i < RCLASS_IV_COUNT (obj ); i ++ ) {
2720- gc_mark_internal (RCLASS_IVPTR (obj )[i ]);
2719+ for (attr_index_t i = 0 ; i < RCLASS_FIELDS_COUNT (obj ); i ++ ) {
2720+ gc_mark_internal (RCLASS_FIELDS (obj )[i ]);
27212721 }
27222722 }
27232723
@@ -2802,12 +2802,12 @@ rb_gc_mark_children(void *objspace, VALUE obj)
28022802 rb_shape_t * shape = rb_shape_get_shape_by_id (ROBJECT_SHAPE_ID (obj ));
28032803
28042804 if (rb_shape_obj_too_complex (obj )) {
2805- gc_mark_tbl_no_pin (ROBJECT_IV_HASH (obj ));
2805+ gc_mark_tbl_no_pin (ROBJECT_FIELDS_HASH (obj ));
28062806 }
28072807 else {
2808- const VALUE * const ptr = ROBJECT_IVPTR (obj );
2808+ const VALUE * const ptr = ROBJECT_FIELDS (obj );
28092809
2810- uint32_t len = ROBJECT_IV_COUNT (obj );
2810+ uint32_t len = ROBJECT_FIELDS_COUNT (obj );
28112811 for (uint32_t i = 0 ; i < len ; i ++ ) {
28122812 gc_mark_internal (ptr [i ]);
28132813 }
@@ -2817,7 +2817,7 @@ rb_gc_mark_children(void *objspace, VALUE obj)
28172817 VALUE klass = RBASIC_CLASS (obj );
28182818
28192819 // Increment max_iv_count if applicable, used to determine size pool allocation
2820- attr_index_t num_of_ivs = shape -> next_iv_index ;
2820+ attr_index_t num_of_ivs = shape -> next_field_index ;
28212821 if (RCLASS_EXT (klass )-> max_iv_count < num_of_ivs ) {
28222822 RCLASS_EXT (klass )-> max_iv_count = num_of_ivs ;
28232823 }
@@ -2893,7 +2893,7 @@ rb_gc_obj_optimal_size(VALUE obj)
28932893 return sizeof (struct RObject );
28942894 }
28952895 else {
2896- return rb_obj_embedded_size (ROBJECT_IV_CAPACITY (obj ));
2896+ return rb_obj_embedded_size (ROBJECT_FIELDS_CAPACITY (obj ));
28972897 }
28982898
28992899 case T_STRING :
@@ -3129,24 +3129,24 @@ gc_ref_update_array(void *objspace, VALUE v)
31293129static void
31303130gc_ref_update_object (void * objspace , VALUE v )
31313131{
3132- VALUE * ptr = ROBJECT_IVPTR (v );
3132+ VALUE * ptr = ROBJECT_FIELDS (v );
31333133
31343134 if (rb_shape_obj_too_complex (v )) {
3135- gc_ref_update_table_values_only (ROBJECT_IV_HASH (v ));
3135+ gc_ref_update_table_values_only (ROBJECT_FIELDS_HASH (v ));
31363136 return ;
31373137 }
31383138
31393139 size_t slot_size = rb_gc_obj_slot_size (v );
3140- size_t embed_size = rb_obj_embedded_size (ROBJECT_IV_CAPACITY (v ));
3140+ size_t embed_size = rb_obj_embedded_size (ROBJECT_FIELDS_CAPACITY (v ));
31413141 if (slot_size >= embed_size && !RB_FL_TEST_RAW (v , ROBJECT_EMBED )) {
31423142 // Object can be re-embedded
3143- memcpy (ROBJECT (v )-> as .ary , ptr , sizeof (VALUE ) * ROBJECT_IV_COUNT (v ));
3143+ memcpy (ROBJECT (v )-> as .ary , ptr , sizeof (VALUE ) * ROBJECT_FIELDS_COUNT (v ));
31443144 RB_FL_SET_RAW (v , ROBJECT_EMBED );
31453145 xfree (ptr );
31463146 ptr = ROBJECT (v )-> as .ary ;
31473147 }
31483148
3149- for (uint32_t i = 0 ; i < ROBJECT_IV_COUNT (v ); i ++ ) {
3149+ for (uint32_t i = 0 ; i < ROBJECT_FIELDS_COUNT (v ); i ++ ) {
31503150 UPDATE_IF_MOVED (objspace , ptr [i ]);
31513151 }
31523152}
@@ -3427,17 +3427,17 @@ vm_weak_table_foreach_update_weak_value(st_data_t *key, st_data_t *value, st_dat
34273427}
34283428
34293429static void
3430- free_gen_ivtbl (VALUE obj , struct gen_ivtbl * ivtbl )
3430+ free_gen_fields_tbl (VALUE obj , struct gen_fields_tbl * fields_tbl )
34313431{
34323432 if (UNLIKELY (rb_shape_obj_too_complex (obj ))) {
3433- st_free_table (ivtbl -> as .complex .table );
3433+ st_free_table (fields_tbl -> as .complex .table );
34343434 }
34353435
3436- xfree (ivtbl );
3436+ xfree (fields_tbl );
34373437}
34383438
34393439static int
3440- vm_weak_table_gen_ivar_foreach_too_complex_i (st_data_t _key , st_data_t value , st_data_t data , int error )
3440+ vm_weak_table_gen_fields_foreach_too_complex_i (st_data_t _key , st_data_t value , st_data_t data , int error )
34413441{
34423442 struct global_vm_table_foreach_data * iter_data = (struct global_vm_table_foreach_data * )data ;
34433443
@@ -3449,7 +3449,7 @@ vm_weak_table_gen_ivar_foreach_too_complex_i(st_data_t _key, st_data_t value, st
34493449}
34503450
34513451static int
3452- vm_weak_table_gen_ivar_foreach_too_complex_replace_i (st_data_t * _key , st_data_t * value , st_data_t data , int existing )
3452+ vm_weak_table_gen_fields_foreach_too_complex_replace_i (st_data_t * _key , st_data_t * value , st_data_t data , int existing )
34533453{
34543454 struct global_vm_table_foreach_data * iter_data = (struct global_vm_table_foreach_data * )data ;
34553455
@@ -3458,10 +3458,10 @@ vm_weak_table_gen_ivar_foreach_too_complex_replace_i(st_data_t *_key, st_data_t
34583458 return iter_data -> update_callback ((VALUE * )value , iter_data -> data );
34593459}
34603460
3461- struct st_table * rb_generic_ivtbl_get (void );
3461+ struct st_table * rb_generic_fields_tbl_get (void );
34623462
34633463static int
3464- vm_weak_table_gen_ivar_foreach (st_data_t key , st_data_t value , st_data_t data )
3464+ vm_weak_table_gen_fields_foreach (st_data_t key , st_data_t value , st_data_t data )
34653465{
34663466 struct global_vm_table_foreach_data * iter_data = (struct global_vm_table_foreach_data * )data ;
34673467
@@ -3472,7 +3472,7 @@ vm_weak_table_gen_ivar_foreach(st_data_t key, st_data_t value, st_data_t data)
34723472 break ;
34733473
34743474 case ST_DELETE :
3475- free_gen_ivtbl ((VALUE )key , (struct gen_ivtbl * )value );
3475+ free_gen_fields_tbl ((VALUE )key , (struct gen_fields_tbl * )value );
34763476
34773477 FL_UNSET ((VALUE )key , FL_EXIVAR );
34783478 return ST_DELETE ;
@@ -3483,7 +3483,7 @@ vm_weak_table_gen_ivar_foreach(st_data_t key, st_data_t value, st_data_t data)
34833483 if (key != new_key ) ret = ST_DELETE ;
34843484 DURING_GC_COULD_MALLOC_REGION_START ();
34853485 {
3486- st_insert (rb_generic_ivtbl_get (), (st_data_t )new_key , value );
3486+ st_insert (rb_generic_fields_tbl_get (), (st_data_t )new_key , value );
34873487 }
34883488 DURING_GC_COULD_MALLOC_REGION_END ();
34893489 key = (st_data_t )new_key ;
@@ -3495,29 +3495,29 @@ vm_weak_table_gen_ivar_foreach(st_data_t key, st_data_t value, st_data_t data)
34953495 }
34963496
34973497 if (!iter_data -> weak_only ) {
3498- struct gen_ivtbl * ivtbl = (struct gen_ivtbl * )value ;
3498+ struct gen_fields_tbl * fields_tbl = (struct gen_fields_tbl * )value ;
34993499
35003500 if (rb_shape_obj_too_complex ((VALUE )key )) {
35013501 st_foreach_with_replace (
3502- ivtbl -> as .complex .table ,
3503- vm_weak_table_gen_ivar_foreach_too_complex_i ,
3504- vm_weak_table_gen_ivar_foreach_too_complex_replace_i ,
3502+ fields_tbl -> as .complex .table ,
3503+ vm_weak_table_gen_fields_foreach_too_complex_i ,
3504+ vm_weak_table_gen_fields_foreach_too_complex_replace_i ,
35053505 data
35063506 );
35073507 }
35083508 else {
3509- for (uint32_t i = 0 ; i < ivtbl -> as .shape .numiv ; i ++ ) {
3510- if (SPECIAL_CONST_P (ivtbl -> as .shape .ivptr [i ])) continue ;
3509+ for (uint32_t i = 0 ; i < fields_tbl -> as .shape .fields_count ; i ++ ) {
3510+ if (SPECIAL_CONST_P (fields_tbl -> as .shape .fields [i ])) continue ;
35113511
3512- int ivar_ret = iter_data -> callback (ivtbl -> as .shape .ivptr [i ], iter_data -> data );
3512+ int ivar_ret = iter_data -> callback (fields_tbl -> as .shape .fields [i ], iter_data -> data );
35133513 switch (ivar_ret ) {
35143514 case ST_CONTINUE :
35153515 break ;
35163516 case ST_REPLACE :
3517- iter_data -> update_callback (& ivtbl -> as .shape .ivptr [i ], iter_data -> data );
3517+ iter_data -> update_callback (& fields_tbl -> as .shape .fields [i ], iter_data -> data );
35183518 break ;
35193519 default :
3520- rb_bug ("vm_weak_table_gen_ivar_foreach : return value %d not supported" , ivar_ret );
3520+ rb_bug ("vm_weak_table_gen_fields_foreach : return value %d not supported" , ivar_ret );
35213521 }
35223522 }
35233523 }
@@ -3587,12 +3587,12 @@ rb_gc_vm_weak_table_foreach(vm_table_foreach_callback_func callback,
35873587 }
35883588 break ;
35893589 }
3590- case RB_GC_VM_GENERIC_IV_TABLE : {
3591- st_table * generic_iv_tbl = rb_generic_ivtbl_get ();
3592- if (generic_iv_tbl ) {
3590+ case RB_GC_VM_GENERIC_FIELDS_TABLE : {
3591+ st_table * generic_fields_tbl = rb_generic_fields_tbl_get ();
3592+ if (generic_fields_tbl ) {
35933593 st_foreach (
3594- generic_iv_tbl ,
3595- vm_weak_table_gen_ivar_foreach ,
3594+ generic_fields_tbl ,
3595+ vm_weak_table_gen_fields_foreach ,
35963596 (st_data_t )& foreach_data
35973597 );
35983598 }
@@ -3649,11 +3649,11 @@ rb_gc_update_object_references(void *objspace, VALUE obj)
36493649 update_superclasses (objspace , obj );
36503650
36513651 if (rb_shape_obj_too_complex (obj )) {
3652- gc_ref_update_table_values_only (RCLASS_IV_HASH (obj ));
3652+ gc_ref_update_table_values_only (RCLASS_FIELDS_HASH (obj ));
36533653 }
36543654 else {
3655- for (attr_index_t i = 0 ; i < RCLASS_IV_COUNT (obj ); i ++ ) {
3656- UPDATE_IF_MOVED (objspace , RCLASS_IVPTR (obj )[i ]);
3655+ for (attr_index_t i = 0 ; i < RCLASS_FIELDS_COUNT (obj ); i ++ ) {
3656+ UPDATE_IF_MOVED (objspace , RCLASS_FIELDS (obj )[i ]);
36573657 }
36583658 }
36593659
@@ -4336,17 +4336,17 @@ rb_raw_obj_info_buitin_type(char *const buff, const size_t buff_size, const VALU
43364336 case T_OBJECT :
43374337 {
43384338 if (rb_shape_obj_too_complex (obj )) {
4339- size_t hash_len = rb_st_table_size (ROBJECT_IV_HASH (obj ));
4339+ size_t hash_len = rb_st_table_size (ROBJECT_FIELDS_HASH (obj ));
43404340 APPEND_F ("(too_complex) len:%zu" , hash_len );
43414341 }
43424342 else {
4343- uint32_t len = ROBJECT_IV_CAPACITY (obj );
4343+ uint32_t len = ROBJECT_FIELDS_CAPACITY (obj );
43444344
43454345 if (RBASIC (obj )-> flags & ROBJECT_EMBED ) {
43464346 APPEND_F ("(embed) len:%d" , len );
43474347 }
43484348 else {
4349- VALUE * ptr = ROBJECT_IVPTR (obj );
4349+ VALUE * ptr = ROBJECT_FIELDS (obj );
43504350 APPEND_F ("len:%d ptr:%p" , len , (void * )ptr );
43514351 }
43524352 }
0 commit comments