ruby-changes:46903
From: ko1 <ko1@a...>
Date: Mon, 5 Jun 2017 16:03:33 +0900 (JST)
Subject: [ruby-changes:46903] ko1:r59018 (trunk): revert r59017 it fails ruby/test_lambda.rb
ko1 2017-06-05 16:03:27 +0900 (Mon, 05 Jun 2017) New Revision: 59018 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59018 Log: revert r59017 it fails ruby/test_lambda.rb Modified files: trunk/vm.c trunk/vm_eval.c Index: vm_eval.c =================================================================== --- vm_eval.c (revision 59017) +++ vm_eval.c (revision 59018) @@ -16,7 +16,7 @@ struct local_var_list { https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L16 }; 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_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda); 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, VALUE block_handler); static inline VALUE vm_yield_force_blockarg(rb_thread_t *th, VALUE args); @@ -1573,6 +1573,7 @@ yield_under(VALUE under, VALUE self, int https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1573 struct rb_captured_block new_captured; const VALUE *ep = NULL; rb_cref_t *cref; + int is_lambda = FALSE; if (block_handler != VM_BLOCK_HANDLER_NONE) { again: @@ -1588,6 +1589,7 @@ yield_under(VALUE under, VALUE self, int https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1589 new_block_handler = VM_BH_FROM_IFUNC_BLOCK(&new_captured); break; case block_handler_type_proc: + is_lambda = rb_proc_lambda_p(block_handler) != Qfalse; block_handler = vm_proc_to_block_handler(VM_BH_TO_PROC(block_handler)); goto again; case block_handler_type_symbol: @@ -1602,7 +1604,7 @@ yield_under(VALUE under, VALUE self, int https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1604 } cref = vm_cref_push(th, under, ep, TRUE); - return vm_yield_with_cref(th, argc, argv, cref); + return vm_yield_with_cref(th, argc, argv, cref, is_lambda); } VALUE @@ -1623,7 +1625,7 @@ rb_yield_refine_block(VALUE refinement, https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1625 CREF_REFINEMENTS_SET(cref, refinements); VM_FORCE_WRITE_SPECIAL_CONST(&VM_CF_LEP(th->ec.cfp)[VM_ENV_DATA_INDEX_SPECVAL], new_block_handler); new_captured.self = refinement; - return vm_yield_with_cref(th, 0, NULL, cref); + return vm_yield_with_cref(th, 0, NULL, cref, FALSE); } } Index: vm.c =================================================================== --- vm.c (revision 59017) +++ vm.c (revision 59018) @@ -1078,11 +1078,11 @@ check_block_handler(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1078 } static VALUE -vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref) +vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const rb_cref_t *cref, int is_lambda) { return invoke_block_from_c_bh(th, check_block_handler(th), argc, argv, VM_BLOCK_HANDLER_NONE, - cref, FALSE, FALSE); + cref, is_lambda, FALSE); } static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/