Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions vm_insnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,18 @@ rb_vm_search_method_slowpath(const struct rb_callinfo *ci, VALUE klass)
{
const struct rb_callcache *cc;

VM_ASSERT(!SPECIAL_CONST_P(klass));

if (RB_BUILTIN_TYPE(klass) == T_NONE) {
// If we find a T_NONE here, it's most likely we called CLASS_OF(obj) on a
// garbage collected object (the freelist is stored in the class pointer),
// but it's possible that just the class was GC'd.
// This message intentionally tries to imply the former, but make an
// accurate statement for either case.
rb_bug("attempted to search method '%s' on a garbage collected object",
rb_id2name(vm_ci_mid(ci)));
}

VM_ASSERT_TYPE2(klass, T_CLASS, T_ICLASS);

RB_VM_LOCK_ENTER();
Expand Down
12 changes: 12 additions & 0 deletions vm_method.c
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,18 @@ callable_method_entry_or_negative(VALUE klass, ID mid, VALUE *defined_class_ptr)
{
const rb_callable_method_entry_t *cme;

VM_ASSERT(!SPECIAL_CONST_P(klass));

if (RB_BUILTIN_TYPE(klass) == T_NONE) {
// If we find a T_NONE here, it's most likely we called CLASS_OF(obj) on a
// garbage collected object (the freelist is stored in the class pointer),
// but it's possible that just the class was GC'd.
// This message intentionally tries to imply the former, but make an
// accurate statement for either case.
rb_bug("attempted to search method '%s' on a garbage collected object",
rb_id2name(mid));
}

VM_ASSERT_TYPE2(klass, T_CLASS, T_ICLASS);
RB_VM_LOCK_ENTER();
{
Expand Down
Loading