MikeInnes / Charlotte.jl

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

Support calls to other functions #9

Open tshort opened 6 years ago

tshort commented 6 years ago

Here's an example that doesn't work (using PR #8):

julia> @noinline anotherfun(x) = 3x
anotherfun (generic function with 1 method)

julia> mathfun(x) = 2x
mathfun (generic function with 1 method)

julia> mathfun2(x, y) = mathfun(x) + anotherfun(y)
mathfun2 (generic function with 1 method)

julia> m = wasm_module([mathfun => Tuple{Float64},
                        mathfun2 => Tuple{Float64, Float64}])
ERROR: Can't convert to wasm: $(Expr(:invoke, MethodInstance for anotherfun(::Float64), :(Main.anotherfun), get_local 1))
Stacktrace:

Calling other functions works if they happen to be inlined.