From 5ac1972c1a7b56aa1aace73b30c1a8fcd8705ac8 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 3 Jun 2015 10:42:18 +0000 Subject: [PATCH] * vm_core.h: rename enum missing_reason to enum method_missing_reason. * vm_core.h: use enum method_missing_reason for rb_thread_t::method_missing_reason. * vm_eval.c: catch up this fix. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ vm_core.h | 22 ++++++++++++---------- vm_eval.c | 18 +++++++++--------- vm_insnhelper.c | 20 ++++++++++---------- 4 files changed, 42 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index d655bbdf1b..7c89f51ccf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Wed Jun 3 19:24:12 2015 Koichi Sasada + + * vm_core.h: rename enum missing_reason to enum method_missing_reason. + + * vm_core.h: use enum method_missing_reason for + rb_thread_t::method_missing_reason. + + * vm_eval.c: catch up this fix. + + * vm_insnhelper.c: ditto. + Wed Jun 3 16:17:21 2015 Aaron Patterson * vm.c: eagerly allocate `loading_table`. This eliminates the need to diff --git a/vm_core.h b/vm_core.h index 2f1ca25ea8..ff2b8a964d 100644 --- a/vm_core.h +++ b/vm_core.h @@ -141,6 +141,16 @@ typedef struct rb_call_info_kw_arg_struct { VALUE keywords[1]; } rb_call_info_kw_arg_t; +enum method_missing_reason { + MISSING_NOENTRY = 0x00, + MISSING_PRIVATE = 0x01, + MISSING_PROTECTED = 0x02, + MISSING_VCALL = 0x04, + MISSING_SUPER = 0x08, + MISSING_MISSING = 0x10, + MISSING_NONE = 0x20 +}; + /* rb_call_info_t contains calling information including inline cache */ typedef struct rb_call_info_struct { /* fixed at compile time */ @@ -167,15 +177,7 @@ typedef struct rb_call_info_struct { union { int opt_pc; /* used by iseq */ int index; /* used by ivar */ - enum missing_reason { - MISSING_NOENTRY = 0x00, - MISSING_PRIVATE = 0x01, - MISSING_PROTECTED = 0x02, - MISSING_VCALL = 0x04, - MISSING_SUPER = 0x08, - MISSING_MISSING = 0x10, - MISSING_NONE = 0x20 - } missing_reason; /* used by method_missing */ + enum method_missing_reason method_missing_reason; /* used by method_missing */ int inc_sp; /* used by cfunc */ } aux; @@ -721,7 +723,7 @@ typedef struct rb_thread_struct { rb_ensure_list_t *ensure_list; /* misc */ - int method_missing_reason; + enum method_missing_reason method_missing_reason; int abort_on_exception; #ifdef USE_SIGALTSTACK void *altstack; diff --git a/vm_eval.c b/vm_eval.c index c18b979824..bd7d76214b 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -15,7 +15,7 @@ struct local_var_list { VALUE tbl; }; -static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum missing_reason call_status); +static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status); static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref); static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv); static inline VALUE vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *argv, const rb_block_t *blockargptr); @@ -208,7 +208,7 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv) ci->defined_class = RCLASS_SUPER(ci->defined_class); if (!ci->defined_class || !(ci->me = rb_method_entry(ci->defined_class, ci->mid, &ci->defined_class))) { - enum missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0; + enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0; ret = method_missing(ci->recv, ci->mid, ci->argc, argv, ex); goto success; } @@ -321,7 +321,7 @@ stack_check(void) static inline rb_method_entry_t * rb_search_method_entry(VALUE recv, ID mid, VALUE *defined_class_ptr); -static inline enum missing_reason rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type scope, VALUE self); +static inline enum method_missing_reason rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type scope, VALUE self); /*! * \internal @@ -346,7 +346,7 @@ rb_call0(VALUE recv, ID mid, int argc, const VALUE *argv, rb_method_entry_t *me = rb_search_method_entry(recv, mid, &defined_class); rb_thread_t *th = GET_THREAD(); - enum missing_reason call_status = rb_method_call_status(th, me, scope, self); + enum method_missing_reason call_status = rb_method_call_status(th, me, scope, self); if (call_status != MISSING_NONE) { return method_missing(recv, mid, argc, argv, call_status); @@ -426,7 +426,7 @@ check_funcall_missing(rb_thread_t *th, VALUE klass, VALUE recv, ID mid, int argc else { struct rescue_funcall_args args; - th->method_missing_reason = 0; + th->method_missing_reason = MISSING_NOENTRY; args.recv = recv; args.mid = mid; args.argc = argc; @@ -556,7 +556,7 @@ rb_search_method_entry(VALUE recv, ID mid, VALUE *defined_class_ptr) return rb_method_entry(klass, mid, defined_class_ptr); } -static inline enum missing_reason +static inline enum method_missing_reason rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type scope, VALUE self) { VALUE klass; @@ -624,7 +624,7 @@ rb_call(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope) } NORETURN(static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, - VALUE obj, enum missing_reason call_status)); + VALUE obj, enum method_missing_reason call_status)); /* * call-seq: @@ -693,7 +693,7 @@ make_no_method_exception(VALUE exc, const char *format, VALUE obj, int argc, con static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, - enum missing_reason last_call_status) + enum method_missing_reason last_call_status) { VALUE exc = rb_eNoMethodError; const char *format = 0; @@ -728,7 +728,7 @@ raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj, } static inline VALUE -method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum missing_reason call_status) +method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missing_reason call_status) { VALUE *nargv, result, work; rb_thread_t *th = GET_THREAD(); diff --git a/vm_insnhelper.c b/vm_insnhelper.c index cb89bd3566..b5963ed840 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1740,10 +1740,10 @@ vm_call_bmethod(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) return vm_call_bmethod_body(th, ci, argv); } -static enum missing_reason +static enum method_missing_reason ci_missing_reason(const rb_call_info_t *ci) { - enum missing_reason stat = MISSING_NOENTRY; + enum method_missing_reason stat = MISSING_NOENTRY; if (ci->flag & VM_CALL_VCALL) stat |= MISSING_VCALL; if (ci->flag & VM_CALL_SUPER) stat |= MISSING_SUPER; return stat; @@ -1785,7 +1785,7 @@ vm_call_opt_send(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *c } TOPN(i) = rb_str_intern(sym); ci->mid = idMethodMissing; - th->method_missing_reason = ci->aux.missing_reason = ci_missing_reason(ci); + th->method_missing_reason = ci->aux.method_missing_reason = ci_missing_reason(ci); } else { /* shift arguments */ @@ -1844,7 +1844,7 @@ vm_call_method_missing(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf argv[0] = ID2SYM(ci->mid); INC_SP(1); - th->method_missing_reason = ci->aux.missing_reason; + th->method_missing_reason = ci->aux.method_missing_reason; return vm_call_method(th, reg_cfp, &ci_entry); } @@ -1939,7 +1939,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) return vm_call_ivar(th, cfp, ci); } case VM_METHOD_TYPE_MISSING:{ - ci->aux.missing_reason = 0; + ci->aux.method_missing_reason = 0; CI_SET_FASTPATH(ci, vm_call_method_missing, enable_fastpath); return vm_call_method_missing(th, cfp, ci); } @@ -2040,18 +2040,18 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) else { int safe; if (!(ci->flag & VM_CALL_FCALL) && (ci->me->def->flags.visi == METHOD_VISI_PRIVATE)) { - enum missing_reason stat = MISSING_PRIVATE; + enum method_missing_reason stat = MISSING_PRIVATE; bp(); if (ci->flag & VM_CALL_VCALL) stat |= MISSING_VCALL; - ci->aux.missing_reason = stat; + ci->aux.method_missing_reason = stat; CI_SET_FASTPATH(ci, vm_call_method_missing, 1); return vm_call_method_missing(th, cfp, ci); } else if (!(ci->flag & VM_CALL_OPT_SEND) && (ci->me->def->flags.visi == METHOD_VISI_PROTECTED)) { enable_fastpath = 0; if (!rb_obj_is_kind_of(cfp->self, ci->defined_class)) { - ci->aux.missing_reason = MISSING_PROTECTED; + ci->aux.method_missing_reason = MISSING_PROTECTED; return vm_call_method_missing(th, cfp, ci); } else { @@ -2075,7 +2075,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) rb_raise_method_missing(th, ci->argc, argv, ci->recv, stat); } else { - ci->aux.missing_reason = stat; + ci->aux.method_missing_reason = stat; CI_SET_FASTPATH(ci, vm_call_method_missing, 1); return vm_call_method_missing(th, cfp, ci); } @@ -2211,7 +2211,7 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf } if (!ci->klass) { /* bound instance method of module */ - ci->aux.missing_reason = MISSING_SUPER; + ci->aux.method_missing_reason = MISSING_SUPER; CI_SET_FASTPATH(ci, vm_call_method_missing, 1); return; }