Skip to content

Commit 15084fb

Browse files
committed
Get rid of FL_EXIVAR
Now that the shape_id gives us all the same information, it's no longer needed.
1 parent 6dbe24f commit 15084fb

File tree

10 files changed

+29
-48
lines changed

10 files changed

+29
-48
lines changed

bootstraptest/test_yjit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class Sub < String; end
220220
call(Sub.new('o')).class
221221
}
222222

223-
# String#dup with FL_EXIVAR
223+
# String#dup with generic ivars
224224
assert_equal '["str", "ivar"]', %q{
225225
def str_dup(str) = str.dup
226226
str = "str"

gc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4010,8 +4010,6 @@ vm_weak_table_gen_fields_foreach(st_data_t key, st_data_t value, st_data_t data)
40104010

40114011
case ST_DELETE:
40124012
free_gen_fields_tbl((VALUE)key, (struct gen_fields_tbl *)value);
4013-
4014-
FL_UNSET((VALUE)key, FL_EXIVAR);
40154013
RBASIC_SET_SHAPE_ID((VALUE)key, ROOT_SHAPE_ID);
40164014
return ST_DELETE;
40174015

include/ruby/internal/fl_type.h

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,21 @@ ruby_fl_type {
248248
RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea."))
249249
#elif defined(_MSC_VER)
250250
# pragma deprecated(RUBY_FL_TAINT)
251+
#endif
252+
253+
= 0,
254+
255+
/**
256+
* @deprecated This flag was an implementation detail that should never have
257+
* no been exposed. Exists here for backwards
258+
* compatibility only. You can safely forget about it.
259+
*/
260+
RUBY_FL_EXIVAR
261+
262+
#if defined(RBIMPL_HAVE_ENUM_ATTRIBUTE)
263+
RBIMPL_ATTR_DEPRECATED(("FL_EXIVAR is an outdated implementation detail, it shoudl be used."))
264+
#elif defined(_MSC_VER)
265+
# pragma deprecated(RUBY_FL_EXIVAR)
251266
#endif
252267

253268
= 0,
@@ -286,18 +301,12 @@ ruby_fl_type {
286301
*/
287302
RUBY_FL_UNUSED9 = (1<<9),
288303

289-
/**
290-
* This flag has something to do with instance variables. 3rd parties need
291-
* not know, but there are several ways to store an object's instance
292-
* variables. Objects with this flag use so-called "generic" backend
293-
* storage. This distinction is purely an implementation detail. People
294-
* need not be aware of this working behind-the-scene.
295-
*
296-
* @internal
297-
*
298-
* As of writing everything except ::RObject and RModule use this scheme.
299-
*/
300-
RUBY_FL_EXIVAR = (1<<10),
304+
/**
305+
* This flag is no longer in use
306+
*
307+
* @internal
308+
*/
309+
RUBY_FL_UNUSED10 = (1<<10),
301310

302311
/**
303312
* This flag has something to do with data immutability. When this flag is
@@ -399,7 +408,7 @@ enum {
399408
# pragma deprecated(RUBY_FL_DUPPED)
400409
#endif
401410

402-
= (int)RUBY_T_MASK | (int)RUBY_FL_EXIVAR
411+
= (int)RUBY_T_MASK
403412
};
404413

405414
#undef RBIMPL_HAVE_ENUM_ATTRIBUTE

misc/lldb_rb/commands/print_flags_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def call(self, debugger, command, exe_ctx, result):
1717

1818
flags = [
1919
"RUBY_FL_WB_PROTECTED", "RUBY_FL_PROMOTED", "RUBY_FL_FINALIZE",
20-
"RUBY_FL_SHAREABLE", "RUBY_FL_EXIVAR", "RUBY_FL_FREEZE",
20+
"RUBY_FL_SHAREABLE", "RUBY_FL_FREEZE",
2121
"RUBY_FL_USER0", "RUBY_FL_USER1", "RUBY_FL_USER2", "RUBY_FL_USER3", "RUBY_FL_USER4",
2222
"RUBY_FL_USER5", "RUBY_FL_USER6", "RUBY_FL_USER7", "RUBY_FL_USER8", "RUBY_FL_USER9",
2323
"RUBY_FL_USER10", "RUBY_FL_USER11", "RUBY_FL_USER12", "RUBY_FL_USER13", "RUBY_FL_USER14",

rubyparser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ typedef struct RNode_ERROR {
11531153
#define RNODE_FILE(node) ((rb_node_file_t *)(node))
11541154
#define RNODE_ENCODING(node) ((rb_node_encoding_t *)(node))
11551155

1156-
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: UNUSED, 9: UNUSED, 10: EXIVAR, 11: FREEZE */
1156+
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8..10: UNUSED, 11: FREEZE */
11571157
/* NODE_FL: 0..4: UNUSED, 5: UNUSED, 6: UNUSED, 7: NODE_FL_NEWLINE,
11581158
* 8..14: nd_type,
11591159
* 15..: nd_line

shape.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,13 +1266,6 @@ rb_shape_verify_consistency(VALUE obj, shape_id_t shape_id)
12661266
}
12671267
}
12681268

1269-
if (FL_TEST_RAW(obj, FL_EXIVAR)) {
1270-
RUBY_ASSERT(rb_obj_exivar_p(obj));
1271-
}
1272-
else {
1273-
RUBY_ASSERT(!rb_obj_exivar_p(obj));
1274-
}
1275-
12761269
return true;
12771270
}
12781271
#endif

string.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ build_fstring(VALUE str, struct fstr_update_arg *arg)
485485
RUBY_ASSERT(RB_TYPE_P(str, T_STRING));
486486
RUBY_ASSERT(OBJ_FROZEN(str));
487487
RUBY_ASSERT(!FL_TEST_RAW(str, STR_FAKESTR));
488-
RUBY_ASSERT(!FL_TEST_RAW(str, FL_EXIVAR));
489488
RUBY_ASSERT(!rb_obj_exivar_p(str));
490489
RUBY_ASSERT(RBASIC_CLASS(str) == rb_cString);
491490
RUBY_ASSERT(!rb_objspace_garbage_object_p(str));

variable.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,6 @@ rb_free_generic_ivar(VALUE obj)
12711271
xfree(fields_tbl);
12721272
}
12731273
}
1274-
FL_UNSET_RAW(obj, FL_EXIVAR);
12751274
RBASIC_SET_SHAPE_ID(obj, ROOT_SHAPE_ID);
12761275
}
12771276
}
@@ -1329,7 +1328,6 @@ rb_obj_field_get(VALUE obj, shape_id_t target_shape_id)
13291328
fields_hash = ROBJECT_FIELDS_HASH(obj);
13301329
break;
13311330
default:
1332-
RUBY_ASSERT(FL_TEST_RAW(obj, FL_EXIVAR));
13331331
RUBY_ASSERT(rb_obj_exivar_p(obj));
13341332
struct gen_fields_tbl *fields_tbl = NULL;
13351333
rb_ivar_generic_fields_tbl_lookup(obj, &fields_tbl);
@@ -1361,7 +1359,6 @@ rb_obj_field_get(VALUE obj, shape_id_t target_shape_id)
13611359
fields = ROBJECT_FIELDS(obj);
13621360
break;
13631361
default:
1364-
RUBY_ASSERT(FL_TEST_RAW(obj, FL_EXIVAR));
13651362
RUBY_ASSERT(rb_obj_exivar_p(obj));
13661363
struct gen_fields_tbl *fields_tbl = NULL;
13671364
rb_ivar_generic_fields_tbl_lookup(obj, &fields_tbl);
@@ -1839,9 +1836,6 @@ generic_fields_lookup_ensure_size(st_data_t *k, st_data_t *v, st_data_t u, int e
18391836
RUBY_ASSERT(RSHAPE_TYPE_P(fields_lookup->shape_id, SHAPE_IVAR) || RSHAPE_TYPE_P(fields_lookup->shape_id, SHAPE_OBJ_ID));
18401837
RUBY_ASSERT(RSHAPE_CAPACITY(RSHAPE_PARENT(fields_lookup->shape_id)) < RSHAPE_CAPACITY(fields_lookup->shape_id));
18411838
}
1842-
else {
1843-
FL_SET_RAW((VALUE)*k, FL_EXIVAR);
1844-
}
18451839

18461840
fields_tbl = gen_fields_tbl_resize(fields_tbl, RSHAPE_CAPACITY(fields_lookup->shape_id));
18471841
*v = (st_data_t)fields_tbl;
@@ -1852,7 +1846,6 @@ generic_fields_lookup_ensure_size(st_data_t *k, st_data_t *v, st_data_t u, int e
18521846
rb_obj_set_shape_id(fields_lookup->obj, fields_lookup->shape_id);
18531847
}
18541848

1855-
RUBY_ASSERT(FL_TEST((VALUE)*k, FL_EXIVAR));
18561849
RUBY_ASSERT(rb_obj_exivar_p((VALUE)*k));
18571850

18581851
return ST_CONTINUE;
@@ -1869,8 +1862,6 @@ generic_ivar_set_shape_fields(VALUE obj, void *data)
18691862
st_update(generic_fields_tbl(obj, fields_lookup->id, false), (st_data_t)obj, generic_fields_lookup_ensure_size, (st_data_t)fields_lookup);
18701863
}
18711864

1872-
FL_SET_RAW(obj, FL_EXIVAR);
1873-
18741865
return fields_lookup->fields_tbl->as.shape.fields;
18751866
}
18761867

@@ -1893,7 +1884,6 @@ generic_ivar_set_set_shape_id(VALUE obj, shape_id_t shape_id, void *data)
18931884
static shape_id_t
18941885
generic_ivar_set_transition_too_complex(VALUE obj, void *_data)
18951886
{
1896-
FL_SET_RAW(obj, FL_EXIVAR);
18971887
shape_id_t new_shape_id = rb_evict_fields_to_hash(obj);
18981888
return new_shape_id;
18991889
}
@@ -1911,8 +1901,6 @@ generic_ivar_set_too_complex_table(VALUE obj, void *data)
19111901
RB_VM_LOCKING() {
19121902
st_insert(generic_fields_tbl(obj, fields_lookup->id, false), (st_data_t)obj, (st_data_t)fields_tbl);
19131903
}
1914-
1915-
FL_SET_RAW(obj, FL_EXIVAR);
19161904
}
19171905

19181906
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
@@ -2368,8 +2356,6 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
23682356
if (gen_fields_tbl_count(obj, obj_fields_tbl) == 0)
23692357
goto clear;
23702358

2371-
FL_SET(dest, FL_EXIVAR);
2372-
23732359
if (rb_shape_too_complex_p(src_shape_id)) {
23742360
rb_shape_copy_complex_ivars(dest, obj, src_shape_id, obj_fields_tbl->as.complex.table);
23752361
return;
@@ -2393,7 +2379,6 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
23932379

23942380
if (!RSHAPE_LEN(dest_shape_id)) {
23952381
rb_obj_set_shape_id(dest, dest_shape_id);
2396-
FL_UNSET(dest, FL_EXIVAR);
23972382
return;
23982383
}
23992384

@@ -2424,15 +2409,10 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
24242409
void
24252410
rb_replace_generic_ivar(VALUE clone, VALUE obj)
24262411
{
2427-
RUBY_ASSERT(FL_TEST(obj, FL_EXIVAR));
2428-
24292412
RB_VM_LOCKING() {
24302413
st_data_t fields_tbl, obj_data = (st_data_t)obj;
24312414
if (st_delete(generic_fields_tbl_, &obj_data, &fields_tbl)) {
2432-
FL_UNSET_RAW(obj, FL_EXIVAR);
2433-
24342415
st_insert(generic_fields_tbl_, (st_data_t)clone, fields_tbl);
2435-
FL_SET_RAW(clone, FL_EXIVAR);
24362416
}
24372417
else {
24382418
rb_bug("unreachable");

yjit/src/cruby_bindings.inc.rs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zjit/src/cruby_bindings.inc.rs

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)