I want to compile functions processing tables with help of juliac. I use TypedTables. Unfortunately the code cannot be compiled as soon the tables have more than 32 columns. This is probably caused by the type-instability that occurs, when the used tuples exceed 32 elements. (The compiler collapses the types and infers them as Any.). (see https://github.com/JuliaLang/JuliaC.jl/issues/140
Here is an example:
using TypedTables
function (@main)(args::Vector{String})::Cint
ts = (
a = Table(c1 = [1], c2 = [2], c3 = [3], c4 = [4], c5 = [5], c6 = [6], c7 = [7], c8 = [8], c9 = [9], c10 = [10], c11 = [11], c12 = [12], c13 = [13], c14 = [14], c15 = [15], c16 = [16], c17 = [17], c18 = [18], c19 = [19], c20 = [20], c21 = [21], c22 = [22], c23 = [23], c24 = [24], c25 = [25], c26 = [26], c27 = [27], c28 = [28], c29 = [29], c30 = [30], c31 = [31]),
b = Table(c1 = [1], d2 = [2], d3 = [3], d4 = [4], d5 = [5], d6 = [6], d7 = [7], d8 = [8], d9 = [9], d10 = [10], d11 = [11], d12 = [12], d13 = [13], d14 = [14], d15 = [15], d16 = [16], d17 = [17], d18 = [18], d19 = [19], d20 = [20], d21 = [21], d22 = [22], d23 = [23], d24 = [24], d25 = [25], d26 = [26], d27 = [27], d28 = [28], d29 = [29], d30 = [30], d31 = [31])
)
for s in [:a,:b]
t = getfield(ts, s)
b = map(r -> r.c1 == 1, t)
end
return 0
end
It results in compile error messages. The first one starts with:
Verifier error #1: unresolved call from statement Core._apply_iterate(Base.iterate, Core.tuple, %new()::Vector{Int64})::Tuple{Vararg{Int64}}
Stacktrace:
[1] _totuple(T::Type{NTuple{32, Int64}}, itr::Base.Generator{@NamedTuple{c1::Vector{Int64}, d2::Vector{Int64}, d3::Vector{Int64}, d4::Vector{Int64}, d5::Vector{Int64}, d6::Vector{Int64}, d7::Vector{Int64}, d8::Vector{Int64}, d9::Vector{Int64}, d10::Vector{Int64}, d11::Vector{Int64}, d12::Vector{Int64}, d13::Vector{Int64}, d14::Vector{Int64}, d15::Vector{Int64}, d16::Vector{Int64}, d17::Vector{Int64}, d18::Vector{Int64}, d19::Vector{Int64}, d20::Vector{Int64}, d21::Vector{Int64}, d22::Vector{Int64}, d23::Vector{Int64}, d24::Vector{Int64}, d25::Vector{Int64}, d26::Vector{Int64}, d27::Vector{Int64}, d28::Vector{Int64}, d29::Vector{Int64}, d30::Vector{Int64}, d31::Vector{Int64}, d32::Vector{Int64}}, TypedTables.var"#39#40"{Int64}})
...
How can I get this code compiled for juliac?
Do you have experience with that?
Is there ongoing work to make tuples containing more than 32 elements type-stable, also for getting it compiled with juliac?