Apple M1: RAII Wrapper for JITPageWrite*Execute*()

Added RAII wrapper around the the JITPageWriteEnableExecuteDisable() and
JITPageWriteDisableExecuteEnable() to make it so that it is harder to forget to
pair the calls in all code branches as suggested by leoetlino.
This commit is contained in:
Skyler Saleh
2021-05-15 07:10:10 -07:00
parent 76130d8b3b
commit 76ed9310f2
6 changed files with 20 additions and 15 deletions

View File

@ -54,10 +54,9 @@ VertexLoaderARM64::VertexLoaderARM64(const TVtxDesc& vtx_desc, const VAT& vtx_at
: VertexLoaderBase(vtx_desc, vtx_att), m_float_emit(this)
{
AllocCodeSpace(4096);
Common::JITPageWriteEnableExecuteDisable();
const Common::ScopedJITPageWriteAndNoExecute enable_jit_page_writes;
ClearCodeSpace();
GenerateVertexLoader();
Common::JITPageWriteDisableExecuteEnable();
WriteProtect();
}