ruby-changes:52073
From: k0kubun <ko1@a...>
Date: Sat, 11 Aug 2018 12:50:48 +0900 (JST)
Subject: [ruby-changes:52073] k0kubun:r64281 (trunk): vm_args.c: stop requiring `calling` in vm_caller_setup_arg_block
k0kubun 2018-08-11 12:50:42 +0900 (Sat, 11 Aug 2018) New Revision: 64281 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64281 Log: vm_args.c: stop requiring `calling` in vm_caller_setup_arg_block _mjit_compile_send.erb: simplify code using the change insns.def: adapt to the interface change Modified files: trunk/insns.def trunk/tool/ruby_vm/views/_mjit_compile_send.erb trunk/vm_args.c Index: tool/ruby_vm/views/_mjit_compile_send.erb =================================================================== --- tool/ruby_vm/views/_mjit_compile_send.erb (revision 64280) +++ tool/ruby_vm/views/_mjit_compile_send.erb (revision 64281) @@ -39,9 +39,7 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/_mjit_compile_send.erb#L39 fprintf(f, " {\n"); fprintf(f, " VALUE block_handler = VM_BLOCK_HANDLER_NONE;\n"); % if insn.name == 'send' - fprintf(f, " struct rb_calling_info calling;\n"); - fprintf(f, " vm_caller_setup_arg_block(ec, reg_cfp, &calling, (CALL_INFO)0x%"PRIxVALUE", (rb_iseq_t *)0x%"PRIxVALUE", FALSE);\n", operands[0], operands[2]); - fprintf(f, " block_handler = calling.block_handler;\n"); + fprintf(f, " block_handler = vm_caller_setup_arg_block(ec, reg_cfp, (CALL_INFO)0x%"PRIxVALUE", (rb_iseq_t *)0x%"PRIxVALUE", FALSE);\n", operands[0], operands[2]); % end % # JIT: Special CALL_METHOD. Inline vm_call_iseq_setup_normal for vm_call_iseq_setup_func FASTPATH. fprintf(f, " {\n"); Index: vm_args.c =================================================================== --- vm_args.c (revision 64280) +++ vm_args.c (revision 64281) @@ -853,19 +853,19 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ https://github.com/ruby/ruby/blob/trunk/vm_args.c#L853 return rb_vm_call0(ec, obj, mid, argc, argv, me); } -static void +static VALUE vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, - struct rb_calling_info *calling, const struct rb_call_info *ci, rb_iseq_t *blockiseq, const int is_super) + const struct rb_call_info *ci, rb_iseq_t *blockiseq, const int is_super) { if (ci->flag & VM_CALL_ARGS_BLOCKARG) { VALUE block_code = *(--reg_cfp->sp); if (NIL_P(block_code)) { - calling->block_handler = VM_BLOCK_HANDLER_NONE; - } + return VM_BLOCK_HANDLER_NONE; + } else if (block_code == rb_block_param_proxy) { - calling->block_handler = VM_CF_BLOCK_HANDLER(reg_cfp); - } + return VM_CF_BLOCK_HANDLER(reg_cfp); + } else if (SYMBOL_P(block_code) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) { const rb_cref_t *cref = vm_env_cref(reg_cfp->ep); if (cref && !NIL_P(cref->refinements)) { @@ -878,23 +878,23 @@ vm_caller_setup_arg_block(const rb_execu https://github.com/ruby/ruby/blob/trunk/vm_args.c#L878 } block_code = func; } - calling->block_handler = block_code; - } - else { - calling->block_handler = vm_to_proc(block_code); - } + return block_code; + } + else { + return vm_to_proc(block_code); + } } else if (blockiseq != NULL) { /* likely */ struct rb_captured_block *captured = VM_CFP_TO_CAPTURED_BLOCK(reg_cfp); captured->code.iseq = blockiseq; - calling->block_handler = VM_BH_FROM_ISEQ_BLOCK(captured); + return VM_BH_FROM_ISEQ_BLOCK(captured); } else { if (is_super) { - calling->block_handler = GET_BLOCK_HANDLER(); - } - else { - calling->block_handler = VM_BLOCK_HANDLER_NONE; - } + return GET_BLOCK_HANDLER(); + } + else { + return VM_BLOCK_HANDLER_NONE; + } } } Index: insns.def =================================================================== --- insns.def (revision 64280) +++ insns.def (revision 64281) @@ -715,7 +715,7 @@ send https://github.com/ruby/ruby/blob/trunk/insns.def#L715 { struct rb_calling_info calling; - vm_caller_setup_arg_block(ec, reg_cfp, &calling, ci, blockiseq, FALSE); + calling.block_handler = vm_caller_setup_arg_block(ec, reg_cfp, ci, blockiseq, FALSE); calling.recv = TOPN(calling.argc = ci->orig_argc); vm_search_method(ci, cc, calling.recv); CALL_METHOD(&calling, ci, cc); @@ -785,7 +785,7 @@ invokesuper https://github.com/ruby/ruby/blob/trunk/insns.def#L785 { struct rb_calling_info calling; - vm_caller_setup_arg_block(ec, reg_cfp, &calling, ci, blockiseq, TRUE); + calling.block_handler = vm_caller_setup_arg_block(ec, reg_cfp, ci, blockiseq, TRUE); calling.recv = TOPN(calling.argc = ci->orig_argc); vm_search_super_method(ec, GET_CFP(), &calling, ci, cc); CALL_METHOD(&calling, ci, cc); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/