aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-06-21 10:27:04 -0700
committerGitHub <noreply@github.com>2020-06-21 10:27:04 -0700
commitd9f608b6869abccb86aefd2d1be227a5ea40e4d1 (patch)
tree30adb7e0816416c9a85ffd29213fe342331e6a64 /vm_insnhelper.c
parentaec8e6d379a9dbb6c871090d93a3db4e60954b94 (diff)
downloadruby-d9f608b6869abccb86aefd2d1be227a5ea40e4d1.tar.gz
Verify builtin inline annotation with VM_CHECK_MODE (#3244)
* Verify builtin inline annotation with VM_CHECK_MODE * Remove static to fix the link issue on MJIT
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 9957c55129..af8bf464da 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4969,7 +4969,7 @@ vm_trace(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const VALUE *p
}
#if VM_CHECK_MODE > 0
-static NORETURN( NOINLINE( COLDFUNC
+NORETURN( NOINLINE( COLDFUNC
void vm_canary_is_found_dead(enum ruby_vminsn_type i, VALUE c)));
void
@@ -5165,10 +5165,13 @@ lookup_builtin_invoker(int argc)
}
static inline VALUE
-invoke_bf(rb_execution_context_t *ec, rb_control_frame_t *cfp, const struct rb_builtin_function* bf, const VALUE *argv)
+invoke_bf(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, const struct rb_builtin_function* bf, const VALUE *argv)
{
- VALUE self = cfp->self;
- return (*lookup_builtin_invoker(bf->argc))(ec, self, argv, (rb_insn_func_t)bf->func_ptr);
+ const bool canary_p = reg_cfp->iseq->body->builtin_inline_p; // Verify an assumption of `Primitive.attr! 'inline'`
+ SETUP_CANARY(canary_p);
+ VALUE ret = (*lookup_builtin_invoker(bf->argc))(ec, reg_cfp->self, argv, (rb_insn_func_t)bf->func_ptr);
+ CHECK_CANARY(canary_p, BIN(invokebuiltin));
+ return ret;
}
static VALUE