From 4962d92b79cc96032d669d8305269acd59290e57 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 11 Dec 2016 15:36:58 +0000 Subject: [PATCH] block_of_code: Do not regenerate prelude when clearing cache --- src/backend_x64/block_of_code.cpp | 12 +++++------- src/backend_x64/block_of_code.h | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend_x64/block_of_code.cpp b/src/backend_x64/block_of_code.cpp index 738c47cf..c6f542b8 100644 --- a/src/backend_x64/block_of_code.cpp +++ b/src/backend_x64/block_of_code.cpp @@ -19,17 +19,15 @@ namespace Dynarmic { namespace BackendX64 { BlockOfCode::BlockOfCode(UserCallbacks cb) : Xbyak::CodeGenerator(128 * 1024 * 1024), cb(cb) { - ClearCache(); -} - -void BlockOfCode::ClearCache() { - consts.~Consts(); - new (&consts) Consts(); - reset(); GenConstants(); GenRunCode(); GenReturnFromRunCode(); GenMemoryAccessors(); + user_code_begin = getCurr(); +} + +void BlockOfCode::ClearCache() { + SetCodePtr(user_code_begin); } size_t BlockOfCode::RunCode(JitState* jit_state, CodePtr basic_block, size_t cycles_to_run) const { diff --git a/src/backend_x64/block_of_code.h b/src/backend_x64/block_of_code.h index 1db798d5..b9180420 100644 --- a/src/backend_x64/block_of_code.h +++ b/src/backend_x64/block_of_code.h @@ -147,6 +147,7 @@ public: private: UserCallbacks cb; + CodePtr user_code_begin; struct Consts { Xbyak::Label FloatPositiveZero32;