Never call kind_of with klass=0
This commit is contained in:
parent
709a6a0786
commit
764e4fa850
Notes:
git
2022-02-24 12:58:02 +09:00
@ -61,14 +61,7 @@ total_i(VALUE v, void *ptr)
|
|||||||
{
|
{
|
||||||
struct total_data *data = (struct total_data *)ptr;
|
struct total_data *data = (struct total_data *)ptr;
|
||||||
|
|
||||||
switch (BUILTIN_TYPE(v)) {
|
if (!rb_objspace_internal_object_p(v)) {
|
||||||
case T_NONE:
|
|
||||||
case T_IMEMO:
|
|
||||||
case T_ICLASS:
|
|
||||||
case T_NODE:
|
|
||||||
case T_ZOMBIE:
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
if (data->klass == 0 || rb_obj_is_kind_of(v, data->klass)) {
|
if (data->klass == 0 || rb_obj_is_kind_of(v, data->klass)) {
|
||||||
data->total += rb_obj_memsize_of(v);
|
data->total += rb_obj_memsize_of(v);
|
||||||
}
|
}
|
||||||
|
2
object.c
2
object.c
@ -791,6 +791,8 @@ rb_obj_is_kind_of(VALUE obj, VALUE c)
|
|||||||
{
|
{
|
||||||
VALUE cl = CLASS_OF(obj);
|
VALUE cl = CLASS_OF(obj);
|
||||||
|
|
||||||
|
RUBY_ASSERT(cl);
|
||||||
|
|
||||||
// Note: YJIT needs this function to never allocate and never raise when
|
// Note: YJIT needs this function to never allocate and never raise when
|
||||||
// `c` is a class or a module.
|
// `c` is a class or a module.
|
||||||
c = class_or_module_required(c);
|
c = class_or_module_required(c);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user