shrec: Limit max blocksize to 511 shops

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-07-28 19:02:49 +02:00
parent f1a6f04dce
commit a82f9704d6
1 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,9 @@
#include "hw/sh4/sh4_mem.h"
#include "decoder_opcodes.h"
#define BLOCK_MAX_SH_OPS_SOFT 500
#define BLOCK_MAX_SH_OPS_HARD 511
RuntimeBlockInfo* blk;
@ -1054,7 +1057,10 @@ void dec_DecodeBlock(RuntimeBlockInfo* rbi,u32 max_cycles)
//there is no break here by design
case NDO_NextOp:
{
if (blk->guest_cycles>=max_cycles && !state.cpu.is_delayslot)
if (
( (blk->oplist.size() >= BLOCK_MAX_SH_OPS_SOFT) || (blk->guest_cycles >= max_cycles) )
&& !state.cpu.is_delayslot
)
{
dec_End(state.cpu.rpc,BET_StaticJump,false);
}
@ -1142,6 +1148,8 @@ _end:
blk->NextBlock=state.NextAddr;
blk->BranchBlock=state.JumpAddr;
blk->BlockType=state.BlockType;
verify(blk->oplist.size() <= BLOCK_MAX_SH_OPS_HARD);
#if HOST_OS == OS_WINDOWS
switch(rbi->addr)