1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[JITLink] Add a synchronous version of finalize for convenience.

This will be used by upcoming patches that implement indirection utils
(reentry, reentry trampolines, and stubs) on top of
JITLinkMemoryManager to unify in-process and cross-process lazy
compilation support.
This commit is contained in:
Lang Hames 2020-07-12 21:49:17 -07:00
parent f77d61cf7b
commit e88280801b

View File

@ -17,7 +17,9 @@
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Memory.h"
#include <cstdint>
#include <future>
namespace llvm {
namespace jitlink {
@ -74,6 +76,15 @@ public:
/// working memory.
virtual void finalizeAsync(FinalizeContinuation OnFinalize) = 0;
/// Calls finalizeAsync and waits for completion.
Error finalize() {
std::promise<Error> FinalizeResultP;
auto FinalizeResultF = FinalizeResultP.get_future();
finalizeAsync(
[&](Error Err) { FinalizeResultP.set_value(std::move(Err)); });
return FinalizeResultF.get();
}
/// Should deallocate target memory.
virtual Error deallocate() = 0;
};