summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-03-10 23:18:45 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2020-03-10 23:29:50 -0700
commit9511b4c8facf583073ed8ecfd3d84710565572a6 (patch)
treecc672d91cd8e3f3acf576242532dfe9d37139154 /iseq.c
parentda6948753e8a48ac9fdc0c2f08856f51ab3d7959 (diff)
Optimize away call data refs in JIT-ed method calls
According to ko1, `cd->cc != cc` was for GC.compact guard. As we pin cc by rb_gc_mark(), we don't need the check. ``` $ benchmark-driver benchmark.yml -v --rbenv 'before --jit;after --jit' --repeat-count=12 --output=all before --jit: ruby 2.8.0dev (2020-03-11T05:36:48Z master da6948753e) +JIT [x86_64-linux] after --jit: ruby 2.8.0dev (2020-03-11T06:26:34Z master 36b20b8b4a) +JIT [x86_64-linux] Calculating ------------------------------------- before --jit after --jit Optcarrot Lan_Master.nes 74.03480698689405 71.63404803273507 fps 74.15085286586992 73.43923328104295 75.51738277744781 75.75465268365384 76.24922600109410 76.74071607861318 76.45513422802325 77.47521029238116 76.86617230739330 78.14759496269018 77.71509137131933 79.14051571125866 77.72839157096146 79.35884822673313 78.25218904561633 79.92538876408051 78.72521071333249 79.98075556706726 78.79950460165091 80.51747831497875 79.43884960720381 80.97973166525254 ```
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/iseq.c b/iseq.c
index 0697fef53b..b6d463526d 100644
--- a/iseq.c
+++ b/iseq.c
@@ -364,7 +364,8 @@ rb_iseq_mark(const rb_iseq_t *iseq)
for (unsigned int i=0; i<body->ci_size; i++) {
const struct rb_callcache *cc = cc_entries[i];
if (cc != NULL) {
- rb_gc_mark((VALUE)cc); // pindown
+ // Pin cc against GC.compact as the the address may be written in JIT-ed code.
+ rb_gc_mark((VALUE)cc);
}
}
}