From d45a013a1a3bcc860e6f7f303220b3297e2abdbc Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Mon, 7 Oct 2019 12:59:57 +0900 Subject: 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 --- mjit_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mjit_compile.c') diff --git a/mjit_compile.c b/mjit_compile.c index 27ea836ef4..bf5143f6ed 100644 --- a/mjit_compile.c +++ b/mjit_compile.c @@ -87,7 +87,7 @@ has_valid_method_type(CALL_CACHE cc) { extern bool mjit_valid_class_serial_p(rb_serial_t class_serial); return GET_GLOBAL_METHOD_STATE() == cc->method_state - && mjit_valid_class_serial_p(cc->class_serial) && cc->me; + && mjit_valid_class_serial_p(cc->class_serial[0]) && cc->me; } // Returns true if iseq can use fastpath for setup, otherwise NULL. This becomes true in the same condition -- cgit v1.2.3