mirror of
				https://github.com/yuzu-emu/unicorn.git
				synced 2025-11-04 13:54:48 +00:00 
			
		
		
		
	tcg: Add TCG_MAX_INSNS
Adjust all translators to respect it. Backports commit 190ce7fbc79fd0883a6170d7f30da59d366e6830 from qemu
This commit is contained in:
		
							parent
							
								
									ecfc306668
								
							
						
					
					
						commit
						b115c5509d
					
				| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue