@@ -2656,18 +2656,21 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
2656
2656
comp_ctx -> comp_data = comp_data ;
2657
2657
2658
2658
/* Create LLVM context, module and builder */
2659
- comp_ctx -> orc_thread_safe_context = LLVMOrcCreateNewThreadSafeContext ();
2660
- if (!comp_ctx -> orc_thread_safe_context ) {
2661
- aot_set_last_error ("create LLVM ThreadSafeContext failed." );
2659
+ /* Construct an LLVMContext directly, note:
2660
+ different from non LAZY JIT mode, no need to dispose this context, if
2661
+ will be disposed when the thread safe context is disposed */
2662
+ comp_ctx -> context = LLVMContextCreate ();
2663
+ if (!comp_ctx -> context ) {
2664
+ aot_set_last_error ("create LLVM Context failed." );
2662
2665
goto fail ;
2663
2666
}
2664
2667
2665
- /* Get a reference to the underlying LLVMContext, note:
2666
- different from non LAZY JIT mode, no need to dispose this context,
2667
- if will be disposed when the thread safe context is disposed */
2668
- if (!( comp_ctx -> context = LLVMOrcThreadSafeContextGetContext (
2669
- comp_ctx -> orc_thread_safe_context ))) {
2670
- aot_set_last_error ( "get context from LLVM ThreadSafeContext failed." );
2668
+ /* Wrap the LLVM context in a thread safe context. */
2669
+ comp_ctx -> orc_thread_safe_context =
2670
+ LLVMOrcCreateNewThreadSafeContextFromLLVMContext ( comp_ctx -> context );
2671
+ if (!comp_ctx -> orc_thread_safe_context ) {
2672
+ aot_set_last_error (
2673
+ "Create LLVM ThreadSafeContext from LLVMContext failed." );
2671
2674
goto fail ;
2672
2675
}
2673
2676
0 commit comments