-
Notifications
You must be signed in to change notification settings - Fork 1
riscv_dis_opt2_gdb_cache
- Status: First proposal was rejected due to possible unsafety. Preparing second proposal.
- Branch:
riscv-dis-opt2-gdb-cache
- Tracking PR: #70 (view Pull Request and Diff)
- Mailing List:
- RFC PATCH v1 (2022-10-09)
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).
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.
It seems it's mildly unsafe to do that and I was recommended to use GDB registry system.
I will submit second proposal after checking registry system and re-benchmarking.