Skip to content

Commit 4ac634d

Browse files
committed
fixup! codegen: restructure, remove recursion
1 parent a676e94 commit 4ac634d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/codegen.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3758,8 +3758,10 @@ static Function* gen_cfun_wrapper(
37583758
// infer it first, if necessary
37593759
if (lam)
37603760
name = jl_symbol_name(lam->def.method->name);
3761-
if (lam && !into) {
3762-
jl_generic_fptr_t fptr = jl_generate_fptr(&lam, world);
3761+
if (lam && params.cache) {
3762+
jl_generic_fptr_t fptr;
3763+
if (into)
3764+
fptr = jl_generate_fptr(&lam, world);
37633765
if (lam->jlcall_api == JL_API_CONST) {
37643766
// don't need the fptr
37653767
}
@@ -3784,8 +3786,8 @@ static Function* gen_cfun_wrapper(
37843786
jl_printf(JL_STDERR, "WARNING: cfunction: return type of %s does not match\n", name);
37853787
}
37863788
}
3787-
if (into)
3788-
lam = NULL; // FIXME?
3789+
if (!params.cache) // FIXME!
3790+
lam = NULL;
37893791

37903792
std::stringstream funcName;
37913793
funcName << "jlcapi_" << name << "_" << globalUnique++;
@@ -3815,7 +3817,7 @@ static Function* gen_cfun_wrapper(
38153817
Function *cw = Function::Create(functype,
38163818
GlobalVariable::ExternalLinkage,
38173819
funcName.str(), M);
3818-
cw->setAttributes(sig.attributes);
3820+
cw->setAttributes(attributes);
38193821
#ifdef JL_DISABLE_FPO
38203822
cw->addFnAttr("no-frame-pointer-elim", "true");
38213823
#endif

0 commit comments

Comments
 (0)