qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 14/54] plugin: add core code


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v4 14/54] plugin: add core code
Date: Thu, 1 Aug 2019 08:58:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

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 <address@hidden>


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]