mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Get rid of FL_EXIVAR
Now that the shape_id gives us all the same information, it's no longer needed.
This commit is contained in:
parent
6dbe24fe56
commit
15084fbc3c
Notes:
git
2025-06-13 21:50:43 +00:00
10 changed files with 29 additions and 48 deletions
|
@ -220,7 +220,7 @@ assert_equal 'Sub', %q{
|
|||
call(Sub.new('o')).class
|
||||
}
|
||||
|
||||
# String#dup with FL_EXIVAR
|
||||
# String#dup with generic ivars
|
||||
assert_equal '["str", "ivar"]', %q{
|
||||
def str_dup(str) = str.dup
|
||||
str = "str"
|
||||
|
|
2
gc.c
2
gc.c
|
@ -4010,8 +4010,6 @@ vm_weak_table_gen_fields_foreach(st_data_t key, st_data_t value, st_data_t data)
|
|||
|
||||
case ST_DELETE:
|
||||
free_gen_fields_tbl((VALUE)key, (struct gen_fields_tbl *)value);
|
||||
|
||||
FL_UNSET((VALUE)key, FL_EXIVAR);
|
||||
RBASIC_SET_SHAPE_ID((VALUE)key, ROOT_SHAPE_ID);
|
||||
return ST_DELETE;
|
||||
|
||||
|
|
|
@ -248,6 +248,21 @@ ruby_fl_type {
|
|||
RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea."))
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma deprecated(RUBY_FL_TAINT)
|
||||
#endif
|
||||
|
||||
= 0,
|
||||
|
||||
/**
|
||||
* @deprecated This flag was an implementation detail that should never have
|
||||
* no been exposed. Exists here for backwards
|
||||
* compatibility only. You can safely forget about it.
|
||||
*/
|
||||
RUBY_FL_EXIVAR
|
||||
|
||||
#if defined(RBIMPL_HAVE_ENUM_ATTRIBUTE)
|
||||
RBIMPL_ATTR_DEPRECATED(("FL_EXIVAR is an outdated implementation detail, it shoudl be used."))
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma deprecated(RUBY_FL_EXIVAR)
|
||||
#endif
|
||||
|
||||
= 0,
|
||||
|
@ -286,18 +301,12 @@ ruby_fl_type {
|
|||
*/
|
||||
RUBY_FL_UNUSED9 = (1<<9),
|
||||
|
||||
/**
|
||||
* This flag has something to do with instance variables. 3rd parties need
|
||||
* not know, but there are several ways to store an object's instance
|
||||
* variables. Objects with this flag use so-called "generic" backend
|
||||
* storage. This distinction is purely an implementation detail. People
|
||||
* need not be aware of this working behind-the-scene.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* As of writing everything except ::RObject and RModule use this scheme.
|
||||
*/
|
||||
RUBY_FL_EXIVAR = (1<<10),
|
||||
/**
|
||||
* This flag is no longer in use
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
RUBY_FL_UNUSED10 = (1<<10),
|
||||
|
||||
/**
|
||||
* This flag has something to do with data immutability. When this flag is
|
||||
|
@ -399,7 +408,7 @@ enum {
|
|||
# pragma deprecated(RUBY_FL_DUPPED)
|
||||
#endif
|
||||
|
||||
= (int)RUBY_T_MASK | (int)RUBY_FL_EXIVAR
|
||||
= (int)RUBY_T_MASK
|
||||
};
|
||||
|
||||
#undef RBIMPL_HAVE_ENUM_ATTRIBUTE
|
||||
|
|
|
@ -17,7 +17,7 @@ class PrintFlagsCommand(RbBaseCommand):
|
|||
|
||||
flags = [
|
||||
"RUBY_FL_WB_PROTECTED", "RUBY_FL_PROMOTED", "RUBY_FL_FINALIZE",
|
||||
"RUBY_FL_SHAREABLE", "RUBY_FL_EXIVAR", "RUBY_FL_FREEZE",
|
||||
"RUBY_FL_SHAREABLE", "RUBY_FL_FREEZE",
|
||||
"RUBY_FL_USER0", "RUBY_FL_USER1", "RUBY_FL_USER2", "RUBY_FL_USER3", "RUBY_FL_USER4",
|
||||
"RUBY_FL_USER5", "RUBY_FL_USER6", "RUBY_FL_USER7", "RUBY_FL_USER8", "RUBY_FL_USER9",
|
||||
"RUBY_FL_USER10", "RUBY_FL_USER11", "RUBY_FL_USER12", "RUBY_FL_USER13", "RUBY_FL_USER14",
|
||||
|
|
|
@ -1153,7 +1153,7 @@ typedef struct RNode_ERROR {
|
|||
#define RNODE_FILE(node) ((rb_node_file_t *)(node))
|
||||
#define RNODE_ENCODING(node) ((rb_node_encoding_t *)(node))
|
||||
|
||||
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: UNUSED, 9: UNUSED, 10: EXIVAR, 11: FREEZE */
|
||||
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8..10: UNUSED, 11: FREEZE */
|
||||
/* NODE_FL: 0..4: UNUSED, 5: UNUSED, 6: UNUSED, 7: NODE_FL_NEWLINE,
|
||||
* 8..14: nd_type,
|
||||
* 15..: nd_line
|
||||
|
|
7
shape.c
7
shape.c
|
@ -1266,13 +1266,6 @@ rb_shape_verify_consistency(VALUE obj, shape_id_t shape_id)
|
|||
}
|
||||
}
|
||||
|
||||
if (FL_TEST_RAW(obj, FL_EXIVAR)) {
|
||||
RUBY_ASSERT(rb_obj_exivar_p(obj));
|
||||
}
|
||||
else {
|
||||
RUBY_ASSERT(!rb_obj_exivar_p(obj));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
1
string.c
1
string.c
|
@ -485,7 +485,6 @@ build_fstring(VALUE str, struct fstr_update_arg *arg)
|
|||
RUBY_ASSERT(RB_TYPE_P(str, T_STRING));
|
||||
RUBY_ASSERT(OBJ_FROZEN(str));
|
||||
RUBY_ASSERT(!FL_TEST_RAW(str, STR_FAKESTR));
|
||||
RUBY_ASSERT(!FL_TEST_RAW(str, FL_EXIVAR));
|
||||
RUBY_ASSERT(!rb_obj_exivar_p(str));
|
||||
RUBY_ASSERT(RBASIC_CLASS(str) == rb_cString);
|
||||
RUBY_ASSERT(!rb_objspace_garbage_object_p(str));
|
||||
|
|
20
variable.c
20
variable.c
|
@ -1271,7 +1271,6 @@ rb_free_generic_ivar(VALUE obj)
|
|||
xfree(fields_tbl);
|
||||
}
|
||||
}
|
||||
FL_UNSET_RAW(obj, FL_EXIVAR);
|
||||
RBASIC_SET_SHAPE_ID(obj, ROOT_SHAPE_ID);
|
||||
}
|
||||
}
|
||||
|
@ -1329,7 +1328,6 @@ rb_obj_field_get(VALUE obj, shape_id_t target_shape_id)
|
|||
fields_hash = ROBJECT_FIELDS_HASH(obj);
|
||||
break;
|
||||
default:
|
||||
RUBY_ASSERT(FL_TEST_RAW(obj, FL_EXIVAR));
|
||||
RUBY_ASSERT(rb_obj_exivar_p(obj));
|
||||
struct gen_fields_tbl *fields_tbl = NULL;
|
||||
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)
|
|||
fields = ROBJECT_FIELDS(obj);
|
||||
break;
|
||||
default:
|
||||
RUBY_ASSERT(FL_TEST_RAW(obj, FL_EXIVAR));
|
||||
RUBY_ASSERT(rb_obj_exivar_p(obj));
|
||||
struct gen_fields_tbl *fields_tbl = NULL;
|
||||
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
|
|||
RUBY_ASSERT(RSHAPE_TYPE_P(fields_lookup->shape_id, SHAPE_IVAR) || RSHAPE_TYPE_P(fields_lookup->shape_id, SHAPE_OBJ_ID));
|
||||
RUBY_ASSERT(RSHAPE_CAPACITY(RSHAPE_PARENT(fields_lookup->shape_id)) < RSHAPE_CAPACITY(fields_lookup->shape_id));
|
||||
}
|
||||
else {
|
||||
FL_SET_RAW((VALUE)*k, FL_EXIVAR);
|
||||
}
|
||||
|
||||
fields_tbl = gen_fields_tbl_resize(fields_tbl, RSHAPE_CAPACITY(fields_lookup->shape_id));
|
||||
*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
|
|||
rb_obj_set_shape_id(fields_lookup->obj, fields_lookup->shape_id);
|
||||
}
|
||||
|
||||
RUBY_ASSERT(FL_TEST((VALUE)*k, FL_EXIVAR));
|
||||
RUBY_ASSERT(rb_obj_exivar_p((VALUE)*k));
|
||||
|
||||
return ST_CONTINUE;
|
||||
|
@ -1869,8 +1862,6 @@ generic_ivar_set_shape_fields(VALUE obj, void *data)
|
|||
st_update(generic_fields_tbl(obj, fields_lookup->id, false), (st_data_t)obj, generic_fields_lookup_ensure_size, (st_data_t)fields_lookup);
|
||||
}
|
||||
|
||||
FL_SET_RAW(obj, FL_EXIVAR);
|
||||
|
||||
return fields_lookup->fields_tbl->as.shape.fields;
|
||||
}
|
||||
|
||||
|
@ -1893,7 +1884,6 @@ generic_ivar_set_set_shape_id(VALUE obj, shape_id_t shape_id, void *data)
|
|||
static shape_id_t
|
||||
generic_ivar_set_transition_too_complex(VALUE obj, void *_data)
|
||||
{
|
||||
FL_SET_RAW(obj, FL_EXIVAR);
|
||||
shape_id_t new_shape_id = rb_evict_fields_to_hash(obj);
|
||||
return new_shape_id;
|
||||
}
|
||||
|
@ -1911,8 +1901,6 @@ generic_ivar_set_too_complex_table(VALUE obj, void *data)
|
|||
RB_VM_LOCKING() {
|
||||
st_insert(generic_fields_tbl(obj, fields_lookup->id, false), (st_data_t)obj, (st_data_t)fields_tbl);
|
||||
}
|
||||
|
||||
FL_SET_RAW(obj, FL_EXIVAR);
|
||||
}
|
||||
|
||||
RUBY_ASSERT(rb_shape_obj_too_complex_p(obj));
|
||||
|
@ -2368,8 +2356,6 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
|
|||
if (gen_fields_tbl_count(obj, obj_fields_tbl) == 0)
|
||||
goto clear;
|
||||
|
||||
FL_SET(dest, FL_EXIVAR);
|
||||
|
||||
if (rb_shape_too_complex_p(src_shape_id)) {
|
||||
rb_shape_copy_complex_ivars(dest, obj, src_shape_id, obj_fields_tbl->as.complex.table);
|
||||
return;
|
||||
|
@ -2393,7 +2379,6 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
|
|||
|
||||
if (!RSHAPE_LEN(dest_shape_id)) {
|
||||
rb_obj_set_shape_id(dest, dest_shape_id);
|
||||
FL_UNSET(dest, FL_EXIVAR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2424,15 +2409,10 @@ rb_copy_generic_ivar(VALUE dest, VALUE obj)
|
|||
void
|
||||
rb_replace_generic_ivar(VALUE clone, VALUE obj)
|
||||
{
|
||||
RUBY_ASSERT(FL_TEST(obj, FL_EXIVAR));
|
||||
|
||||
RB_VM_LOCKING() {
|
||||
st_data_t fields_tbl, obj_data = (st_data_t)obj;
|
||||
if (st_delete(generic_fields_tbl_, &obj_data, &fields_tbl)) {
|
||||
FL_UNSET_RAW(obj, FL_EXIVAR);
|
||||
|
||||
st_insert(generic_fields_tbl_, (st_data_t)clone, fields_tbl);
|
||||
FL_SET_RAW(clone, FL_EXIVAR);
|
||||
}
|
||||
else {
|
||||
rb_bug("unreachable");
|
||||
|
|
3
yjit/src/cruby_bindings.inc.rs
generated
3
yjit/src/cruby_bindings.inc.rs
generated
|
@ -225,10 +225,11 @@ pub const RUBY_FL_PROMOTED: ruby_fl_type = 32;
|
|||
pub const RUBY_FL_UNUSED6: ruby_fl_type = 64;
|
||||
pub const RUBY_FL_FINALIZE: ruby_fl_type = 128;
|
||||
pub const RUBY_FL_TAINT: ruby_fl_type = 0;
|
||||
pub const RUBY_FL_EXIVAR: ruby_fl_type = 0;
|
||||
pub const RUBY_FL_SHAREABLE: ruby_fl_type = 256;
|
||||
pub const RUBY_FL_UNTRUSTED: ruby_fl_type = 0;
|
||||
pub const RUBY_FL_UNUSED9: ruby_fl_type = 512;
|
||||
pub const RUBY_FL_EXIVAR: ruby_fl_type = 1024;
|
||||
pub const RUBY_FL_UNUSED10: ruby_fl_type = 1024;
|
||||
pub const RUBY_FL_FREEZE: ruby_fl_type = 2048;
|
||||
pub const RUBY_FL_USER0: ruby_fl_type = 4096;
|
||||
pub const RUBY_FL_USER1: ruby_fl_type = 8192;
|
||||
|
|
3
zjit/src/cruby_bindings.inc.rs
generated
3
zjit/src/cruby_bindings.inc.rs
generated
|
@ -101,10 +101,11 @@ pub const RUBY_FL_PROMOTED: ruby_fl_type = 32;
|
|||
pub const RUBY_FL_UNUSED6: ruby_fl_type = 64;
|
||||
pub const RUBY_FL_FINALIZE: ruby_fl_type = 128;
|
||||
pub const RUBY_FL_TAINT: ruby_fl_type = 0;
|
||||
pub const RUBY_FL_EXIVAR: ruby_fl_type = 0;
|
||||
pub const RUBY_FL_SHAREABLE: ruby_fl_type = 256;
|
||||
pub const RUBY_FL_UNTRUSTED: ruby_fl_type = 0;
|
||||
pub const RUBY_FL_UNUSED9: ruby_fl_type = 512;
|
||||
pub const RUBY_FL_EXIVAR: ruby_fl_type = 1024;
|
||||
pub const RUBY_FL_UNUSED10: ruby_fl_type = 1024;
|
||||
pub const RUBY_FL_FREEZE: ruby_fl_type = 2048;
|
||||
pub const RUBY_FL_USER0: ruby_fl_type = 4096;
|
||||
pub const RUBY_FL_USER1: ruby_fl_type = 8192;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue