Skip to content

Commit

Permalink
use specsig for all-singleton-type signatures (or 0 arguments) (#32821)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Aug 11, 2019
1 parent 0852465 commit 987a3d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5261,12 +5261,17 @@ static bool uses_specsig(jl_value_t *sig, size_t nreq, jl_value_t *rettype, bool
if (nbytes > 0)
return true; // some elements of the union could be returned unboxed avoiding allocation
}
bool allSingleton = true;
for (size_t i = 0; i < jl_nparams(sig); i++) {
jl_value_t *sigt = jl_tparam(sig, i);
if (jl_justbits(sigt) && !jl_is_datatype_singleton((jl_datatype_t*)sigt)) {
bool issing = jl_is_datatype_singleton((jl_datatype_t*)sigt);
allSingleton &= issing;
if (jl_justbits(sigt) && !issing) {
return true;
}
}
if (allSingleton)
return true;
return false; // jlcall sig won't require any box allocations
}

Expand Down

0 comments on commit 987a3d6

Please sign in to comment.