Open sjorn3 opened 6 years ago
This should probably be in Charlotte. See https://github.com/MikeInnes/Charlotte.jl/issues/1 and https://github.com/MikeInnes/Charlotte.jl/issues/2.
I realise I didn't make it clear but this was supposed to be specific to the interpreter for the time being. I could move it over to the interpreter issue if that makes more sense.
Got it.
I've been looking at this a bit and got some pretty basic stuff working on the interpreter in the arrays
branch. A few points to consider.
reinterpret
along with some bounds checking.Awesome, @sjorn3! For memory allocation, https://github.com/MikeInnes/Charlotte.jl/issues/6 is a good place for discussion.
For interaction with JS, the wasm-ffi package looks really nice. We can just include that JS file, and I don't think we need to do much on the WASM side other than defining allocate
and deallocate
functions.
An array could be handled by constructing one in linear memory (e.g. in JS) and then passing this to a wasm function in the form of a pointer and length if required. Initially this would be implemented with just the simple wasm values, until structs are implemented and more complicated arrays can be supported.
Structs would passed as simple arguments to the function as flattened versions of themselves.