recompilers: always allocate the first block

Avoid several annoying SIGSEGV at startup
This commit is contained in:
Gregory Hainaut 2015-11-11 15:28:56 +01:00
parent a4a0b42f8f
commit 26774a2fe0
3 changed files with 20 additions and 0 deletions

View File

@ -247,6 +247,11 @@ public:
m_blocksize = (bytes + __pagesize - 1) / __pagesize;
return m_blocksize * __pagesize;
}
virtual void Reset()
{
_parent::Reset();
}
protected:

View File

@ -73,9 +73,23 @@ void* RecompiledCodeReserve::Reserve( size_t size, uptr base, uptr upper_bounds
{
if (!_parent::Reserve(size, base, upper_bounds)) return NULL;
_registerProfiler();
// Pre-Allocate the first block (to reduce the number of segmentation fault
// in debugger)
DoCommitAndProtect(0);
return m_baseptr;
}
void RecompiledCodeReserve::Reset()
{
_parent::Reset();
// Pre-Allocate the first block (to reduce the number of segmentation fault
// in debugger)
DoCommitAndProtect(0);
}
// Sets the abbreviated name used by the profiler. Name should be under 10 characters long.
// After a name has been set, a profiler source will be automatically registered and cleared

View File

@ -42,6 +42,7 @@ public:
virtual void* Reserve( size_t size, uptr base=0, uptr upper_bounds=0 );
virtual void OnCommittedBlock( void* block );
virtual void Reset();
virtual RecompiledCodeReserve& SetProfilerName( const wxString& shortname );
virtual RecompiledCodeReserve& SetProfilerName( const char* shortname )