Skip to content

Commit a34cd9d

Browse files
committed
Generate c signature when possible. Fix #11304
1 parent 59a1e9c commit a34cd9d

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
@@ -4024,19 +4024,11 @@ static Function *emit_function(jl_lambda_info_t *lam)
40244024
Function *f = NULL;
40254025

40264026
bool specsig = false;
4027-
if (!va && !hasCapt && lam->specTypes != NULL && lam->inferred) {
4028-
// no captured vars and not vararg
4029-
// consider specialized signature
4030-
for(size_t i=0; i < jl_nparams(lam->specTypes); i++) {
4031-
if (isbits_spec(jl_tparam(lam->specTypes, i))) { // assumes !va
4032-
specsig = true;
4033-
break;
4034-
}
4035-
}
4036-
if (jl_nparams(lam->specTypes) == 0)
4037-
specsig = true;
4038-
if (isbits_spec(jlrettype))
4039-
specsig = true;
4027+
if (!va && !hasCapt && lam->specTypes != NULL && lam->inferred &&
4028+
jl_nparams(lam->specTypes) <= 64) {
4029+
// Specialize signature if there's no captured vars, not vararg
4030+
// and if the number of arguments is reasonable. #11304
4031+
specsig = true;
40404032
}
40414033

40424034
std::stringstream funcName;

0 commit comments

Comments
 (0)