From 27fcdfaa0572d64c2036e32d71b374ca09428d39 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 19 Sep 2015 17:59:58 +0000 Subject: * vm_core.h: split rb_call_info_t into several structs. * rb_call_info (ci) has compiled fixed information. * if ci->flag & VM_CALL_KWARG, then rb_call_info is also rb_call_info_with_kwarg. This technique reduce one word for major rb_call_info data. * rb_calling_info has temporary data (argc, blockptr, recv). for each method dispatch. This data is allocated only on machine stack. * rb_call_cache is for inline method cache. Before this patch, only rb_call_info_t data is passed. After this patch, above three structs are passed. This patch improves: * data locarity (rb_call_info is now read-only data). * reduce memory consumption (rb_call_info_with_kwarg, rb_calling_info). * compile.c: use above data. * insns.def: ditto. * iseq.c: ditto. * vm_args.c: ditto. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. * vm_insnhelper.h: ditto. * iseq.h: add iseq_compile_data::ci_index and iseq_compile_data::ci_kw_indx. * tool/instruction.rb: introduce TS_CALLCACHE operand type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'vm_insnhelper.h') diff --git a/vm_insnhelper.h b/vm_insnhelper.h index de3b25f41e..cad07da182 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -162,8 +162,8 @@ enum vm_regan_acttype { } \ } while (0) -#define CALL_METHOD(ci) do { \ - VALUE v = (*(ci)->call)(th, GET_CFP(), (ci)); \ +#define CALL_METHOD(calling, ci, cc) do { \ + VALUE v = (*(cc)->call)(th, GET_CFP(), (calling), (ci), (cc)); \ if (v == Qundef) { \ RESTORE_REGS(); \ NEXT_INSN(); \ @@ -182,8 +182,8 @@ enum vm_regan_acttype { #endif #if OPT_CALL_FASTPATH -#define CI_SET_FASTPATH(ci, func, enabled) do { \ - if (LIKELY(enabled)) ((ci)->call = (func)); \ +#define CI_SET_FASTPATH(cc, func, enabled) do { \ + if (LIKELY(enabled)) ((cc)->call = (func)); \ } while (0) #else #define CI_SET_FASTPATH(ci, func, enabled) /* do nothing */ @@ -213,9 +213,11 @@ enum vm_regan_acttype { #endif #define CALL_SIMPLE_METHOD(recv_) do { \ - ci->blockptr = 0; ci->argc = ci->orig_argc; \ - vm_search_method(ci, ci->recv = (recv_)); \ - CALL_METHOD(ci); \ + struct rb_calling_info calling; \ + calling.blockptr = NULL; \ + calling.argc = ci->orig_argc; \ + vm_search_method(ci, cc, calling.recv = (recv_)); \ + CALL_METHOD(&calling, ci, cc); \ } while (0) #define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial) -- cgit v1.2.3