зеркало из https://github.com/github/ruby.git
* vm.c, vm_macro.def : remove macro_eval_invoke_cfunc() and
add vm_call_cfunc(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f2074245b4
Коммит
1757fc9927
|
@ -1,3 +1,8 @@
|
|||
Sun Jun 24 19:02:33 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm.c, vm_macro.def : remove macro_eval_invoke_cfunc() and
|
||||
add vm_call_cfunc().
|
||||
|
||||
Sun Jun 24 17:54:13 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* insns.def, vm.c: add/fix stack overflow check.
|
||||
|
|
28
vm.c
28
vm.c
|
@ -343,6 +343,34 @@ caller_setup_args(rb_thread_t *th, rb_control_frame_t *cfp,
|
|||
return argc;
|
||||
}
|
||||
|
||||
static inline VALUE
|
||||
vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, int num,
|
||||
ID id, VALUE recv, VALUE klass, NODE *mn, rb_block_t *blockptr)
|
||||
{
|
||||
VALUE val;
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, id, klass);
|
||||
{
|
||||
rb_control_frame_t *cfp =
|
||||
push_frame(th, 0, FRAME_MAGIC_CFUNC,
|
||||
recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1);
|
||||
|
||||
cfp->method_id = id;
|
||||
cfp->method_klass = klass;
|
||||
|
||||
reg_cfp->sp -= num + 1;
|
||||
|
||||
val = call_cfunc(mn->nd_cfnc, recv, mn->nd_argc, num, reg_cfp->sp + 1);
|
||||
|
||||
if (reg_cfp != th->cfp + 1) {
|
||||
rb_bug("cfp consistency error - send");
|
||||
}
|
||||
pop_frame(th);
|
||||
}
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, id, klass);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/* Env */
|
||||
|
||||
|
|
28
vm_macro.def
28
vm_macro.def
|
@ -2,32 +2,6 @@
|
|||
/* do not use C++ style comment */
|
||||
/* */
|
||||
|
||||
MACRO macro_eval_invoke_cfunc(num, id, recv, klass, mn, blockptr)
|
||||
{
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, id, klass);
|
||||
{
|
||||
rb_control_frame_t *cfp =
|
||||
push_frame(th, 0, FRAME_MAGIC_CFUNC,
|
||||
recv, (VALUE) blockptr, 0, GET_SP(), 0, 1);
|
||||
|
||||
cfp->method_id = id;
|
||||
cfp->method_klass = klass;
|
||||
|
||||
reg_cfp->sp -= num + 1;
|
||||
|
||||
val = call_cfunc(mn->nd_cfnc, recv, mn->nd_argc, num, reg_cfp->sp + 1);
|
||||
|
||||
if (reg_cfp != th->cfp + 1) {
|
||||
SDR2(reg_cfp);
|
||||
SDR2(th->cfp-5);
|
||||
rb_bug("cfp consistency error - send");
|
||||
th->cfp = reg_cfp;
|
||||
}
|
||||
pop_frame(th);
|
||||
}
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, id, klass);
|
||||
}
|
||||
|
||||
MACRO macro_eval_invoke_func(niseqval, recv, klass, blockptr, num)
|
||||
{
|
||||
rb_iseq_t *niseq;
|
||||
|
@ -136,7 +110,7 @@ MACRO macro_eval_invoke_method(recv, klass, id, num, mn, blockptr)
|
|||
NEXT_INSN();
|
||||
}
|
||||
case NODE_CFUNC:{
|
||||
macro_eval_invoke_cfunc(num, id, recv, klass, node, blockptr);
|
||||
val = vm_call_cfunc(th, GET_CFP(), num, id, recv, klass, node, blockptr);
|
||||
break;
|
||||
}
|
||||
case NODE_ATTRSET:{
|
||||
|
|
Загрузка…
Ссылка в новой задаче