Skip to content

Commit 987a3d6

Browse files
authored
use specsig for all-singleton-type signatures (or 0 arguments) (#32821)
1 parent 0852465 commit 987a3d6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/codegen.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5261,12 +5261,17 @@ static bool uses_specsig(jl_value_t *sig, size_t nreq, jl_value_t *rettype, bool
52615261
if (nbytes > 0)
52625262
return true; // some elements of the union could be returned unboxed avoiding allocation
52635263
}
5264+
bool allSingleton = true;
52645265
for (size_t i = 0; i < jl_nparams(sig); i++) {
52655266
jl_value_t *sigt = jl_tparam(sig, i);
5266-
if (jl_justbits(sigt) && !jl_is_datatype_singleton((jl_datatype_t*)sigt)) {
5267+
bool issing = jl_is_datatype_singleton((jl_datatype_t*)sigt);
5268+
allSingleton &= issing;
5269+
if (jl_justbits(sigt) && !issing) {
52675270
return true;
52685271
}
52695272
}
5273+
if (allSingleton)
5274+
return true;
52705275
return false; // jlcall sig won't require any box allocations
52715276
}
52725277

0 commit comments

Comments
 (0)