Skip to content

riscv_dis_opt2_gdb_cache

Tsukasa OI edited this page Oct 9, 2022 · 4 revisions

Disassembler: Optimization: Cache per-BFD disassembler

Feature Description

On RISC-V, calling the disassembler function (libopcodes) is not a small cost. This is because riscv_get_disassembler function sets the default architecture from given BFD's .riscv.attributes section. However, by default, GDB calls this function for every instruction.

This commit replaces RISC-V's disassembler function and stop calling riscv_get_disassembler function if current BFD has not changed.

It expects around 30-80% improvements on disassembling relatively large chunk of RISC-V code but most of them will be obscured by a RISC-V disassembler optimization the author is currently working on. Still, 3-5% of performance improvements will remain (due to reduced BFD section reads).

Request for Comments

I'm confident that most of BFD contents won't change so dynamically on GDB and caching itself is not a bad idea. Still, I'm not sure whether this usage of static variables is okay.

Clone this wiki locally