ruby-changes:18260
From: nobu <ko1@a...>
Date: Tue, 21 Dec 2010 06:10:39 +0900 (JST)
Subject: [ruby-changes:18260] Ruby:r30283 (trunk): * compile.c (setup_args), vm.c (invoke_block_from_c),
nobu 2010-12-21 06:10:24 +0900 (Tue, 21 Dec 2010) New Revision: 30283 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30283 Log: * compile.c (setup_args), vm.c (invoke_block_from_c), vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243 except for the test. Modified files: trunk/ChangeLog trunk/compile.c trunk/test/ruby/test_lambda.rb trunk/vm.c trunk/vm_core.h trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30282) +++ ChangeLog (revision 30283) @@ -1,3 +1,9 @@ +Tue Dec 21 06:10:18 2010 Nobuyoshi Nakada <nobu@r...> + + * compile.c (setup_args), vm.c (invoke_block_from_c), + vm_insnhelper.c (caller_setup_args): reverted r30241 and r30243 + except for the test. + Tue Dec 21 01:41:42 2010 Masaya Tarui <tarui@r...> * io.c : add an extra byte to buffer for the specification of read Index: vm_core.h =================================================================== --- vm_core.h (revision 30282) +++ vm_core.h (revision 30283) @@ -550,7 +550,6 @@ #define VM_CALL_TAILRECURSION_BIT (0x01 << 6) #define VM_CALL_SUPER_BIT (0x01 << 7) #define VM_CALL_OPT_SEND_BIT (0x01 << 8) -#define VM_CALL_BLOCK_LAMBDA_BIT (0x01 << 9) enum vm_special_object_type { VM_SPECIAL_OBJECT_VMCORE = 1, Index: compile.c =================================================================== --- compile.c (revision 30282) +++ compile.c (revision 30283) @@ -2886,7 +2886,7 @@ } static VALUE -setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag, VALUE *block) +setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag) { VALUE argc = INT2FIX(0); int nsplat = 0; @@ -2896,15 +2896,8 @@ INIT_ANCHOR(arg_block); INIT_ANCHOR(args_splat); if (argn && nd_type(argn) == NODE_BLOCK_PASS) { - if (block && nd_type(argn->nd_body) == NODE_LAMBDA) { - NODE *lambda = argn->nd_body; - *block = NEW_CHILD_ISEQVAL(lambda->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, nd_line(lambda)); - *flag |= VM_CALL_BLOCK_LAMBDA_BIT; - } - else { - COMPILE(arg_block, "block", argn->nd_body); - *flag |= VM_CALL_ARGS_BLOCKARG_BIT; - } + COMPILE(arg_block, "block", argn->nd_body); + *flag |= VM_CALL_ARGS_BLOCKARG_BIT; argn = argn->nd_head; } @@ -3816,7 +3809,7 @@ boff = 1; default: INIT_ANCHOR(args); - argc = setup_args(iseq, args, node->nd_args->nd_head, &flag, NULL); + argc = setup_args(iseq, args, node->nd_args->nd_head, &flag); ADD_SEQ(ret, args); } ADD_INSN1(ret, nd_line(node), dupn, FIXNUM_INC(argc, 1 + boff)); @@ -4132,7 +4125,7 @@ /* args */ if (nd_type(node) != NODE_VCALL) { - argc = setup_args(iseq, args, node->nd_args, &flag, &parent_block); + argc = setup_args(iseq, args, node->nd_args, &flag); } else { argc = INT2FIX(0); @@ -4170,7 +4163,7 @@ INIT_ANCHOR(args); iseq->compile_data->current_block = Qfalse; if (nd_type(node) == NODE_SUPER) { - argc = setup_args(iseq, args, node->nd_args, &flag, &parent_block); + argc = setup_args(iseq, args, node->nd_args, &flag); } else { /* NODE_ZSUPER */ @@ -4343,7 +4336,7 @@ } if (node->nd_head) { - argc = setup_args(iseq, args, node->nd_head, &flag, NULL); + argc = setup_args(iseq, args, node->nd_head, &flag); } else { argc = INT2FIX(0); @@ -4955,7 +4948,7 @@ INIT_ANCHOR(recv); INIT_ANCHOR(args); - argc = setup_args(iseq, args, node->nd_args, &flag, NULL); + argc = setup_args(iseq, args, node->nd_args, &flag); if (node->nd_recv == (NODE *) 1) { flag |= VM_CALL_FCALL_BIT; Index: vm.c =================================================================== --- vm.c (revision 30282) +++ vm.c (revision 30283) @@ -531,10 +531,7 @@ const rb_control_frame_t *cfp; rb_control_frame_t *ncfp; int i, opt_pc, arg_size = iseq->arg_size; - int type = - block->proc == Qtrue ? VM_FRAME_MAGIC_LAMBDA : - block->proc == Qfalse ? VM_FRAME_MAGIC_BLOCK : - block_proc_is_lambda(block->proc) ? + int type = block_proc_is_lambda(block->proc) ? VM_FRAME_MAGIC_LAMBDA : VM_FRAME_MAGIC_BLOCK; rb_vm_set_finish_env(th); Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 30282) +++ vm_insnhelper.c (revision 30283) @@ -265,7 +265,7 @@ else if (blockiseq) { blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp); blockptr->iseq = blockiseq; - blockptr->proc = (flag & VM_CALL_BLOCK_LAMBDA_BIT) ? Qtrue : Qfalse; + blockptr->proc = 0; *block = blockptr; } } Index: test/ruby/test_lambda.rb =================================================================== --- test/ruby/test_lambda.rb (revision 30282) +++ test/ruby/test_lambda.rb (revision 30283) @@ -22,9 +22,6 @@ assert_raise(ArgumentError) { ->(a,b){ }.call(1,2,3) } end -end - -__END__ def test_lambda_as_iterator a = 0 2.times(&->(_){ a += 1 }) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/