On 7/31/19 9:06 AM, Alex Bennée wrote: > +static inline struct qemu_plugin_insn * qemu_plugin_insn_alloc(void) > +{ > + int i, j; > + struct qemu_plugin_insn *insn = g_new0(struct qemu_plugin_insn, 1); > + insn->data = g_byte_array_sized_new(4); > + > + for (i = 0; i < PLUGIN_N_CB_TYPES; i++) { > + for (j = 0; j < PLUGIN_N_CB_SUBTYPES; j++) { > + insn->cbs[i][j] = g_array_new(false, false, > + sizeof(struct qemu_plugin_dyn_cb)); > + } > + } > + return insn; > +} > + > +struct qemu_plugin_tb { > + GPtrArray *insns; > + size_t n; > + uint64_t vaddr; > + uint64_t vaddr2; > + void *haddr1; > + void *haddr2; > + GArray *cbs[PLUGIN_N_CB_SUBTYPES]; > +}; > + > +/** > + * qemu_plugin_tb_insn_get(): get next plugin record for translation. > + * > + */ > +static inline > +struct qemu_plugin_insn *qemu_plugin_tb_insn_get(struct qemu_plugin_tb *tb) > +{ > + struct qemu_plugin_insn *insn; > + int i, j; > + > + if (unlikely(tb->n == tb->insns->len)) { > + struct qemu_plugin_insn *new_insn = qemu_plugin_insn_alloc(); > + g_ptr_array_add(tb->insns, new_insn); > + } > + insn = g_ptr_array_index(tb->insns, tb->n++); > + g_byte_array_set_size(insn->data, 0); > + insn->calls_helpers = false; > + insn->mem_helper = false; > + > + for (i = 0; i < PLUGIN_N_CB_TYPES; i++) { > + for (j = 0; j < PLUGIN_N_CB_SUBTYPES; j++) { > + g_array_set_size(insn->cbs[i][j], 0); > + } > + } > + > + return insn; > +}
Why are these inlines in the header? They seem to be used only once in patch 20. It seems like these should be local to plugin-gen.c. Otherwise, Reviewed-by: Richard Henderson <richard.hender...@linaro.org> r~