summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-06 20:57:48 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-06 20:57:48 (GMT)
commit609939f8c6cb595eaa7d36eee030e8c10c6f6ad9 (patch)
treee6847c611729466e42797fb4eff4d175d2b6a901 /vm_core.h
parent0dc50688926fbd424cfa75f436fc1d59b479a1e1 (diff)
rb_vm_insn_addr2insn: use st to perform addr2insn mapping
The current VM_INSTRUCTION_SIZE is 198, so the linear search painful during a major GC phase. I noticed rb_vm_insn_addr2insn2 showing up at the top of some profiles while working on some malloc-related stuff, so I decided to attack it. Most notably, the benchmark/bm_vm3_gc.rb improves by over 40%: https://80x24.org/spew/20180602220554.GA9991@whir/raw [ruby-core:87361] [Feature #14814] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/vm_core.h b/vm_core.h
index 8e34ff1..0a185a6 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -144,6 +144,11 @@ void *rb_register_sigaltstack(void);
#endif /* OPT_STACK_CACHING */
#endif /* OPT_CALL_THREADED_CODE */
+#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
+void rb_addr2insn_init(void);
+#else
+static inline void rb_addr2insn_init(void) { }
+#endif
typedef unsigned long rb_num_t;
typedef signed long rb_snum_t;