mirror of
https://github.com/libretro/Play-.git
synced 2025-02-12 20:29:11 +00:00
Cleanup.
This commit is contained in:
parent
f2efd66b88
commit
9c9b7654c7
@ -71,8 +71,8 @@ void CMipsExecutor::ClearActiveBlocksInRangeInternal(uint32 start, uint32 end, C
|
|||||||
|
|
||||||
for(uint32 hi = hiStart; hi <= hiEnd; hi++)
|
for(uint32 hi = hiStart; hi <= hiEnd; hi++)
|
||||||
{
|
{
|
||||||
CBasicBlock** table = m_blockTable[hi];
|
auto table = m_blockTable[hi];
|
||||||
if(table == nullptr) continue;
|
if(!table) continue;
|
||||||
|
|
||||||
for(uint32 lo = 0; lo < SUBTABLE_SIZE; lo += 4)
|
for(uint32 lo = 0; lo < SUBTABLE_SIZE; lo += 4)
|
||||||
{
|
{
|
||||||
@ -161,9 +161,9 @@ CBasicBlock* CMipsExecutor::FindBlockAt(uint32 address) const
|
|||||||
uint32 hiAddress = address >> SUBTABLE_BITS;
|
uint32 hiAddress = address >> SUBTABLE_BITS;
|
||||||
uint32 loAddress = address & SUBTABLE_MASK;
|
uint32 loAddress = address & SUBTABLE_MASK;
|
||||||
assert(hiAddress < m_subTableCount);
|
assert(hiAddress < m_subTableCount);
|
||||||
CBasicBlock**& subTable = m_blockTable[hiAddress];
|
auto& subTable = m_blockTable[hiAddress];
|
||||||
if(subTable == NULL) return NULL;
|
if(!subTable) return nullptr;
|
||||||
CBasicBlock* result = subTable[loAddress / 4];
|
auto result = subTable[loAddress / 4];
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,12 +172,12 @@ CBasicBlock* CMipsExecutor::FindBlockStartingAt(uint32 address) const
|
|||||||
uint32 hiAddress = address >> SUBTABLE_BITS;
|
uint32 hiAddress = address >> SUBTABLE_BITS;
|
||||||
uint32 loAddress = address & SUBTABLE_MASK;
|
uint32 loAddress = address & SUBTABLE_MASK;
|
||||||
assert(hiAddress < m_subTableCount);
|
assert(hiAddress < m_subTableCount);
|
||||||
CBasicBlock**& subTable = m_blockTable[hiAddress];
|
auto& subTable = m_blockTable[hiAddress];
|
||||||
if(subTable == NULL) return NULL;
|
if(!subTable) return nullptr;
|
||||||
CBasicBlock* result = subTable[loAddress / 4];
|
auto result = subTable[loAddress / 4];
|
||||||
if((address != 0) && (FindBlockAt(address - 4) == result))
|
if((address != 0) && (FindBlockAt(address - 4) == result))
|
||||||
{
|
{
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ CBasicBlock* CMipsExecutor::FindBlockStartingAt(uint32 address) const
|
|||||||
void CMipsExecutor::CreateBlock(uint32 start, uint32 end)
|
void CMipsExecutor::CreateBlock(uint32 start, uint32 end)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
CBasicBlock* block = FindBlockAt(start);
|
auto block = FindBlockAt(start);
|
||||||
if(block)
|
if(block)
|
||||||
{
|
{
|
||||||
//If the block starts and ends at the same place, block already exists and doesn't need
|
//If the block starts and ends at the same place, block already exists and doesn't need
|
||||||
@ -201,13 +201,13 @@ void CMipsExecutor::CreateBlock(uint32 start, uint32 end)
|
|||||||
//Repartition the existing block if end of both blocks are the same
|
//Repartition the existing block if end of both blocks are the same
|
||||||
DeleteBlock(block);
|
DeleteBlock(block);
|
||||||
CreateBlock(otherBegin, start - 4);
|
CreateBlock(otherBegin, start - 4);
|
||||||
assert(FindBlockAt(start) == NULL);
|
assert(!FindBlockAt(start));
|
||||||
}
|
}
|
||||||
else if(otherBegin == start)
|
else if(otherBegin == start)
|
||||||
{
|
{
|
||||||
DeleteBlock(block);
|
DeleteBlock(block);
|
||||||
CreateBlock(end + 4, otherEnd);
|
CreateBlock(end + 4, otherEnd);
|
||||||
assert(FindBlockAt(end) == NULL);
|
assert(!FindBlockAt(end));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -217,7 +217,7 @@ void CMipsExecutor::CreateBlock(uint32 start, uint32 end)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(FindBlockAt(end) == NULL);
|
assert(!FindBlockAt(end));
|
||||||
{
|
{
|
||||||
auto block = BlockFactory(m_context, start, end);
|
auto block = BlockFactory(m_context, start, end);
|
||||||
for(uint32 address = block->GetBeginAddress(); address <= block->GetEndAddress(); address += 4)
|
for(uint32 address = block->GetBeginAddress(); address <= block->GetEndAddress(); address += 4)
|
||||||
@ -225,14 +225,14 @@ void CMipsExecutor::CreateBlock(uint32 start, uint32 end)
|
|||||||
uint32 hiAddress = address >> SUBTABLE_BITS;
|
uint32 hiAddress = address >> SUBTABLE_BITS;
|
||||||
uint32 loAddress = address & SUBTABLE_MASK;
|
uint32 loAddress = address & SUBTABLE_MASK;
|
||||||
assert(hiAddress < m_subTableCount);
|
assert(hiAddress < m_subTableCount);
|
||||||
CBasicBlock**& subTable = m_blockTable[hiAddress];
|
auto& subTable = m_blockTable[hiAddress];
|
||||||
if(subTable == NULL)
|
if(!subTable)
|
||||||
{
|
{
|
||||||
const uint32 subTableSize = SUBTABLE_SIZE / 4;
|
const uint32 subTableSize = SUBTABLE_SIZE / 4;
|
||||||
subTable = new CBasicBlock*[subTableSize];
|
subTable = new CBasicBlock*[subTableSize];
|
||||||
memset(subTable, 0, sizeof(CBasicBlock*) * subTableSize);
|
memset(subTable, 0, sizeof(CBasicBlock*) * subTableSize);
|
||||||
}
|
}
|
||||||
assert(subTable[loAddress / 4] == NULL);
|
assert(!subTable[loAddress / 4]);
|
||||||
subTable[loAddress / 4] = block.get();
|
subTable[loAddress / 4] = block.get();
|
||||||
}
|
}
|
||||||
m_blocks.push_back(std::move(block));
|
m_blocks.push_back(std::move(block));
|
||||||
@ -246,10 +246,10 @@ void CMipsExecutor::DeleteBlock(CBasicBlock* block)
|
|||||||
uint32 hiAddress = address >> SUBTABLE_BITS;
|
uint32 hiAddress = address >> SUBTABLE_BITS;
|
||||||
uint32 loAddress = address & SUBTABLE_MASK;
|
uint32 loAddress = address & SUBTABLE_MASK;
|
||||||
assert(hiAddress < m_subTableCount);
|
assert(hiAddress < m_subTableCount);
|
||||||
CBasicBlock**& subTable = m_blockTable[hiAddress];
|
auto& subTable = m_blockTable[hiAddress];
|
||||||
assert(subTable != NULL);
|
assert(subTable);
|
||||||
assert(subTable[loAddress / 4] != NULL);
|
assert(subTable[loAddress / 4]);
|
||||||
subTable[loAddress / 4] = NULL;
|
subTable[loAddress / 4] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove block from our lists
|
//Remove block from our lists
|
||||||
|
Loading…
x
Reference in New Issue
Block a user