tshort / WebAssemblyCompiler.jl

Create WebAssembly with Julia
https://tshort.github.io/WebAssemblyCompiler.jl/
MIT License
76 stars 4 forks source link

Multi-dimensional arrays #16

Open SamuelMarks opened 3 months ago

SamuelMarks commented 3 months ago

Multi-dimensional arrays (waiting on the Memory type PR)

Ref: https://tshort.github.io/WebAssemblyCompiler.jl/stable/

FYI: That PR has now been merged. Not sure what the current state of these arrays are now that that has been merged.

dgleich commented 3 months ago

Well, I tried WebAssemblyCompiler with Julia 1.11 to see if this magically worked. But it throws an error on this line as Base._unsafe_copyto!(...) isn't defined for Julia 1.11. Will see if I can debug when I get back.

# @overlay MT Base._unsafe_copyto!(dest::Array{U, 1}, doffs::Integer, src::Array{T, 1}, soffs::Integer, n::Integer) where {T,U} =
#     @ccall _jl_array_copyto(dest::Array{U,1}, (doffs-1)::Int32, src::Array{T,1}, (soffs-1)::Int32, n::Int32)::Array{T,1}
@overlay MT function Base._unsafe_copyto!(dest::Array, doffs::Integer, src::Array, soffs::Integer, n::Integer) 
    @inbounds for i in 1:n
        dest[i+doffs-1] = src[i+soffs-1]
    end
    return dest
end