From b1c1ee7183f6c9b6f585d35a5a8786594e1e7733 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 22 Feb 2019 07:25:51 +0000 Subject: change `cfunc->invoker` type for opt. * vm_insnhelper.c: change `call_cfunc_*` parameters order and specify a function type for the passed func ptr. This fix reduce the number of asm instructions, such as: # before this patch 0000000000000110 : 110: 48 89 fa mov %rdi,%rdx 113: 31 c0 xor %eax,%eax 115: 48 89 f7 mov %rsi,%rdi 118: ff e2 jmpq *%rdx 11a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) # after this patch 0000000000000110 : 110: ff e1 jmpq *%rcx However, this kind of instruction reduction doesn't affect any performance because of great CPU architectures :p git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_method.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vm_method.c') diff --git a/vm_method.c b/vm_method.c index 76fdb2069f..fcb9f1967e 100644 --- a/vm_method.c +++ b/vm_method.c @@ -191,7 +191,7 @@ lookup_method_table(VALUE klass, ID id) } static VALUE -(*call_cfunc_invoker_func(int argc))(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *) +(*call_cfunc_invoker_func(int argc))(VALUE recv, int argc, const VALUE *, VALUE (*func)(ANYARGS)) { switch (argc) { case -2: return &call_cfunc_m2; -- cgit v1.2.3