From dd87e463106ade202e3b04e7703a91e438c027d6 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 4 Jun 2013 03:47:02 +0000 Subject: Add more comment about r41041 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index d7515cd177..061b020930 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2212,9 +2212,13 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc); } else { - argv[0] = arg0; /* rb_check_array_type(arg0) may change argv */ - /* when to_ary method is invoked and the stack is overwritten, */ - /* so need to restore argv[0]. */ + /* vm_push_frame current argv is at the top of sp because vm_invoke_block + * set sp at the first element of argv. + * Therefore when rb_check_array_type(arg0) called to_ary and called to_ary + * or method_missing run vm_push_frame, it initializes local variables. + * see also https://bugs.ruby-lang.org/issues/8484 + */ + argv[0] = arg0; } /* keyword argument */ -- cgit v1.2.3