LLVM: Add explicit resource-freeing at emulation stop
This commit is contained in:
@@ -498,6 +498,8 @@ namespace llvm
|
||||
class StringRef;
|
||||
}
|
||||
|
||||
enum class thread_state : u32;
|
||||
|
||||
// Temporary compiler interface
|
||||
class jit_compiler final
|
||||
{
|
||||
@@ -515,6 +517,7 @@ class jit_compiler final
|
||||
|
||||
public:
|
||||
jit_compiler(const std::unordered_map<std::string, u64>& _link, const std::string& _cpu, u32 flags = 0, std::function<u64(const std::string&)> symbols_cement = {}) noexcept;
|
||||
jit_compiler& operator=(thread_state) noexcept;
|
||||
~jit_compiler() noexcept;
|
||||
|
||||
// Get LLVM context
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "util/types.hpp"
|
||||
#include "util/sysinfo.hpp"
|
||||
#include "Utilities/Thread.h"
|
||||
#include "JIT.h"
|
||||
#include "StrFmt.h"
|
||||
#include "File.h"
|
||||
@@ -718,6 +719,18 @@ jit_compiler::jit_compiler(const std::unordered_map<std::string, u64>& _link, co
|
||||
}
|
||||
}
|
||||
|
||||
jit_compiler& jit_compiler::operator=(thread_state s) noexcept
|
||||
{
|
||||
if (s == thread_state::destroying_context)
|
||||
{
|
||||
// Release resources explicitly
|
||||
m_engine.reset();
|
||||
m_context.reset();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
jit_compiler::~jit_compiler() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user