- moved argsCache out of JitCompiler::CreateFuncSignature

This commit is contained in:
Magnus Norddahl 2018-12-08 23:31:55 +01:00
parent 888af3d684
commit 670d975a33

View file

@ -543,6 +543,8 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
ParamOpcodes.Clear(); ParamOpcodes.Clear();
} }
static std::map<FString, std::unique_ptr<TArray<uint8_t>>> argsCache;
asmjit::FuncSignature JitCompiler::CreateFuncSignature() asmjit::FuncSignature JitCompiler::CreateFuncSignature()
{ {
using namespace asmjit; using namespace asmjit;
@ -657,7 +659,6 @@ asmjit::FuncSignature JitCompiler::CreateFuncSignature()
} }
// FuncSignature only keeps a pointer to its args array. Store a copy of each args array variant. // FuncSignature only keeps a pointer to its args array. Store a copy of each args array variant.
static std::map<FString, std::unique_ptr<TArray<uint8_t>>> argsCache;
std::unique_ptr<TArray<uint8_t>> &cachedArgs = argsCache[key]; std::unique_ptr<TArray<uint8_t>> &cachedArgs = argsCache[key];
if (!cachedArgs) cachedArgs.reset(new TArray<uint8_t>(args)); if (!cachedArgs) cachedArgs.reset(new TArray<uint8_t>(args));