Expose GC API to Binaryen.JS#7466
Conversation
|
There are some functions I'm unsure how to implement. For example, I can't seem to find a C implementation of |
kripken
left a comment
There was a problem hiding this comment.
Yes, it looks like ArrayInitElem needs to be added to the C API, first.
|
Looks like there are errors on CI, might make sense to fix those before I do an in-depth review here, but let me know if you are stuck. |
I'm not stuck, just doing some experiments. I will re-request review when I'm done, thanks! The missing C API is already there, just need to add JS wrapper & tests. I had some issues with testing locally, so I had to use CI for that purpose, but I finally managed to resolve this problem. I think that tests are just not optimized for Windows. |
…`ArraySet`, `ArrayLen`, `ArrayCopy`
Adds
TypeBuilderinterface and the following WasmGC instructions to JS:ref.test,ref.cast,any.convert_extern,extern.convert_any,br_on_null,br_on_non_null,br_on_cast,br_on_cast_fail,struct.new,struct.new_default,struct.get,struct.set,array.new,array.new_default,array.new_fixed,array.new_data,array.new_elem*,array.get,array.set,array.len,array.fill*,array.copy,array.init_data*,array.init_elem*.Instructions that were added both to JS and to C are marked with an asterisk (
*).The corresponding test case was also added (
gc.js).Fixes #5921
This PR also fixes memory leaks caused by stack allocations that are not wrapped in
preserveStack.