1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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().
This commit is contained in:
Koichi Sasada 2019-11-09 16:15:17 +09:00
parent 50bc7e7e9f
commit 43ceedecc0
2 changed files with 2 additions and 3 deletions

View file

@ -1497,7 +1497,7 @@ invokebuiltin
// attr bool leaf = false; /* anything can happen inside */ // attr bool leaf = false; /* anything can happen inside */
// attr rb_snum_t sp_inc = 1 - bf->argc; // 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) */ /* call specific function with args (same parameters) */

View file

@ -4981,9 +4981,8 @@ invoke_bf(rb_execution_context_t *ec, rb_control_frame_t *cfp, const struct rb_b
} }
static VALUE 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); return invoke_bf(ec, cfp, bf, argv);
} }