I'm sorry for making this mistake and thank you for your patience.
In the next version, I will use GPtrArray you mentioned earlier to solve the problem.
Thanks, Huang Tao On 2024/3/12 21:57, Richard Henderson wrote:
On 3/11/24 19:45, Huang Tao wrote:+static void riscv_cpu_finalize_dynamic_decoder(RISCVCPU *cpu) +{ + decode_fn *dynamic_decoders; + dynamic_decoders = g_new0(decode_fn, decoder_table_size);Allocating ARRAY_SIZE(decoder_table)...+ int j = 0; + for (size_t i = 0; i < decoder_table_size; ++i) { + if (decoder_table[i].guard_func && + decoder_table[i].guard_func(&cpu->cfg)) { + dynamic_decoders[j] = decoder_table[i].decode_fn; + j++; + }Potentially enabling all elements...+ for (size_t i = 0; ctx->decoders[i]; ++i) {Reading past the end of the array expecting an extra NULL entry. r~
