Bring back RubyVM.stat(:global_constant_state)
This was removed as part of [Feature #18589]. But some applications were relying on this behavior. So bringing this back to make it better for backward compatibility going forward.
This commit is contained in:
parent
ea9c09a92c
commit
42000664be
Notes:
git
2022-04-05 03:41:30 +09:00
4
vm.c
4
vm.c
@ -529,7 +529,7 @@ vm_stat_constant_cache_i(ID id, VALUE table, void *constant_cache)
|
|||||||
static VALUE
|
static VALUE
|
||||||
vm_stat(int argc, VALUE *argv, VALUE self)
|
vm_stat(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
static VALUE sym_constant_cache, sym_class_serial, sym_global_cvar_state;
|
static VALUE sym_global_constant_state, sym_constant_cache, sym_class_serial, sym_global_cvar_state;
|
||||||
VALUE arg = Qnil;
|
VALUE arg = Qnil;
|
||||||
VALUE hash = Qnil, key = Qnil;
|
VALUE hash = Qnil, key = Qnil;
|
||||||
|
|
||||||
@ -547,6 +547,7 @@ vm_stat(int argc, VALUE *argv, VALUE self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
|
#define S(s) sym_##s = ID2SYM(rb_intern_const(#s))
|
||||||
|
S(global_constant_state);
|
||||||
S(constant_cache);
|
S(constant_cache);
|
||||||
S(class_serial);
|
S(class_serial);
|
||||||
S(global_cvar_state);
|
S(global_cvar_state);
|
||||||
@ -558,6 +559,7 @@ vm_stat(int argc, VALUE *argv, VALUE self)
|
|||||||
else if (hash != Qnil) \
|
else if (hash != Qnil) \
|
||||||
rb_hash_aset(hash, sym_##name, SERIALT2NUM(attr));
|
rb_hash_aset(hash, sym_##name, SERIALT2NUM(attr));
|
||||||
|
|
||||||
|
SET(global_constant_state, ruby_vm_global_constant_state);
|
||||||
SET(class_serial, ruby_vm_class_serial);
|
SET(class_serial, ruby_vm_class_serial);
|
||||||
SET(global_cvar_state, ruby_vm_global_cvar_state);
|
SET(global_cvar_state, ruby_vm_global_cvar_state);
|
||||||
#undef SET
|
#undef SET
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
MJIT_SYMBOL_EXPORT_BEGIN
|
MJIT_SYMBOL_EXPORT_BEGIN
|
||||||
|
|
||||||
RUBY_EXTERN VALUE ruby_vm_const_missing_count;
|
RUBY_EXTERN VALUE ruby_vm_const_missing_count;
|
||||||
|
RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
|
||||||
RUBY_EXTERN rb_serial_t ruby_vm_class_serial;
|
RUBY_EXTERN rb_serial_t ruby_vm_class_serial;
|
||||||
RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state;
|
RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state;
|
||||||
|
|
||||||
|
@ -147,6 +147,7 @@ rb_clear_constant_cache_for_id(ID id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rb_yjit_constant_state_changed();
|
rb_yjit_constant_state_changed();
|
||||||
|
ruby_vm_global_constant_state++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user