Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aa44052

Browse files
committedMar 19, 2025·
remove unused argument from jl_generate_ccallable
1 parent 7d2c43b commit aa44052

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed
 

‎src/aotcompile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ void *jl_emit_native_impl(jl_array_t *codeinfos, LLVMOrcThreadSafeModuleRef llvm
789789
jl_value_t *sig = jl_svecref(item, 1);
790790
jl_value_t *nameval = jl_svec_len(item) == 2 ? jl_nothing : jl_svecref(item, 2);
791791
assert(jl_is_type(rt) && jl_is_type(sig));
792-
jl_generate_ccallable(clone.getModuleUnlocked(), nullptr, nameval, rt, sig, params);
792+
jl_generate_ccallable(clone.getModuleUnlocked(), nameval, rt, sig, params);
793793
}
794794
}
795795
// finally, make sure all referenced methods get fixed up, particularly if the user declined to compile them

‎src/codegen.cpp

+7-20
Original file line numberDiff line numberDiff line change
@@ -7709,7 +7709,7 @@ static jl_cgval_t emit_cfunction(jl_codectx_t &ctx, jl_value_t *output_type, con
77097709

77107710
// do codegen to create a C-callable alias/wrapper, or if sysimg_handle is set,
77117711
// restore one from a loaded system image.
7712-
const char *jl_generate_ccallable(Module *llvmmod, void *sysimg_handle, jl_value_t *nameval, jl_value_t *declrt, jl_value_t *sigt, jl_codegen_params_t &params)
7712+
const char *jl_generate_ccallable(Module *llvmmod, jl_value_t *nameval, jl_value_t *declrt, jl_value_t *sigt, jl_codegen_params_t &params)
77137713
{
77147714
++GeneratedCCallables;
77157715
jl_datatype_t *ft = (jl_datatype_t*)jl_tparam0(sigt);
@@ -7738,25 +7738,12 @@ const char *jl_generate_ccallable(Module *llvmmod, void *sysimg_handle, jl_value
77387738
function_sig_t sig("cfunction", lcrt, crt, toboxed, false,
77397739
argtypes, NULL, false, CallingConv::C, false, &params);
77407740
if (sig.err_msg.empty()) {
7741-
if (sysimg_handle) {
7742-
// restore a ccallable from the system image
7743-
void *addr;
7744-
int found = jl_dlsym(sysimg_handle, name, &addr, 0);
7745-
if (found)
7746-
add_named_global(name, addr);
7747-
else {
7748-
err = jl_get_exceptionf(jl_errorexception_type, "%s not found in sysimg", name);
7749-
jl_throw(err);
7750-
}
7751-
}
7752-
else {
7753-
//Safe b/c params holds context lock
7754-
Function *cw = gen_cfun_wrapper(llvmmod, params, sig, ff, name, declrt, sigt, NULL, NULL, NULL);
7755-
auto alias = GlobalAlias::create(cw->getValueType(), cw->getType()->getAddressSpace(),
7756-
GlobalValue::ExternalLinkage, name, cw, llvmmod);
7757-
if (params.TargetTriple.isOSBinFormatCOFF()) {
7758-
alias->setDLLStorageClass(GlobalValue::DLLStorageClassTypes::DLLExportStorageClass);
7759-
}
7741+
//Safe b/c params holds context lock
7742+
Function *cw = gen_cfun_wrapper(llvmmod, params, sig, ff, name, declrt, sigt, NULL, NULL, NULL);
7743+
auto alias = GlobalAlias::create(cw->getValueType(), cw->getType()->getAddressSpace(),
7744+
GlobalValue::ExternalLinkage, name, cw, llvmmod);
7745+
if (params.TargetTriple.isOSBinFormatCOFF()) {
7746+
alias->setDLLStorageClass(GlobalValue::DLLStorageClassTypes::DLLExportStorageClass);
77607747
}
77617748
JL_GC_POP();
77627749
return name;

‎src/jitlayers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ struct jl_codegen_params_t {
284284
~jl_codegen_params_t() JL_NOTSAFEPOINT JL_NOTSAFEPOINT_LEAVE = default;
285285
};
286286

287-
const char *jl_generate_ccallable(Module *llvmmod, void *sysimg_handle, jl_value_t *nameval, jl_value_t *declrt, jl_value_t *sigt, jl_codegen_params_t &params);
287+
const char *jl_generate_ccallable(Module *llvmmod, jl_value_t *nameval, jl_value_t *declrt, jl_value_t *sigt, jl_codegen_params_t &params);
288288

289289
jl_llvm_functions_t jl_emit_code(
290290
orc::ThreadSafeModule &M,

0 commit comments

Comments
 (0)
Please sign in to comment.