ruby-changes:52642
From: ko1 <ko1@a...>
Date: Wed, 26 Sep 2018 17:11:12 +0900 (JST)
Subject: [ruby-changes:52642] ko1:r64854 (trunk): fix OPT_CALL_THREADED_CODE issue.
ko1 2018-09-26 17:11:05 +0900 (Wed, 26 Sep 2018) New Revision: 64854 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64854 Log: fix OPT_CALL_THREADED_CODE issue. * insns.def (opt_send_without_block): reorder insn position because `opt_str_freeze` insn refer this insn (function) when OPT_CALL_THREADED_CODE is true. * vm_opts.h (OPT_THREADED_CODE): introduce new macro to select threaded code implementation with a compile option (-D...). Modified files: trunk/insns.def trunk/vm_opts.h Index: vm_opts.h =================================================================== --- vm_opts.h (revision 64853) +++ vm_opts.h (revision 64854) @@ -30,9 +30,19 @@ https://github.com/ruby/ruby/blob/trunk/vm_opts.h#L30 */ /* C compiler dependent */ -#define OPT_DIRECT_THREADED_CODE 1 -#define OPT_TOKEN_THREADED_CODE 0 -#define OPT_CALL_THREADED_CODE 0 + +/* + * 0: direct (using labeled goto using GCC special) + * 1: token (switch/case) + * 2: call (function call for each insn dispatch) + */ +#ifndef OPT_THREADED_CODE +#define OPT_THREADED_CODE 0 +#endif + +#define OPT_DIRECT_THREADED_CODE (OPT_THREADED_CODE == 0) +#define OPT_TOKEN_THREADED_CODE (OPT_THREADED_CODE == 1) +#define OPT_CALL_THREADED_CODE (OPT_THREADED_CODE == 2) /* VM running option */ #define OPT_CHECKED_RUN 1 Index: insns.def =================================================================== --- insns.def (revision 64853) +++ insns.def (revision 64854) @@ -751,6 +751,22 @@ send https://github.com/ruby/ruby/blob/trunk/insns.def#L751 CALL_METHOD(&calling, ci, cc); } +/* Invoke method without block */ +DEFINE_INSN +opt_send_without_block +(CALL_INFO ci, CALL_CACHE cc) +(...) +(VALUE val) +// attr bool leaf = false; /* Of course it isn't. */ +// attr bool handles_sp = true; +// attr rb_snum_t sp_inc = -ci->orig_argc; +{ + struct rb_calling_info calling; + calling.block_handler = VM_BLOCK_HANDLER_NONE; + vm_search_method(ci, cc, calling.recv = TOPN(calling.argc = ci->orig_argc)); + CALL_METHOD(&calling, ci, cc); +} + DEFINE_INSN opt_str_freeze (VALUE str, CALL_INFO ci, CALL_CACHE cc) @@ -806,22 +822,6 @@ opt_newarray_min https://github.com/ruby/ruby/blob/trunk/insns.def#L822 val = vm_opt_newarray_min(num, STACK_ADDR_FROM_TOP(num)); } -/* Invoke method without block */ -DEFINE_INSN -opt_send_without_block -(CALL_INFO ci, CALL_CACHE cc) -(...) -(VALUE val) -// attr bool leaf = false; /* Of course it isn't. */ -// attr bool handles_sp = true; -// attr rb_snum_t sp_inc = -ci->orig_argc; -{ - struct rb_calling_info calling; - calling.block_handler = VM_BLOCK_HANDLER_NONE; - vm_search_method(ci, cc, calling.recv = TOPN(calling.argc = ci->orig_argc)); - CALL_METHOD(&calling, ci, cc); -} - /* super(args) # args.size => num */ DEFINE_INSN invokesuper -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/