summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2021-11-16 18:02:16 +0900
committerKoichi Sasada <ko1@atdot.net>2021-11-17 22:21:42 +0900
commit8d7116552dace6d0a9a8f0bbe2fe0f02fcff6532 (patch)
tree38efdbf209b3e127727114679cd94a716b838698
parentb2255153cf2fe9d7b851c59cc09b358c0630e0a2 (diff)
assert `cc->cme_ != NULL`
when `vm_cc_markable(cc)`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5122
-rw-r--r--vm_callinfo.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h
index 2641ee79c5..91ed55bf5f 100644
--- a/vm_callinfo.h
+++ b/vm_callinfo.h
@@ -321,10 +321,19 @@ vm_cc_class_check(const struct rb_callcache *cc, VALUE klass)
return cc->klass == klass;
}
+static inline int
+vm_cc_markable(const struct rb_callcache *cc)
+{
+ VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
+ return FL_TEST_RAW((VALUE)cc, VM_CALLCACHE_UNMARKABLE) == 0;
+}
+
static inline const struct rb_callable_method_entry_struct *
vm_cc_cme(const struct rb_callcache *cc)
{
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
+ VM_ASSERT(!vm_cc_markable(cc) || cc->cme_ != NULL);
+
return cc->cme_;
}
@@ -350,13 +359,6 @@ vm_cc_cmethod_missing_reason(const struct rb_callcache *cc)
return cc->aux_.method_missing_reason;
}
-static inline int
-vm_cc_markable(const struct rb_callcache *cc)
-{
- VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
- return FL_TEST_RAW((VALUE)cc, VM_CALLCACHE_UNMARKABLE) == 0;
-}
-
static inline bool
vm_cc_invalidated_p(const struct rb_callcache *cc)
{