summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-11-09 16:15:17 +0900
committerKoichi Sasada <ko1@atdot.net>2019-11-09 16:18:58 +0900
commit43ceedecc0b9990b5bac2e65de5e439c41a9996b (patch)
tree6d19d377de30039e5a2431278e187748b6a92ca7
parent50bc7e7e9f0da6b27db06ac063257de0b97ed9b3 (diff)
downloadbundler-43ceedecc0b9990b5bac2e65de5e439c41a9996b.tar.gz
use STACK_ADDR_FROM_TOP()
vm_invoke_builtin() accesses VM stack via cfp->sp. However, MJIT can use their own stack. To access them appropriately, we need to use STACK_ADDR_FROM_TOP().
-rw-r--r--insns.def2
-rw-r--r--vm_insnhelper.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/insns.def b/insns.def
index 993bc047ee..1333c09869 100644
--- a/insns.def
+++ b/insns.def
@@ -1497,7 +1497,7 @@ invokebuiltin
// attr bool leaf = false; /* anything can happen inside */
// attr rb_snum_t sp_inc = 1 - bf->argc;
{
- ret = vm_invoke_builtin(ec, reg_cfp, bf);
+ ret = vm_invoke_builtin(ec, reg_cfp, bf, STACK_ADDR_FROM_TOP(bf->argc));
}
/* call specific function with args (same parameters) */
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 8378fc37b9..898b1937a0 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4981,9 +4981,8 @@ invoke_bf(rb_execution_context_t *ec, rb_control_frame_t *cfp, const struct rb_b
}
static VALUE
-vm_invoke_builtin(rb_execution_context_t *ec, rb_control_frame_t *cfp, const struct rb_builtin_function* bf)
+vm_invoke_builtin(rb_execution_context_t *ec, rb_control_frame_t *cfp, const struct rb_builtin_function* bf, const VALUE *argv)
{
- const VALUE *argv = cfp->sp - bf->argc;
return invoke_bf(ec, cfp, bf, argv);
}