summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2021-01-04 13:09:01 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2021-01-04 13:09:08 -0800
commit7a3322a0fd660d676f1918bd7c4a37676b44e1c2 (patch)
tree85e14184b6e285a1838486559468550fc563e665 /vm_insnhelper.c
parent87c546b5fa97e6e226cce4daf417617a1143f642 (diff)
Fix broken JIT of getinlinecache
e7fc353f04 reverted vm_ic_hit_p's signature change made in 53babf35ef, which broke JIT compilation of getinlinecache. To make sure it doesn't happen again, I separated vm_inlined_ic_hit_p to make the intention clear.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 7ac5567e9f..92bc94767b 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4613,19 +4613,26 @@ vm_opt_newarray_min(rb_num_t num, const VALUE *ptr)
#define IMEMO_CONST_CACHE_SHAREABLE IMEMO_FL_USER0
-static int
-vm_ic_hit_p(const struct iseq_inline_constant_cache_entry *ice, const VALUE *reg_ep)
+// For MJIT inlining
+static inline bool
+vm_inlined_ic_hit_p(VALUE flags, VALUE value, const rb_cref_t *ic_cref, rb_serial_t ic_serial, const VALUE *reg_ep)
{
- VM_ASSERT(IMEMO_TYPE_P(ice, imemo_constcache));
- if (ice->ic_serial == GET_GLOBAL_CONSTANT_STATE() &&
- (FL_TEST_RAW((VALUE)ice, IMEMO_CONST_CACHE_SHAREABLE) || rb_ractor_main_p())) {
+ if (ic_serial == GET_GLOBAL_CONSTANT_STATE() &&
+ ((flags & IMEMO_CONST_CACHE_SHAREABLE) || rb_ractor_main_p())) {
- VM_ASSERT(FL_TEST_RAW((VALUE)ice, IMEMO_CONST_CACHE_SHAREABLE) ? rb_ractor_shareable_p(ice->value) : true);
+ VM_ASSERT((flags & IMEMO_CONST_CACHE_SHAREABLE) ? rb_ractor_shareable_p(value) : true);
- return (ice->ic_cref == NULL || // no need to check CREF
- ice->ic_cref == vm_get_cref(reg_ep));
+ return (ic_cref == NULL || // no need to check CREF
+ ic_cref == vm_get_cref(reg_ep));
}
- return FALSE;
+ return false;
+}
+
+static bool
+vm_ic_hit_p(const struct iseq_inline_constant_cache_entry *ice, const VALUE *reg_ep)
+{
+ VM_ASSERT(IMEMO_TYPE_P(ice, imemo_constcache));
+ return vm_inlined_ic_hit_p(ice->flags, ice->value, ice->ic_cref, ice->ic_serial, reg_ep);
}
static void