How to control or read max wasm table size?

Viewed 791

I'm trying to build a common js environment for arbitrary wasm executable modules (for now, presumed generated from emscripten). One of my problems that the wasm output wants a table imported that has a specific max size. The standard em js code sets this based on back end output.

For my attempted common js environment, I either need to make sure modules don't constrain the max, or I need to be able to read the max. Reading would be more flexible across other people's compiler settings.

I haven't found an easy way in the wasm js api to find the max, even though I can find the entry in the imports list.

Is there some way I'm missing without resorting to parsing of the binary wasm? If I need to parse, any suggested short but robust solutions?

Or as a workaround, is there some setting in emcc (or other clang/other solutions) that prevents setting the max or else otherwise removes the need for the environment to know this value?

1 Answers

This currently isn't possible without reading the .wasm file directly yourself. There is a proposal to add such APIs but it hasn't made progress because other proposals were more in demand. I think it'll be something we get to eventually, it's definitely missing!

Related