MikeInnes / Charlotte.jl

Charlotte's Web Scale
Other
113 stars 13 forks source link

Failure writing a module #30

Open tshort opened 6 years ago

tshort commented 6 years ago

This is probably a WebAssembly issue.

Charlotte branch: tshort#julia-0.7-arrays WebAssembly branch: julia-0.7-optimise

using Charlotte: wasm_module 
using WebAssembly: getModule

function mathfun(x)
    2x
end

m = wasm_module([mathfun => Tuple{Float64}])
write("mathfun.wasm", getModule(m))

Here's the error:

ERROR: LoadError: MethodError: no method matching toBytes(::Float64)
Closest candidates are:
  toBytes(::WebAssembly.Bytes) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:222
  toBytes(::WebAssembly.Lookup) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:221
  toBytes(::WebAssembly.WType) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:220
  ...
Stacktrace:
 [1] map(::typeof(WebAssembly.toBytes), ::Tuple{WebAssembly.Lookup,Float64}) at ./tuple.jl:163
 [2] toBytes(::Tuple{WebAssembly.Lookup,Float64}) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:217
 [3] iterate at ./generator.jl:47 [inlined]
 [4] _collect(::Array{Any,1}, ::Base.Generator{Array{Any,1},typeof(WebAssembly.toBytes)}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:632
 [5] collect_similar at ./array.jl:561 [inlined]
 [6] map at ./abstractarray.jl:1987 [inlined]
 [7] toBytes at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:217 [inlined]
 [8] map at ./tuple.jl:164 [inlined]
 [9] map at ./tuple.jl:165 [inlined]
 [10] toBytes(::Tuple{Int64,Array{Tuple{Int64,WebAssembly.WType},1},Array{Any,1},WebAssembly.Lookup}) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:217
 [11] toBytes(::WebAssembly.Length) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:216
 [12] iterate at ./generator.jl:47 [inlined]
 [13] _collect(::Array{WebAssembly.Length,1}, ::Base.Generator{Array{WebAssembly.Length,1},typeof(WebAssembly.toBytes)}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:632
 [14] map at ./array.jl:561 [inlined]
 [15] toBytes at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:217 [inlined]
 [16] map at ./tuple.jl:163 [inlined]
 [17] toBytes(::Tuple{Int64,Array{WebAssembly.Length,1}}) at /home/tshort/FS/appfiles/julia/jch/WebAssembly/src/bytecode.jl:217