calebzulawski/multiversion

Fix performance when using retpolines

calebzulawski opened this issue · 1 comments

retpolines are used to harden against speculative load vulnerabilities with indirect function calls. This can be enabled with the retpoline target feature in Rust.

Performance when branching via static function pointer suffers--in some benchmarks I noticed overhead increasing from <1 cycle to ~20 cycles when enabling retpolines. Fortunately, branch prediction is very fast for something like multiversioning where the same branch is always taken. Currently direct branching is used by generic functions, but the dispatcher should be modified to use direct branching for all function types.