Skip to content

Commit e057538

Browse files
committed
RISC-V: One time CSR hash table initialization
The current disassembler intends to initialize the CSR hash table when CSR name parsing is required at the first time. This is managed by a function- scope static variable init_csr but... there's a problem. It's never set to true. Because of this issue, current disassembler actually initializes the CSR hash table every time when CSR name parsing is required. This commit sets init_csr to true once the CSR hash table is initialized. This commit alone will not affect real world performance that much but after the efficient opcode hash is implemented, it will be much effective (sometimes >x10 effect than this commit alone) so that even some regular programs can benefit from it. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Make sure that CSR hash table initialization occurs only once.
1 parent 22b0d5a commit e057538

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

opcodes/riscv-dis.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
566566
DECLARE_CSR (name, num, class, define_version, abort_version)
567567
#include "opcode/riscv-opc.h"
568568
#undef DECLARE_CSR
569+
init_csr = true;
569570
}
570571

571572
if (riscv_csr_hash[csr] != NULL)

0 commit comments

Comments
 (0)