Skip to content

Commit

Permalink
avoid finalizing LLVMContext on exit (#32588)
Browse files Browse the repository at this point in the history
This avoids a possible crash if another thread is trying to compile
something.
  • Loading branch information
JeffBezanson committed Jul 16, 2019
1 parent f578ada commit dfc645c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extern void _chkstk(void);
#define DISABLE_FLOAT16

// llvm state
JL_DLLEXPORT LLVMContext jl_LLVMContext;
JL_DLLEXPORT LLVMContext &jl_LLVMContext = *(new LLVMContext());
TargetMachine *jl_TargetMachine;

extern JITEventListener *CreateJuliaJITEventListener();
Expand All @@ -160,7 +160,7 @@ Module *shadow_output;
#define jl_Module ctx.f->getParent()
#define jl_builderModule(builder) (builder).GetInsertBlock()->getParent()->getParent()

static DataLayout jl_data_layout("");
static DataLayout &jl_data_layout = *(new DataLayout(""));

// types
static Type *T_jlvalue;
Expand Down
2 changes: 1 addition & 1 deletion src/jitlayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class JuliaOJIT {
SymbolTableT LocalSymbolTable;
};
extern JuliaOJIT *jl_ExecutionEngine;
JL_DLLEXPORT extern LLVMContext jl_LLVMContext;
JL_DLLEXPORT extern LLVMContext &jl_LLVMContext;

Pass *createLowerPTLSPass(bool imaging_mode);
Pass *createCombineMulAddPass();
Expand Down

0 comments on commit dfc645c

Please sign in to comment.