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
Currently, Binaryen uses custom passes to transform Wasm (e.g. in wasm-merge). These passes are unavailable to C and JS, meaning that there's no built-in way for the users to transform the code.
In my project, I need to transform the code using Binaryen.js. Currently, I recursively gather all the information about expressions and reconstruct them with the required changes. My code is giant and repetative, as there's no way to convert from the JS object info format back to the original (or modified) expression.
I have two suggestions: either provide a way for JS to reconstruct expression from the corresponding info object, or provide a way for C (and add the corresponding JS bindings) to transform the code using callbacks or some other API.
I am willing to open a PR if we discuss this idea further!
The text was updated successfully, but these errors were encountered:
I agree it would be good to add something for these use cases, but I don't have a specific idea what would be best - both of those directions sound plausible. Perhaps write up in detail the one you think is more promising, for discussion here?
I think that wrapping WalkerPass could be a viable solution. That would mean that we also need to provide some way to interact with delegations fields API.
Maybe creating a separate C++ class for that purpose could be helpful, especially for registering callbacks?
That might make sense. For simplicity, perhaps wrapping WalkerPass<T, UnifiedExpressionVisitor> is enough, that is, having a single visit* method rather than one per class? Then on the C/JS side the user can pick which classes to operate on themselves.
Currently, Binaryen uses custom passes to transform Wasm (e.g. in wasm-merge). These passes are unavailable to C and JS, meaning that there's no built-in way for the users to transform the code.
In my project, I need to transform the code using Binaryen.js. Currently, I recursively gather all the information about expressions and reconstruct them with the required changes. My code is giant and repetative, as there's no way to convert from the JS object info format back to the original (or modified) expression.
I have two suggestions: either provide a way for JS to reconstruct expression from the corresponding info object, or provide a way for C (and add the corresponding JS bindings) to transform the code using callbacks or some other API.
I am willing to open a PR if we discuss this idea further!
The text was updated successfully, but these errors were encountered: