tcg: Add TCG_MAX_INSNS

Adjust all translators to respect it.

Backports commit 190ce7fbc79fd0883a6170d7f30da59d366e6830 from qemu
This commit is contained in:
Lioncash 2018-02-16 08:07:27 -05:00
parent ecfc306668
commit b115c5509d
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
7 changed files with 29 additions and 5 deletions

View file

@ -11285,6 +11285,9 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu,
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
tcg_clear_temp_count();

View file

@ -11433,8 +11433,12 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu,
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0)
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
tcg_clear_temp_count();

View file

@ -8665,8 +8665,12 @@ static inline void gen_intermediate_code_internal(uint8_t *gen_opc_cc_op,
dc->is_jmp = DISAS_NEXT;
lj = -1;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0)
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
// Unicorn: trace this block on request
// Only hook this block if the previous block was not truncated due to space

View file

@ -3087,8 +3087,12 @@ gen_intermediate_code_internal(M68kCPU *cpu, TranslationBlock *tb,
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0)
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {

View file

@ -19744,8 +19744,12 @@ gen_intermediate_code_internal(MIPSCPU *cpu, TranslationBlock *tb,
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0)
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
LOG_DISAS("\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hflags);
// Unicorn: early check to see if the address of this block is the until address

View file

@ -5396,8 +5396,12 @@ static inline void gen_intermediate_code_internal(SPARCCPU *cpu,
}
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0)
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
if (max_insns > TCG_MAX_INSNS) {
max_insns = TCG_MAX_INSNS;
}
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {

View file

@ -197,6 +197,7 @@ typedef struct TCGPool {
#define TCG_POOL_CHUNK_SIZE 32768
#define TCG_MAX_TEMPS 512
#define TCG_MAX_INSNS 512
/* when the size of the arguments of a called function is smaller than
this value, they are statically allocated in the TB stack frame */