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

vm_core.h: update for OPT_CALL_CFUNC_WITHOUT_FRAME

* vm_eval.c (vm_call0_cfunc): update invoker arguments.
* vm_insnhelper.c (vm_call_cfunc_latter): ditto.
* vm_insnhelper.c (rb_vm_call_cfunc_push_frame): ditto, and prefix
  with rb_.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-04-03 02:43:20 +00:00
parent 337fafc641
commit c0bf2c5efe
4 changed files with 18 additions and 6 deletions

View file

@ -1,3 +1,12 @@
Fri Apr 3 11:43:17 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (vm_call0_cfunc): update invoker arguments.
* vm_insnhelper.c (vm_call_cfunc_latter): ditto.
* vm_insnhelper.c (rb_vm_call_cfunc_push_frame): ditto, and prefix
with rb_.
Thu Apr 2 16:26:59 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk, tool/mkconfig.rb: check the running ruby version in

View file

@ -1035,8 +1035,8 @@ GET_THREAD(void)
rb_thread_t *th = ruby_current_thread;
#if OPT_CALL_CFUNC_WITHOUT_FRAME
if (UNLIKELY(th->passed_ci != 0)) {
void vm_call_cfunc_push_frame(rb_thread_t *th);
vm_call_cfunc_push_frame(th);
void rb_vm_call_cfunc_push_frame(rb_thread_t *th);
rb_vm_call_cfunc_push_frame(th);
}
#endif
return th;

View file

@ -71,13 +71,15 @@ vm_call0_cfunc(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
const rb_method_entry_t *me = ci->me;
const rb_method_cfunc_t *cfunc = &me->def->body.cfunc;
int len = cfunc->argc;
VALUE recv = ci->recv;
int argc = ci->argc;
if (len >= 0) rb_check_arity(ci->argc, len, len);
th->passed_ci = ci;
ci->aux.inc_sp = 0;
VM_PROFILE_UP(2);
val = (*cfunc->invoker)(cfunc->func, ci, argv);
val = (*cfunc->invoker)(cfunc->func, recv, argc, argv);
if (reg_cfp == th->cfp) {
if (UNLIKELY(th->passed_ci != ci)) {

View file

@ -1436,13 +1436,14 @@ vm_call_cfunc_latter(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_
VALUE val;
int argc = ci->argc;
VALUE *argv = STACK_ADDR_FROM_TOP(argc);
VALUE recv = ci->recv;
const rb_method_cfunc_t *cfunc = vm_method_cfunc_entry(ci->me);
th->passed_ci = ci;
reg_cfp->sp -= argc + 1;
ci->aux.inc_sp = argc + 1;
VM_PROFILE_UP(0);
val = (*cfunc->invoker)(cfunc->func, ci, argv);
val = (*cfunc->invoker)(cfunc->func, recv, argc, argv);
/* check */
if (reg_cfp == th->cfp) { /* no frame push */
@ -1490,7 +1491,7 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci)
}
void
vm_call_cfunc_push_frame(rb_thread_t *th)
rb_vm_call_cfunc_push_frame(rb_thread_t *th)
{
rb_call_info_t *ci = th->passed_ci;
const rb_method_entry_t *me = ci->me;
@ -1498,7 +1499,7 @@ vm_call_cfunc_push_frame(rb_thread_t *th)
vm_push_frame(th, 0, VM_FRAME_MAGIC_CFUNC, ci->recv, ci->defined_class,
VM_ENVVAL_BLOCK_PTR(ci->blockptr), NULL /* cref */,
0, th->cfp->sp + ci->aux.inc_sp, 1, me);
0, th->cfp->sp + ci->aux.inc_sp, 1, me, 0);
if (ci->call != vm_call_general) {
ci->call = vm_call_cfunc_with_frame;