summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-05 03:31:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-05 03:31:07 +0000
commit73645c1c51847198e2195d36cc8be17fbe63db25 (patch)
tree4c3bb8a92746af2f5c5c7e9012be33f92eb1ec92 /vm_insnhelper.c
parent0e414175fdcc19550fe44cc1ad8cb4827d2e3da8 (diff)
vm_insnhelper.c: fix missing reason
* vm_insnhelper.c (ci_missing_reason): return the reason of method missing in call info. * vm_insnhelper.c (vm_call_opt_send): re-apply r49500 with the proper missing reason. [Bug #10828] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 84c2ca2ae6..869796eac5 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1497,6 +1497,19 @@ 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 int
+ci_missing_reason(const rb_call_info_t *ci)
+{
+ int stat = 0;
+ if (ci->flag & VM_CALL_VCALL) {
+ stat |= NOEX_VCALL;
+ }
+ if (ci->flag & VM_CALL_SUPER) {
+ stat |= NOEX_SUPER;
+ }
+ return stat;
+}
+
static
#ifdef _MSC_VER
__forceinline
@@ -1531,16 +1544,18 @@ vm_call_opt_send(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_t *c
VALUE exc = make_no_method_exception(rb_eNoMethodError, NULL, ci->recv, rb_long2int(ci->argc), &TOPN(i));
rb_exc_raise(exc);
}
- ci->mid = rb_to_id(sym);
+ ci->mid = idMethodMissing;
+ th->method_missing_reason = ci->aux.missing_reason = ci_missing_reason(ci);
}
-
- /* shift arguments */
- if (i > 0) {
- MEMMOVE(&TOPN(i), &TOPN(i-1), VALUE, i);
+ else {
+ /* shift arguments */
+ if (i > 0) {
+ MEMMOVE(&TOPN(i), &TOPN(i-1), VALUE, i);
+ }
+ ci->argc -= 1;
+ DEC_SP(1);
}
ci->me = rb_method_entry_without_refinements(CLASS_OF(ci->recv), ci->mid, &ci->defined_class);
- ci->argc -= 1;
- DEC_SP(1);
ci->flag = VM_CALL_FCALL | VM_CALL_OPT_SEND;
@@ -1785,13 +1800,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
}
else {
/* method missing */
- int stat = 0;
- if (ci->flag & VM_CALL_VCALL) {
- stat |= NOEX_VCALL;
- }
- if (ci->flag & VM_CALL_SUPER) {
- stat |= NOEX_SUPER;
- }
+ const int stat = ci_missing_reason(ci);
if (ci->mid == idMethodMissing) {
rb_control_frame_t *reg_cfp = cfp;
VALUE *argv = STACK_ADDR_FROM_TOP(ci->argc);