mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Make block invalidation a bit faster.
This commit is contained in:
parent
c4514303d9
commit
09e179cba0
2 changed files with 7 additions and 7 deletions
|
@ -67,7 +67,7 @@ typedef std::multimap<uint32, BLOCK_OUT_LINK> BlockOutLinkMap;
|
|||
//to their outgoing link definitions inside the map
|
||||
typedef BlockOutLinkMap::iterator BlockOutLinkPointer;
|
||||
|
||||
class CBasicBlock
|
||||
class CBasicBlock : public std::enable_shared_from_this<CBasicBlock>
|
||||
{
|
||||
public:
|
||||
CBasicBlock(CMIPS&, uint32 = MIPS_INVALID_PC, uint32 = MIPS_INVALID_PC, BLOCK_CATEGORY = BLOCK_CATEGORY_UNKNOWN);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <unordered_set>
|
||||
#include "MIPS.h"
|
||||
#include "BasicBlock.h"
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
typedef std::list<BasicBlockPtr> BlockList;
|
||||
typedef std::unordered_set<BasicBlockPtr> BlockStore;
|
||||
|
||||
bool HasBlockAt(uint32 address) const
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ protected:
|
|||
auto block = BlockFactory(m_context, start, end);
|
||||
ResetBlockOutLinks(block.get());
|
||||
m_blockLookup.AddBlock(block.get());
|
||||
m_blocks.push_back(std::move(block));
|
||||
m_blocks.insert(std::move(block));
|
||||
}
|
||||
|
||||
void ResetBlockOutLinks(CBasicBlock* block)
|
||||
|
@ -311,13 +311,13 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
if(!clearedBlocks.empty())
|
||||
for(auto* clearedBlock : clearedBlocks)
|
||||
{
|
||||
m_blocks.remove_if([&](const BasicBlockPtr& block) { return clearedBlocks.find(block.get()) != std::end(clearedBlocks); });
|
||||
m_blocks.erase(clearedBlock->shared_from_this());
|
||||
}
|
||||
}
|
||||
|
||||
BlockList m_blocks;
|
||||
BlockStore m_blocks;
|
||||
BasicBlockPtr m_emptyBlock;
|
||||
BlockOutLinkMap m_blockOutLinks;
|
||||
CMIPS& m_context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue