summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-04-29 17:49:55 +0900
committernagachika <nagachika@ruby-lang.org>2021-04-29 17:49:55 +0900
commitcc4e602634e894c831a4103a5803a3de566c1856 (patch)
tree8250b3992dc55c5572b2edcafcafa0b385dfe1b6 /vm_insnhelper.c
parent58240b5d0b52d9685b773e5b9e45d22ca500392a (diff)
merge revision(s) 87c546b5fa97e6e226cce4daf417617a1143f642,7a3322a0fd660d676f1918bd7c4a37676b44e1c2:
Avoid using inconsistent coding style Other `_mjit_compile_*.erb` files don't use goto. These files'd better be consistent for readability. --- tool/ruby_vm/views/_mjit_compile_getinlinecache.erb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) 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. --- test/ruby/test_jit.rb | 12 +++++++++++ .../ruby_vm/views/_mjit_compile_getinlinecache.erb | 2 +- vm_insnhelper.c | 25 ++++++++++++++-------- 3 files changed, 29 insertions(+), 10 deletions(-)
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 8a876851b9..74ab6ac1c6 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4640,19 +4640,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