Skip to content

Commit d073706

Browse files
pbo-linarostsquad
authored andcommitted
contrib/plugins/howvec: ensure we don't regress if this plugin is extended
Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Pierrick Bouvier <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]>
1 parent c7c4300 commit d073706

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/plugins/howvec.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ static struct qemu_plugin_scoreboard *find_counter(
253253
int i;
254254
uint64_t *cnt = NULL;
255255
uint32_t opcode = 0;
256+
/* if opcode is greater than 32 bits, we should refactor insn hash table. */
257+
G_STATIC_ASSERT(sizeof(opcode) == sizeof(uint32_t));
256258
InsnClassExecCount *class = NULL;
257259

258260
/*
@@ -284,7 +286,7 @@ static struct qemu_plugin_scoreboard *find_counter(
284286

285287
g_mutex_lock(&lock);
286288
icount = (InsnExecCount *) g_hash_table_lookup(insns,
287-
GUINT_TO_POINTER(opcode));
289+
(gpointer)(intptr_t) opcode);
288290

289291
if (!icount) {
290292
icount = g_new0(InsnExecCount, 1);
@@ -295,8 +297,7 @@ static struct qemu_plugin_scoreboard *find_counter(
295297
qemu_plugin_scoreboard_new(sizeof(uint64_t));
296298
icount->count = qemu_plugin_scoreboard_u64(score);
297299

298-
g_hash_table_insert(insns, GUINT_TO_POINTER(opcode),
299-
(gpointer) icount);
300+
g_hash_table_insert(insns, (gpointer)(intptr_t) opcode, icount);
300301
}
301302
g_mutex_unlock(&lock);
302303

0 commit comments

Comments
 (0)