Skip to content

Commit

Permalink
Add world argument to jl_create_native. (#48746)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0975906)
  • Loading branch information
maleadt authored and KristofferC committed Feb 21, 2023
1 parent b5d9781 commit 50b8c13
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void replaceUsesWithLoad(Function &F, function_ref<GlobalVariable *(Instruction
// `_imaging_mode` controls if raw pointers can be embedded (e.g. the code will be loaded into the same session).
// `_external_linkage` create linkages between pkgimages.
extern "C" JL_DLLEXPORT
void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvmmod, const jl_cgparams_t *cgparams, int _policy, int _imaging_mode, int _external_linkage)
void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvmmod, const jl_cgparams_t *cgparams, int _policy, int _imaging_mode, int _external_linkage, size_t _world)
{
++CreateNativeCalls;
CreateNativeMax.updateMax(jl_array_len(methods));
Expand Down Expand Up @@ -307,7 +307,7 @@ void *jl_create_native_impl(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvm
params.params = cgparams;
params.imaging = imaging;
params.external_linkage = _external_linkage;
size_t compile_for[] = { jl_typeinf_world, jl_atomic_load_acquire(&jl_world_counter) };
size_t compile_for[] = { jl_typeinf_world, _world };
for (int worlds = 0; worlds < 2; worlds++) {
params.world = compile_for[worlds];
if (!params.world)
Expand Down
2 changes: 1 addition & 1 deletion src/codegen-stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ JL_DLLEXPORT size_t jl_jit_total_bytes_fallback(void)
return 0;
}

JL_DLLEXPORT void *jl_create_native_fallback(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvmmod, const jl_cgparams_t *cgparams, int _policy, int _imaging_mode, int _external_linkage) UNAVAILABLE
JL_DLLEXPORT void *jl_create_native_fallback(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvmmod, const jl_cgparams_t *cgparams, int _policy, int _imaging_mode, int _external_linkage, size_t _world) UNAVAILABLE

JL_DLLEXPORT void jl_dump_compiles_fallback(void *s)
{
Expand Down
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ JL_DLLEXPORT jl_value_t *jl_dump_fptr_asm(uint64_t fptr, char raw_mc, const char
JL_DLLEXPORT jl_value_t *jl_dump_function_ir(jl_llvmf_dump_t *dump, char strip_ir_metadata, char dump_module, const char *debuginfo);
JL_DLLEXPORT jl_value_t *jl_dump_function_asm(jl_llvmf_dump_t *dump, char raw_mc, const char* asm_variant, const char *debuginfo, char binary);

void *jl_create_native(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvmmod, const jl_cgparams_t *cgparams, int policy, int imaging_mode, int cache);
void *jl_create_native(jl_array_t *methods, LLVMOrcThreadSafeModuleRef llvmmod, const jl_cgparams_t *cgparams, int policy, int imaging_mode, int cache, size_t world);
void jl_dump_native(void *native_code,
const char *bc_fname, const char *unopt_bc_fname, const char *obj_fname, const char *asm_fname,
const char *sysimg_data, size_t sysimg_len, ios_t *s);
Expand Down
3 changes: 2 additions & 1 deletion src/precompile_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ static void *jl_precompile_(jl_array_t *m, int external_linkage)
jl_array_ptr_1d_push(m2, item);
}
}
void *native_code = jl_create_native(m2, NULL, NULL, 0, 1, external_linkage);
void *native_code = jl_create_native(m2, NULL, NULL, 0, 1, external_linkage,
jl_atomic_load_acquire(&jl_world_counter));
JL_GC_POP();
return native_code;
}
Expand Down

0 comments on commit 50b8c13

Please sign in to comment.