DBG: Use a single thread in LinearPass if the supplied data set is too small
This commit is contained in:
parent
a80e03988d
commit
74a22ca503
|
|
@ -68,4 +68,9 @@ uint AnalysisPass::IdealThreadCount()
|
|||
}
|
||||
|
||||
return m_InternalMaxThreads;
|
||||
}
|
||||
|
||||
void AnalysisPass::SetIdealThreadCount(uint Count)
|
||||
{
|
||||
m_InternalMaxThreads = (BYTE)min(Count, 255);
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ protected:
|
|||
void AcquireExclusiveLock();
|
||||
void ReleaseExclusiveLock();
|
||||
uint IdealThreadCount();
|
||||
void SetIdealThreadCount(uint Count);
|
||||
|
||||
private:
|
||||
SRWLOCK m_InternalLock;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@
|
|||
LinearPass::LinearPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks)
|
||||
: AnalysisPass(VirtualStart, VirtualEnd, MainBlocks)
|
||||
{
|
||||
// This is a fix for when the total data analysis size is less
|
||||
// than what parallelization can support. The minimum size requirement
|
||||
// is ((# THREADS) * (512)) bytes. If the requirement isn't met,
|
||||
// scale to use a single thread.
|
||||
if((512 * IdealThreadCount()) >= m_DataSize)
|
||||
SetIdealThreadCount(1);
|
||||
}
|
||||
|
||||
LinearPass::~LinearPass()
|
||||
|
|
@ -25,12 +31,6 @@ bool LinearPass::Analyse()
|
|||
// THREAD_WORK = (TOTAL / # THREADS)
|
||||
uint workAmount = m_DataSize / IdealThreadCount();
|
||||
|
||||
if(workAmount <= 0)
|
||||
{
|
||||
dprintf("Error: Total instruction data size is too small to analyse.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize thread vector
|
||||
auto threadBlocks = new std::vector<BasicBlock>[IdealThreadCount()];
|
||||
|
||||
|
|
@ -47,8 +47,6 @@ bool LinearPass::Analyse()
|
|||
threadWorkStop = min((threadWorkStop + 256), m_VirtualEnd);
|
||||
}
|
||||
|
||||
dprintf("Boundaries: 0x%p 0x%p\n", threadWorkStart, threadWorkStop);
|
||||
|
||||
// Memory allocation optimization
|
||||
// TODO: Option to conserve memory
|
||||
threadBlocks[i].reserve(100000);
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ bool MemIsCanonicalAddress(uint Address)
|
|||
// 0xFFFF800000000000 = Significant 16 bits set
|
||||
// 0x0000800000000000 = 48th bit set
|
||||
return (((Address & 0xFFFF800000000000) + 0x800000000000) & ~0x800000000000) == 0;
|
||||
#endif // _WIN64
|
||||
#endif // ndef _WIN64
|
||||
}
|
||||
|
||||
void* MemAllocRemote(uint Address, SIZE_T Size, DWORD Protect)
|
||||
|
|
|
|||
Loading…
Reference in New Issue