-
I like wasm-opt's text output for debugging, but I can't find how to convert a .wasm to wat with type numbers but without renumbering. This command:
generates types like
which is convenient because it makes the type hierarchy visible in the text and function types become simpler. However the number To avoid renumbering I can use another pass that won't renumber the types:
But that prints types like
Now I can't see the struct type hierarchy in the output and I can't map a struct type index to the type in the output. Is there a way to generate wat with type numbers but without renumbering? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't think there is a way to do that, sorry. |
Beta Was this translation helpful? Give feedback.
I don't think there is a way to do that, sorry.
--name-types
picks arbitrary indexes for the types, and it's not possible to match them to the binary indexes, because Binaryen will reorder types in the binary writing. That is, in Binaryen IR we don't have type indexes, just types. When we write a binary we collect the types, sort by use frequency (to minimize binary size) and then use those indexes.