translate-all: consolidate tb init in tb_gen_code

We are partially initializing tb in tb_alloc. Instead, fully
initialize it in tb_gen_code, which is tb_alloc's only caller.

This saves an unnecessary write to tb->cflags.

Backports commit 2b48e10f888059a98043b4816769fa2a326a1d2c from qemu
This commit is contained in:
Emilio G. Cota 2018-03-03 17:08:15 -05:00 committed by Lioncash
parent d3ada2feb5
commit f50e6cfa11
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -879,9 +879,6 @@ static TranslationBlock *tb_alloc(struct uc_struct *uc, target_ulong pc)
ctx->tbs = g_renew(TranslationBlock *, ctx->tbs, ctx->tbs_size); ctx->tbs = g_renew(TranslationBlock *, ctx->tbs, ctx->tbs_size);
} }
ctx->tbs[ctx->nb_tbs++] = tb; ctx->tbs[ctx->nb_tbs++] = tb;
tb->pc = pc;
tb->cflags = 0;
tb->invalid = false;
return tb; return tb;
} }
@ -1342,9 +1339,11 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
} }
gen_code_buf = tcg_ctx->code_gen_ptr; gen_code_buf = tcg_ctx->code_gen_ptr;
tb->tc_ptr = gen_code_buf; tb->tc_ptr = gen_code_buf;
tb->pc = pc;
tb->cs_base = cs_base; tb->cs_base = cs_base;
tb->flags = flags; tb->flags = flags;
tb->cflags = cflags; tb->cflags = cflags;
tb->invalid = false;
#ifdef CONFIG_PROFILER #ifdef CONFIG_PROFILER
tcg_ctx->tb_count1++; /* includes aborted translations because of tcg_ctx->tb_count1++; /* includes aborted translations because of