* vm_core.h: remove rb_call_info_t::aux.opt_pc.
* vm_insnhelper.c: introduce shortcut functions for opt_pc == 0 because opt_pc is always 0 on shortcut function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d0bb9ed164
commit
731c9288da
@ -1,3 +1,10 @@
|
|||||||
|
Fri Sep 11 20:23:35 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* vm_core.h: remove rb_call_info_t::aux.opt_pc.
|
||||||
|
|
||||||
|
* vm_insnhelper.c: introduce shortcut functions for opt_pc == 0
|
||||||
|
because opt_pc is always 0 on shortcut function.
|
||||||
|
|
||||||
Fri Sep 11 17:49:36 2015 Koichi Sasada <ko1@atdot.net>
|
Fri Sep 11 17:49:36 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* iseq.c: disable ISeq.load. It enabled accidentally at r51794.
|
* iseq.c: disable ISeq.load. It enabled accidentally at r51794.
|
||||||
|
@ -210,7 +210,6 @@ typedef struct rb_call_info_struct {
|
|||||||
VALUE recv;
|
VALUE recv;
|
||||||
int argc;
|
int argc;
|
||||||
union {
|
union {
|
||||||
int opt_pc; /* used by iseq */
|
|
||||||
unsigned int index; /* used by ivar */
|
unsigned int index; /* used by ivar */
|
||||||
enum method_missing_reason method_missing_reason; /* used by method_missing */
|
enum method_missing_reason method_missing_reason; /* used by method_missing */
|
||||||
int inc_sp; /* used by cfunc */
|
int inc_sp; /* used by cfunc */
|
||||||
|
@ -1221,9 +1221,11 @@ vm_base_ptr(rb_control_frame_t *cfp)
|
|||||||
|
|
||||||
#include "vm_args.c"
|
#include "vm_args.c"
|
||||||
|
|
||||||
static VALUE vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
|
static VALUE vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc);
|
||||||
static inline VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
|
static inline VALUE vm_call_iseq_setup_normal_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
|
||||||
static inline VALUE vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
|
static inline VALUE vm_call_iseq_setup_tailcall_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci);
|
||||||
|
static inline VALUE vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc);
|
||||||
|
static inline VALUE vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc);
|
||||||
|
|
||||||
|
|
||||||
static inline VALUE
|
static inline VALUE
|
||||||
@ -1261,7 +1263,7 @@ simple_iseq_p(const rb_iseq_t *iseq)
|
|||||||
iseq->body->param.flags.has_block == FALSE;
|
iseq->body->param.flags.has_block == FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline int
|
||||||
vm_callee_setup_block_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv, const enum arg_setup_type arg_setup_type)
|
vm_callee_setup_block_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv, const enum arg_setup_type arg_setup_type)
|
||||||
{
|
{
|
||||||
if (LIKELY(simple_iseq_p(iseq))) {
|
if (LIKELY(simple_iseq_p(iseq))) {
|
||||||
@ -1301,14 +1303,14 @@ vm_callee_setup_block_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->aux.opt_pc = 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ci->aux.opt_pc = setup_parameters_complex(th, iseq, ci, argv, arg_setup_type);
|
return setup_parameters_complex(th, iseq, ci, argv, arg_setup_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline int
|
||||||
vm_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv)
|
vm_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv)
|
||||||
{
|
{
|
||||||
if (LIKELY(simple_iseq_p(iseq))) {
|
if (LIKELY(simple_iseq_p(iseq))) {
|
||||||
@ -1320,14 +1322,15 @@ vm_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq,
|
|||||||
argument_arity_error(th, iseq, ci->argc, iseq->body->param.lead_num, iseq->body->param.lead_num);
|
argument_arity_error(th, iseq, ci->argc, iseq->body->param.lead_num, iseq->body->param.lead_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->aux.opt_pc = 0;
|
|
||||||
|
|
||||||
CI_SET_FASTPATH(ci,
|
CI_SET_FASTPATH(ci,
|
||||||
(UNLIKELY(ci->flag & VM_CALL_TAILCALL) ? vm_call_iseq_setup_tailcall : vm_call_iseq_setup_normal),
|
(UNLIKELY(ci->flag & VM_CALL_TAILCALL) ? vm_call_iseq_setup_tailcall_0start :
|
||||||
|
vm_call_iseq_setup_normal_0start),
|
||||||
(!IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) && !(METHOD_ENTRY_VISI(ci->me) == METHOD_VISI_PROTECTED)));
|
(!IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) && !(METHOD_ENTRY_VISI(ci->me) == METHOD_VISI_PROTECTED)));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ci->aux.opt_pc = setup_parameters_complex(th, iseq, ci, argv, arg_setup_method);
|
return setup_parameters_complex(th, iseq, ci, argv, arg_setup_method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1343,23 +1346,23 @@ def_iseq_ptr(rb_method_definition_t *def)
|
|||||||
static VALUE
|
static VALUE
|
||||||
vm_call_iseq_setup(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
vm_call_iseq_setup(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
||||||
{
|
{
|
||||||
vm_callee_setup_arg(th, ci, def_iseq_ptr(ci->me->def), cfp->sp - ci->argc);
|
int opt_pc = vm_callee_setup_arg(th, ci, def_iseq_ptr(ci->me->def), cfp->sp - ci->argc);
|
||||||
return vm_call_iseq_setup_2(th, cfp, ci);
|
return vm_call_iseq_setup_2(th, cfp, ci, opt_pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
vm_call_iseq_setup_2(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc)
|
||||||
{
|
{
|
||||||
if (LIKELY(!(ci->flag & VM_CALL_TAILCALL))) {
|
if (LIKELY(!(ci->flag & VM_CALL_TAILCALL))) {
|
||||||
return vm_call_iseq_setup_normal(th, cfp, ci);
|
return vm_call_iseq_setup_normal(th, cfp, ci, opt_pc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return vm_call_iseq_setup_tailcall(th, cfp, ci);
|
return vm_call_iseq_setup_tailcall(th, cfp, ci, opt_pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline VALUE
|
static inline VALUE
|
||||||
vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc)
|
||||||
{
|
{
|
||||||
int i, local_size;
|
int i, local_size;
|
||||||
VALUE *argv = cfp->sp - ci->argc;
|
VALUE *argv = cfp->sp - ci->argc;
|
||||||
@ -1374,14 +1377,14 @@ vm_call_iseq_setup_normal(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info
|
|||||||
|
|
||||||
vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD, ci->recv,
|
vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD, ci->recv,
|
||||||
VM_ENVVAL_BLOCK_PTR(ci->blockptr), (VALUE)me,
|
VM_ENVVAL_BLOCK_PTR(ci->blockptr), (VALUE)me,
|
||||||
iseq->body->iseq_encoded + ci->aux.opt_pc, sp, 0, iseq->body->stack_max);
|
iseq->body->iseq_encoded + opt_pc, sp, 0, iseq->body->stack_max);
|
||||||
|
|
||||||
cfp->sp = argv - 1 /* recv */;
|
cfp->sp = argv - 1 /* recv */;
|
||||||
return Qundef;
|
return Qundef;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline VALUE
|
static inline VALUE
|
||||||
vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci, int opt_pc)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
VALUE *argv = cfp->sp - ci->argc;
|
VALUE *argv = cfp->sp - ci->argc;
|
||||||
@ -1413,12 +1416,24 @@ vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_in
|
|||||||
|
|
||||||
vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | finish_flag,
|
vm_push_frame(th, iseq, VM_FRAME_MAGIC_METHOD | finish_flag,
|
||||||
ci->recv, VM_ENVVAL_BLOCK_PTR(ci->blockptr), (VALUE)me,
|
ci->recv, VM_ENVVAL_BLOCK_PTR(ci->blockptr), (VALUE)me,
|
||||||
iseq->body->iseq_encoded + ci->aux.opt_pc, sp, 0, iseq->body->stack_max);
|
iseq->body->iseq_encoded + opt_pc, sp, 0, iseq->body->stack_max);
|
||||||
|
|
||||||
cfp->sp = sp_orig;
|
cfp->sp = sp_orig;
|
||||||
return Qundef;
|
return Qundef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline VALUE
|
||||||
|
vm_call_iseq_setup_normal_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
||||||
|
{
|
||||||
|
return vm_call_iseq_setup_normal(th, cfp, ci, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline VALUE
|
||||||
|
vm_call_iseq_setup_tailcall_0start(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
|
||||||
|
{
|
||||||
|
return vm_call_iseq_setup_tailcall(th, cfp, ci, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
call_cfunc_m2(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
|
call_cfunc_m2(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv)
|
||||||
{
|
{
|
||||||
@ -2284,8 +2299,7 @@ vm_yield_with_cfunc(rb_thread_t *th, const rb_block_t *block, VALUE self,
|
|||||||
static int
|
static int
|
||||||
vm_yield_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv, enum arg_setup_type arg_setup_type)
|
vm_yield_callee_setup_arg(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t *iseq, VALUE *argv, enum arg_setup_type arg_setup_type)
|
||||||
{
|
{
|
||||||
vm_callee_setup_block_arg(th, ci, iseq, argv, arg_setup_type);
|
return vm_callee_setup_block_arg(th, ci, iseq, argv, arg_setup_type);
|
||||||
return ci->aux.opt_pc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2315,12 +2329,10 @@ vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *ci
|
|||||||
iseq = block->iseq;
|
iseq = block->iseq;
|
||||||
|
|
||||||
if (!RUBY_VM_IFUNC_P(iseq)) {
|
if (!RUBY_VM_IFUNC_P(iseq)) {
|
||||||
int opt_pc;
|
|
||||||
const int arg_size = iseq->body->param.size;
|
const int arg_size = iseq->body->param.size;
|
||||||
int is_lambda = block_proc_is_lambda(block->proc);
|
int is_lambda = block_proc_is_lambda(block->proc);
|
||||||
VALUE * const rsp = GET_SP() - ci->argc;
|
VALUE * const rsp = GET_SP() - ci->argc;
|
||||||
|
int opt_pc = vm_yield_callee_setup_arg(th, ci, iseq, rsp, is_lambda ? arg_setup_lambda : arg_setup_block);
|
||||||
opt_pc = vm_yield_callee_setup_arg(th, ci, iseq, rsp, is_lambda ? arg_setup_lambda : arg_setup_block);
|
|
||||||
|
|
||||||
SET_SP(rsp);
|
SET_SP(rsp);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user