mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
extend rb_call_cache
Prior to this changeset, majority of inline cache mishits resulted into the same method entry when rb_callable_method_entry() resolves a method search. Let's not call the function at the first place on such situations. In doing so we extend the struct rb_call_cache from 44 bytes (in case of 64 bit machine) to 64 bytes, and fill the gap with secondary class serial(s). Call cache's class serials now behavies as a LRU cache. Calculating ------------------------------------- ours 2.7 2.6 vm2_poly_same_method 2.339M 1.744M 1.369M i/s - 6.000M times in 2.565086s 3.441329s 4.381386s Comparison: vm2_poly_same_method ours: 2339103.0 i/s 2.7: 1743512.3 i/s - 1.34x slower 2.6: 1369429.8 i/s - 1.71x slower
This commit is contained in:
parent
3c252651e1
commit
d45a013a1a
Notes:
git
2019-11-07 17:41:56 +09:00
6 changed files with 75 additions and 19 deletions
|
@ -21,7 +21,7 @@ grammar = %r'
|
|||
(?<keyword> typedef | extern | static | auto | register |
|
||||
struct | union | enum ){0}
|
||||
(?<C> (?: \g<block> | [^{}]+ )* ){0}
|
||||
(?<block> \{ \g<ws>* ^ \g<C> $ \g<ws>* \} ){0}
|
||||
(?<block> \{ \g<ws>* \g<C> \g<ws>* \} ){0}
|
||||
(?<ws> \g<comment> | \s ){0}
|
||||
(?<ident> [_a-zA-Z] [0-9_a-zA-Z]* ){0}
|
||||
(?<type> (?: \g<keyword> \g<ws>+ )* \g<ident> ){0}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
% # JIT: Invalidate call cache if it requires vm_search_method. This allows to inline some of following things.
|
||||
fprintf(f, " if (UNLIKELY(GET_GLOBAL_METHOD_STATE() != %"PRI_SERIALT_PREFIX"u ||\n", cc_copy->method_state);
|
||||
fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial);
|
||||
fprintf(f, " RCLASS_SERIAL(CLASS_OF(stack[%d])) != %"PRI_SERIALT_PREFIX"u)) {\n", b->stack_size - 1 - argc, cc_copy->class_serial[0]);
|
||||
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
||||
fprintf(f, " reg_cfp->sp = vm_base_ptr(reg_cfp) + %d;\n", b->stack_size);
|
||||
fprintf(f, " goto send_cancel;\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue