summaryrefslogtreecommitdiff
path: root/Source/Core/Common/CodeBlock.h
diff options
context:
space:
mode:
authorOatmealDome <OatmealDome@users.noreply.github.com>2024-07-24 01:36:39 -0400
committerGitHub <noreply@github.com>2024-07-24 01:36:39 -0400
commit87b7009c126e7792627e2eb4e5a8be52a0bc4586 (patch)
treea89c4d5a0e82aaf3219e362d0a6ca6cd668349b7 /Source/Core/Common/CodeBlock.h
parent5f4f974b48cde1965c2e46bb1e6abd3d79000271 (diff)
parent6c3024c3b1bf161c0c435640ccf5b8057a433f71 (diff)
Merge pull request #12723 from mitaclaw/cached-interpreter-2.0
Cached Interpreter 2.0
Diffstat (limited to 'Source/Core/Common/CodeBlock.h')
-rw-r--r--Source/Core/Common/CodeBlock.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/Core/Common/CodeBlock.h b/Source/Core/Common/CodeBlock.h
index 9efc82edeb..8c6291dc63 100644
--- a/Source/Core/Common/CodeBlock.h
+++ b/Source/Core/Common/CodeBlock.h
@@ -17,7 +17,7 @@ namespace Common
// having to prefix them with gen-> or something similar.
// Example implementation:
// class JIT : public CodeBlock<ARMXEmitter> {}
-template <class T>
+template <class T, bool executable = true>
class CodeBlock : public T
{
private:
@@ -53,7 +53,10 @@ public:
{
region_size = size;
total_region_size = size;
- region = static_cast<u8*>(Common::AllocateExecutableMemory(total_region_size));
+ if constexpr (executable)
+ region = static_cast<u8*>(Common::AllocateExecutableMemory(total_region_size));
+ else
+ region = static_cast<u8*>(Common::AllocateMemoryPages(total_region_size));
T::SetCodePtr(region, region + size);
}