@@ -4580,37 +4580,39 @@ static jl_cgval_t emit_expr(jl_codectx_t &ctx, jl_value_t *expr, ssize_t ssaval)
4580
4580
env = mark_julia_type (ctx, env_val, true , env_t );
4581
4581
}
4582
4582
4583
- Function *specptr = closure_m->getFunction (closure_decls.specFunctionObject );
4584
- jl_cgval_t fptr;
4585
- if (specptr) {
4586
- jl_returninfo_t returninfo = get_specsig_function (ctx, jl_Module,
4587
- closure_decls.specFunctionObject , li->specTypes , ub.constant );
4588
- fptr = mark_julia_type (ctx, returninfo.decl , false , jl_voidpointer_type);
4583
+ assert (closure_decls.functionObject != " jl_fptr_sparam" );
4584
+ bool isspecsig = closure_decls.functionObject != " jl_fptr_args" ;
4585
+
4586
+ Function *F = NULL ;
4587
+ std::string fname = isspecsig ?
4588
+ closure_decls.functionObject :
4589
+ closure_decls.specFunctionObject ;
4590
+ if (GlobalValue *V = jl_Module->getNamedValue (fname)) {
4591
+ F = cast<Function>(V);
4589
4592
}
4590
4593
else {
4591
- fptr = mark_julia_type (ctx,
4592
- (llvm::Value*)Constant::getNullValue (T_size),
4593
- false , jl_voidpointer_type);
4594
+ F = Function::Create (get_func_sig (jl_LLVMContext),
4595
+ Function::ExternalLinkage,
4596
+ fname, jl_Module);
4597
+ F->setAttributes (get_func_attrs (jl_LLVMContext));
4594
4598
}
4599
+ jl_cgval_t jlcall_ptr = mark_julia_type (ctx,
4600
+ F, false , jl_voidpointer_type);
4595
4601
4596
- jl_cgval_t jlcall_ptr;
4597
- assert (closure_decls.functionObject != " jl_fptr_sparam" );
4598
- if (closure_decls.functionObject == " jl_fptr_args" ) {
4599
- jlcall_ptr = fptr;
4600
- }
4601
- else {
4602
- Function *F = NULL ;
4603
- if (GlobalValue *V = jl_Module->getNamedValue (closure_decls.functionObject )) {
4604
- F = cast<Function>(V);
4605
- }
4606
- else {
4607
- F = Function::Create (get_func_sig (jl_LLVMContext),
4608
- Function::ExternalLinkage,
4609
- closure_decls.functionObject , jl_Module);
4610
- F->setAttributes (get_func_attrs (jl_LLVMContext));
4602
+ jl_cgval_t fptr;
4603
+ if (!isspecsig) {
4604
+ fptr = jlcall_ptr;
4605
+ } else {
4606
+ Function *specptr = closure_m->getFunction (closure_decls.specFunctionObject );
4607
+ if (specptr) {
4608
+ jl_returninfo_t returninfo = get_specsig_function (ctx, jl_Module,
4609
+ closure_decls.specFunctionObject , li->specTypes , ub.constant );
4610
+ fptr = mark_julia_type (ctx, returninfo.decl , false , jl_voidpointer_type);
4611
+ } else {
4612
+ fptr = mark_julia_type (ctx,
4613
+ (llvm::Value*)Constant::getNullValue (T_size),
4614
+ false , jl_voidpointer_type);
4611
4615
}
4612
- jlcall_ptr = mark_julia_type (ctx,
4613
- F, false , jl_voidpointer_type);
4614
4616
}
4615
4617
4616
4618
jl_cgval_t world_age = mark_julia_type (ctx,
0 commit comments