You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While wasm-opt appears to support table.grow correctly, any compiled module containing a table.fill instruction will fail to parse. This is true even if you pass the appropriate --enable-reference-types flag.
Sample code:
voidmono_jiterp_grow_function_table (intcount, intfill_value) {
__asm(
// table.grow expects stack layout [fill_ref] [count]// start by loading fill_value, then fetching that reference from the indirect fn table"local.get 1;""table.get __indirect_function_table;"// now fill_ref is on the stack, load count and perform the actual table grow"local.get 0;""table.grow __indirect_function_table;"// table.grow returns either the new size or an error code. i'm too lazy to deal with it"drop;"
);
}
#if0voidmono_jiterp_fill_function_table (intoffset, intcount, intfill_value) {
__asm(
// table.fill expects stack layout [offset] [fill_ref] [count]// load offset"local.get 0;"// load fill_value, then fetch that reference from the indirect fn table"local.get 2;""table.get __indirect_function_table;"// now fill_ref is on the stack, load count and perform the actual table grow"local.get 1;""table.fill __indirect_function_table;"
);
}
#endif
change the #if 0 to #if 1 and the resulting built module will cause wasm-opt to fail with something like:
From checking the spec, 17 is table.fill. Looking through the repo it seems like support for table.init and table.copy might be missing too, but I'm not planning to use them...
Activity
tlively commentedon Sep 14, 2023
You're the first person to ever ask for table.fill support! I can add it today.
Implement table.fill
Implement table.fill (#5949)
csjh commentedon May 20, 2024
Any chance
table.initis being worked on? Seems like it's the lonely last table instruction lefttlively commentedon May 20, 2024
There's no active work at the moment, but we might implement
table.initsoon as part of #6612.Implement table.fill (WebAssembly#5949)