Skip to content

Commit 5bf0652

Browse files
committed
Generate c signature when possible. Fix #11304
1 parent c842e86 commit 5bf0652

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/codegen.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4280,19 +4280,11 @@ static Function *emit_function(jl_lambda_info_t *lam)
42804280
Function *f = NULL;
42814281

42824282
bool specsig = false;
4283-
if (!va && !hasCapt && lam->specTypes != jl_anytuple_type && lam->inferred) {
4284-
// no captured vars and not vararg
4285-
// consider specialized signature
4286-
for(size_t i=0; i < jl_nparams(lam->specTypes); i++) {
4287-
if (isbits_spec(jl_tparam(lam->specTypes, i))) { // assumes !va
4288-
specsig = true;
4289-
break;
4290-
}
4291-
}
4292-
if (jl_nparams(lam->specTypes) == 0)
4293-
specsig = true;
4294-
if (isbits_spec(jlrettype))
4295-
specsig = true;
4283+
if (!va && !hasCapt && lam->specTypes != jl_anytuple_type &&
4284+
lam->inferred && jl_nparams(lam->specTypes) <= 64) {
4285+
// Specialize signature if there's no captured vars, not vararg
4286+
// and if the number of arguments is reasonable. #11304
4287+
specsig = true;
42964288
}
42974289

42984290
std::stringstream funcName;

0 commit comments

Comments
 (0)