Skip to content

Commit eba082f

Browse files
committed
Rename imemo_class_fields -> imemo_fields
1 parent 260ac23 commit eba082f

12 files changed

Lines changed: 72 additions & 72 deletions

File tree

class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ rb_class_duplicate_classext(rb_classext_t *orig, VALUE klass, const rb_namespace
298298
RCLASSEXT_M_TBL(ext) = duplicate_classext_m_tbl(RCLASSEXT_M_TBL(orig), klass, dup_iclass);
299299

300300
if (orig->fields_obj) {
301-
RB_OBJ_WRITE(klass, &ext->fields_obj, rb_imemo_class_fields_clone(orig->fields_obj));
301+
RB_OBJ_WRITE(klass, &ext->fields_obj, rb_imemo_fields_clone(orig->fields_obj));
302302
}
303303

304304
if (RCLASSEXT_SHARED_CONST_TBL(orig)) {

debug_counter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ RB_DEBUG_COUNTER(obj_imemo_parser_strterm)
315315
RB_DEBUG_COUNTER(obj_imemo_callinfo)
316316
RB_DEBUG_COUNTER(obj_imemo_callcache)
317317
RB_DEBUG_COUNTER(obj_imemo_constcache)
318-
RB_DEBUG_COUNTER(obj_imemo_class_fields)
318+
RB_DEBUG_COUNTER(obj_imemo_fields)
319319

320320
RB_DEBUG_COUNTER(opt_new_hit)
321321
RB_DEBUG_COUNTER(opt_new_miss)

ext/objspace/objspace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ count_imemo_objects(int argc, VALUE *argv, VALUE self)
504504
INIT_IMEMO_TYPE_ID(imemo_callinfo);
505505
INIT_IMEMO_TYPE_ID(imemo_callcache);
506506
INIT_IMEMO_TYPE_ID(imemo_constcache);
507-
INIT_IMEMO_TYPE_ID(imemo_class_fields);
507+
INIT_IMEMO_TYPE_ID(imemo_fields);
508508
#undef INIT_IMEMO_TYPE_ID
509509
}
510510

imemo.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rb_imemo_name(enum imemo_type type)
3030
IMEMO_NAME(svar);
3131
IMEMO_NAME(throw_data);
3232
IMEMO_NAME(tmpbuf);
33-
IMEMO_NAME(class_fields);
33+
IMEMO_NAME(fields);
3434
#undef IMEMO_NAME
3535
}
3636
rb_bug("unreachable");
@@ -111,58 +111,58 @@ rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt)
111111
}
112112

113113
static VALUE
114-
imemo_class_fields_new(VALUE klass, size_t capa)
114+
imemo_fields_new(VALUE klass, size_t capa)
115115
{
116-
size_t embedded_size = offsetof(struct rb_class_fields, as.embed) + capa * sizeof(VALUE);
116+
size_t embedded_size = offsetof(struct rb_fields, as.embed) + capa * sizeof(VALUE);
117117
if (rb_gc_size_allocatable_p(embedded_size)) {
118-
VALUE fields = rb_imemo_new(imemo_class_fields, klass, embedded_size);
119-
RUBY_ASSERT(IMEMO_TYPE_P(fields, imemo_class_fields));
118+
VALUE fields = rb_imemo_new(imemo_fields, klass, embedded_size);
119+
RUBY_ASSERT(IMEMO_TYPE_P(fields, imemo_fields));
120120
return fields;
121121
}
122122
else {
123-
VALUE fields = rb_imemo_new(imemo_class_fields, klass, sizeof(struct rb_class_fields));
123+
VALUE fields = rb_imemo_new(imemo_fields, klass, sizeof(struct rb_fields));
124124
FL_SET_RAW(fields, OBJ_FIELD_EXTERNAL);
125125
IMEMO_OBJ_FIELDS(fields)->as.external.ptr = ALLOC_N(VALUE, capa);
126126
return fields;
127127
}
128128
}
129129

130130
VALUE
131-
rb_imemo_class_fields_new(VALUE klass, size_t capa)
131+
rb_imemo_fields_new(VALUE klass, size_t capa)
132132
{
133-
return imemo_class_fields_new(rb_singleton_class(klass), capa);
133+
return imemo_fields_new(rb_singleton_class(klass), capa);
134134
}
135135

136136
static VALUE
137-
imemo_class_fields_new_complex(VALUE klass, size_t capa)
137+
imemo_fields_new_complex(VALUE klass, size_t capa)
138138
{
139-
VALUE fields = imemo_class_fields_new(klass, sizeof(struct rb_class_fields));
139+
VALUE fields = imemo_fields_new(klass, sizeof(struct rb_fields));
140140
IMEMO_OBJ_FIELDS(fields)->as.complex.table = st_init_numtable_with_size(capa);
141141
return fields;
142142
}
143143

144144
VALUE
145-
rb_imemo_class_fields_new_complex(VALUE klass, size_t capa)
145+
rb_imemo_fields_new_complex(VALUE klass, size_t capa)
146146
{
147-
return imemo_class_fields_new_complex(rb_singleton_class(klass), capa);
147+
return imemo_fields_new_complex(rb_singleton_class(klass), capa);
148148
}
149149

150150
VALUE
151-
rb_imemo_class_fields_clone(VALUE fields_obj)
151+
rb_imemo_fields_clone(VALUE fields_obj)
152152
{
153153
shape_id_t shape_id = RBASIC_SHAPE_ID(fields_obj);
154154
VALUE clone;
155155

156156
if (rb_shape_too_complex_p(shape_id)) {
157-
clone = rb_imemo_class_fields_new_complex(CLASS_OF(fields_obj), 0);
157+
clone = rb_imemo_fields_new_complex(CLASS_OF(fields_obj), 0);
158158
RBASIC_SET_SHAPE_ID(clone, shape_id);
159-
st_table *src_table = rb_imemo_class_fields_complex_tbl(fields_obj);
160-
st_replace(rb_imemo_class_fields_complex_tbl(clone), src_table);
159+
st_table *src_table = rb_imemo_fields_complex_tbl(fields_obj);
160+
st_replace(rb_imemo_fields_complex_tbl(clone), src_table);
161161
}
162162
else {
163-
clone = imemo_class_fields_new(CLASS_OF(fields_obj), RSHAPE_CAPACITY(shape_id));
163+
clone = imemo_fields_new(CLASS_OF(fields_obj), RSHAPE_CAPACITY(shape_id));
164164
RBASIC_SET_SHAPE_ID(clone, shape_id);
165-
MEMCPY(rb_imemo_class_fields_ptr(clone), rb_imemo_class_fields_ptr(fields_obj), VALUE, RSHAPE_LEN(shape_id));
165+
MEMCPY(rb_imemo_fields_ptr(clone), rb_imemo_fields_ptr(fields_obj), VALUE, RSHAPE_LEN(shape_id));
166166
}
167167

168168
return clone;
@@ -215,7 +215,7 @@ rb_imemo_memsize(VALUE obj)
215215
size += ((rb_imemo_tmpbuf_t *)obj)->cnt * sizeof(VALUE);
216216

217217
break;
218-
case imemo_class_fields:
218+
case imemo_fields:
219219
if (rb_shape_obj_too_complex_p(obj)) {
220220
size += st_memsize(IMEMO_OBJ_FIELDS(obj)->as.complex.table);
221221
}
@@ -487,11 +487,11 @@ rb_imemo_mark_and_move(VALUE obj, bool reference_updating)
487487

488488
break;
489489
}
490-
case imemo_class_fields: {
490+
case imemo_fields: {
491491
rb_gc_mark_and_move((VALUE *)&RBASIC(obj)->klass);
492492

493493
if (rb_shape_obj_too_complex_p(obj)) {
494-
st_table *tbl = rb_imemo_class_fields_complex_tbl(obj);
494+
st_table *tbl = rb_imemo_fields_complex_tbl(obj);
495495
if (reference_updating) {
496496
rb_gc_ref_update_table_values_only(tbl);
497497
}
@@ -500,7 +500,7 @@ rb_imemo_mark_and_move(VALUE obj, bool reference_updating)
500500
}
501501
}
502502
else {
503-
VALUE *fields = rb_imemo_class_fields_ptr(obj);
503+
VALUE *fields = rb_imemo_fields_ptr(obj);
504504
attr_index_t len = RSHAPE_LEN(RBASIC_SHAPE_ID(obj));
505505
for (attr_index_t i = 0; i < len; i++) {
506506
rb_gc_mark_and_move(&fields[i]);
@@ -602,7 +602,7 @@ rb_cc_tbl_free(struct rb_id_table *cc_tbl, VALUE klass)
602602
}
603603

604604
static inline void
605-
imemo_class_fields_free(struct rb_class_fields *fields)
605+
imemo_fields_free(struct rb_fields *fields)
606606
{
607607
if (rb_shape_obj_too_complex_p((VALUE)fields)) {
608608
st_free_table(fields->as.complex.table);
@@ -686,9 +686,9 @@ rb_imemo_free(VALUE obj)
686686
RB_DEBUG_COUNTER_INC(obj_imemo_tmpbuf);
687687

688688
break;
689-
case imemo_class_fields:
690-
imemo_class_fields_free(IMEMO_OBJ_FIELDS(obj));
691-
RB_DEBUG_COUNTER_INC(obj_imemo_class_fields);
689+
case imemo_fields:
690+
imemo_fields_free(IMEMO_OBJ_FIELDS(obj));
691+
RB_DEBUG_COUNTER_INC(obj_imemo_fields);
692692
break;
693693
default:
694694
rb_bug("unreachable");

internal/class.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ RCLASS_WRITABLE_ENSURE_FIELDS_OBJ(VALUE obj)
526526
RUBY_ASSERT(RB_TYPE_P(obj, RUBY_T_CLASS) || RB_TYPE_P(obj, RUBY_T_MODULE));
527527
rb_classext_t *ext = RCLASS_EXT_WRITABLE(obj);
528528
if (!ext->fields_obj) {
529-
RB_OBJ_WRITE(obj, &ext->fields_obj, rb_imemo_class_fields_new(obj, 1));
529+
RB_OBJ_WRITE(obj, &ext->fields_obj, rb_imemo_fields_new(obj, 1));
530530
}
531531
return ext->fields_obj;
532532
}
@@ -564,7 +564,7 @@ RCLASS_FIELDS_COUNT(VALUE obj)
564564
VALUE fields_obj = RCLASS_WRITABLE_FIELDS_OBJ(obj);
565565
if (fields_obj) {
566566
if (rb_shape_obj_too_complex_p(fields_obj)) {
567-
return (uint32_t)rb_st_table_size(rb_imemo_class_fields_complex_tbl(fields_obj));
567+
return (uint32_t)rb_st_table_size(rb_imemo_fields_complex_tbl(fields_obj));
568568
}
569569
else {
570570
return RSHAPE_LEN(RBASIC_SHAPE_ID(fields_obj));

internal/imemo.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ enum imemo_type {
4242
imemo_callinfo = 11,
4343
imemo_callcache = 12,
4444
imemo_constcache = 13,
45-
imemo_class_fields = 14,
45+
imemo_fields = 14,
4646
};
4747

4848
/* CREF (Class REFerence) is defined in method.h */
@@ -258,7 +258,7 @@ MEMO_V2_SET(struct MEMO *m, VALUE v)
258258
RB_OBJ_WRITE(m, &m->v2, v);
259259
}
260260

261-
struct rb_class_fields {
261+
struct rb_fields {
262262
struct RBasic basic;
263263
union {
264264
struct {
@@ -276,20 +276,20 @@ struct rb_class_fields {
276276
};
277277

278278
#define OBJ_FIELD_EXTERNAL IMEMO_FL_USER0
279-
#define IMEMO_OBJ_FIELDS(fields) ((struct rb_class_fields *)fields)
279+
#define IMEMO_OBJ_FIELDS(fields) ((struct rb_fields *)fields)
280280

281-
VALUE rb_imemo_class_fields_new(VALUE klass, size_t capa);
282-
VALUE rb_imemo_class_fields_new_complex(VALUE klass, size_t capa);
283-
VALUE rb_imemo_class_fields_clone(VALUE fields_obj);
281+
VALUE rb_imemo_fields_new(VALUE klass, size_t capa);
282+
VALUE rb_imemo_fields_new_complex(VALUE klass, size_t capa);
283+
VALUE rb_imemo_fields_clone(VALUE fields_obj);
284284

285285
static inline VALUE *
286-
rb_imemo_class_fields_ptr(VALUE obj_fields)
286+
rb_imemo_fields_ptr(VALUE obj_fields)
287287
{
288288
if (!obj_fields) {
289289
return NULL;
290290
}
291291

292-
RUBY_ASSERT(IMEMO_TYPE_P(obj_fields, imemo_class_fields));
292+
RUBY_ASSERT(IMEMO_TYPE_P(obj_fields, imemo_fields));
293293

294294
if (RB_UNLIKELY(FL_TEST_RAW(obj_fields, OBJ_FIELD_EXTERNAL))) {
295295
return IMEMO_OBJ_FIELDS(obj_fields)->as.external.ptr;
@@ -300,13 +300,13 @@ rb_imemo_class_fields_ptr(VALUE obj_fields)
300300
}
301301

302302
static inline st_table *
303-
rb_imemo_class_fields_complex_tbl(VALUE obj_fields)
303+
rb_imemo_fields_complex_tbl(VALUE obj_fields)
304304
{
305305
if (!obj_fields) {
306306
return NULL;
307307
}
308308

309-
RUBY_ASSERT(IMEMO_TYPE_P(obj_fields, imemo_class_fields));
309+
RUBY_ASSERT(IMEMO_TYPE_P(obj_fields, imemo_fields));
310310

311311
return IMEMO_OBJ_FIELDS(obj_fields)->as.complex.table;
312312
}

shape.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ shape_get_next(rb_shape_t *shape, VALUE obj, ID id, bool emit_warnings)
877877
#endif
878878

879879
VALUE klass;
880-
if (IMEMO_TYPE_P(obj, imemo_class_fields)) { // HACK
880+
if (IMEMO_TYPE_P(obj, imemo_fields)) { // HACK
881881
klass = CLASS_OF(obj);
882882
}
883883
else {

shape.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static inline shape_id_t
111111
RBASIC_SHAPE_ID(VALUE obj)
112112
{
113113
RUBY_ASSERT(!RB_SPECIAL_CONST_P(obj));
114-
RUBY_ASSERT(!RB_TYPE_P(obj, T_IMEMO) || IMEMO_TYPE_P(obj, imemo_class_fields));
114+
RUBY_ASSERT(!RB_TYPE_P(obj, T_IMEMO) || IMEMO_TYPE_P(obj, imemo_fields));
115115
#if RBASIC_SHAPE_ID_FIELD
116116
return (shape_id_t)((RBASIC(obj)->shape_id));
117117
#else
@@ -135,7 +135,7 @@ static inline void
135135
RBASIC_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
136136
{
137137
RUBY_ASSERT(!RB_SPECIAL_CONST_P(obj));
138-
RUBY_ASSERT(!RB_TYPE_P(obj, T_IMEMO) || IMEMO_TYPE_P(obj, imemo_class_fields));
138+
RUBY_ASSERT(!RB_TYPE_P(obj, T_IMEMO) || IMEMO_TYPE_P(obj, imemo_fields));
139139
#if RBASIC_SHAPE_ID_FIELD
140140
RBASIC(obj)->shape_id = (VALUE)shape_id;
141141
#else

0 commit comments

Comments
 (0)