From c1d6b62625ebe0dfdf3fe529aaa450943dd4518f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 23 Oct 2024 12:53:50 +0200 Subject: [PATCH] Add a couple of asserts to the JitBlockCache. --- Core/MIPS/JitCommon/JitBlockCache.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index 7c04a1436a..021ee7b16c 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -87,7 +87,7 @@ JitBlockCache::~JitBlockCache() { bool JitBlock::ContainsAddress(u32 em_address) const { // WARNING - THIS DOES NOT WORK WITH JIT INLINING ENABLED. // However, that doesn't exist yet so meh. - return (em_address >= originalAddress && em_address < originalAddress + 4 * originalSize); + return em_address >= originalAddress && em_address < originalAddress + 4 * originalSize; } bool JitBlockCache::IsFull() const { @@ -146,6 +146,8 @@ const JitBlock *JitBlockCache::GetBlock(int no) const { } int JitBlockCache::AllocateBlock(u32 startAddress) { + _assert_(num_blocks_ < MAX_NUM_BLOCKS); + JitBlock &b = blocks_[num_blocks_]; b.proxyFor = 0; @@ -177,6 +179,8 @@ int JitBlockCache::AllocateBlock(u32 startAddress) { } void JitBlockCache::ProxyBlock(u32 rootAddress, u32 startAddress, u32 size, const u8 *codePtr) { + _assert_(num_blocks_ < MAX_NUM_BLOCKS); + // If there's an existing block at the startAddress, add rootAddress as a proxy root of that block // instead of creating a new block. int num = GetBlockNumberFromStartAddress(startAddress, false);