aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_compile.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-05-17 22:47:20 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2020-05-17 23:38:19 -0700
commitb16a2aa938d091c387a7437d94dac7f7bb829ba2 (patch)
treec2f7fc935353eed7e349c13e3b15339accba3f15 /mjit_compile.c
parentafd84c58acfe9126d31c3f7673b049f11b67b095 (diff)
downloadruby-b16a2aa938d091c387a7437d94dac7f7bb829ba2.tar.gz
Reduce code size for rb_class_of
by inlining only hot path. === mame/optcarrot === $ benchmark-driver -v --rbenv 'before --jit;after --jit' benchmark.yml --repeat-count=24 --output=all before --jit: ruby 2.8.0dev (2020-05-18T05:21:31Z master 0e5a58b6bf) +JIT [x86_64-linux] after --jit: ruby 2.8.0dev (2020-05-18T06:12:04Z master 0e3d71a8d1) +JIT [x86_64-linux] last_commit=Reduce code size for rb_class_of Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 71.62880463568773 70.95730063273503 fps 71.73973684273152 71.98447841929851 75.03923801841310 75.54262519509039 75.16300287174957 77.64029272984344 75.16834828625935 78.67861469580785 75.17670723726911 78.81879353707393 75.67637908020630 79.18188850392886 76.19843953215396 79.66484891814478 77.28166716118808 79.80278072861037 77.38509903325165 80.05859292679696 78.12693418455953 80.34624804808006 78.73654441746730 80.66326571254345 79.25387513454415 80.69760605740196 79.44137881689524 81.32053489212245 79.50497657368358 81.50250852553751 79.62401328582868 82.27544931834611 79.79178811723664 82.67455264522741 81.20275352937418 82.93857260493297 81.57027048640776 83.15019118788184 81.63373188649095 83.20728816044721 81.93420437766426 83.25027576772972 82.05716136357167 83.27072145898173 82.21070805525066 83.36008265822194 82.56924063784872 83.36112268888493 === benchmark-driver/sinatra === [rps] before: 13143.49 rps after: 13505.70 rps [inlined rb_class_of size] before: 11.5K after: 3.8K (calculated by `dwarftree --die inlined_subroutine --flat --merge --show-size`)
Diffstat (limited to 'mjit_compile.c')
-rw-r--r--mjit_compile.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mjit_compile.c b/mjit_compile.c
index fe75b45141..589ac50c85 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -114,6 +114,23 @@ fastpath_applied_iseq_p(const CALL_INFO ci, const CALL_CACHE cc, const rb_iseq_t
&& vm_call_iseq_optimizable_p(ci, cc); // CC_SET_FASTPATH condition
}
+// Return true if an object of the klass may be a special const. See: rb_class_of
+static bool
+maybe_special_const_class_p(const VALUE klass)
+{
+ if (klass == rb_cFalseClass
+ || klass == rb_cNilClass
+ || klass == rb_cTrueClass
+ || klass == rb_cInteger
+ || klass == rb_cSymbol
+ || klass == rb_cFloat) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
static int
compile_case_dispatch_each(VALUE key, VALUE value, VALUE arg)
{