summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp11
2 files changed, 12 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index afa2353d847..3407fa954ff 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -11164,7 +11164,7 @@
"description": "gallivm: orcjit: use atexit to release LPJit singleton at exit",
"nominated": false,
"nomination_type": 3,
- "resolution": 4,
+ "resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp
index 86cb0e82390..f38db3a57fb 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init_orc.cpp
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
#include <mutex>
+#include <cstdlib>
#include "lp_bld.h"
#include "lp_bld_debug.h"
#include "lp_bld_init.h"
@@ -102,6 +103,8 @@ public:
class LPJit;
+void lpjit_exit();
+
class LLVMEnsureMultithreaded {
public:
LLVMEnsureMultithreaded()
@@ -270,11 +273,14 @@ private:
LPJit(const LPJit&) = delete;
LPJit& operator=(const LPJit&) = delete;
+ friend void lpjit_exit();
+
static void init_native_targets();
llvm::orc::JITTargetMachineBuilder create_jtdb();
static void init_lpjit() {
jit = new LPJit;
+ std::atexit(lpjit_exit);
}
static LPJit* jit;
@@ -293,6 +299,11 @@ private:
LPJit* LPJit::jit = NULL;
+void lpjit_exit()
+{
+ delete LPJit::jit;
+}
+
LLVMErrorRef module_transform(void *Ctx, LLVMModuleRef mod) {
struct lp_passmgr *mgr;