Tom Short

Results 87 comments of Tom Short

On memory allocation, Emscripten has [emmalloc](https://github.com/kripken/emscripten/blob/78d3f20b8d515a4e1b92434519dbe7b088628fea/system/lib/emmalloc.cpp). It has a C api. We could pre-compile that into a wasm file and link that into Julia code. Rust has [wee_alloc](https://github.com/rustwasm/wee_alloc) as noted...

Good point on `dlmalloc`, Alon. A good option might be to stick to the C API with malloc, free, etc. Then, we could pre-compile emmalloc and dlmalloc, and the user...

I managed to compile `emmalloc` to `wasm`. This file still needs the following defined: `sbrk`, `memset`, `memcpy`, and `_assert_fail`. I haven't figured out where Emscripten defines `sbrk`, yet. These could...

Great! I assume the length must be stored in the first part of the array then?

A tidied array example would make an interesting blog post!

@sjorn3, do you have example code?

There are examples in wasm-ffi of returning arrays, at least for Rust and AssemblyScript. Maybe the modified arrays can be returned with Julia?

Here's where the docs are for returning an array in AssemblyScript. There's something similar below that for Rust. https://github.com/demille/wasm-ffi#user-content-assemblyscript-array

Related: https://github.com/JuliaGPU/CUDAnative.jl/issues/25

Good idea. If there's just one method for a given function, I'd prefer to just use the shorter name without type annotations on the JS side. That'll be quite common.