Open ecmziegler opened 9 months ago
This seems reasonable to me. The namespacing of the section name was put there on purpose to easily allow something like this.
I don't think that the annotations proposal would need any change though.
Maybe this section of the tool conventions should be expanded: https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md.
The only downside is that some tools that can get away with supporting all "metadata.code" sections generically (e.g. wabt) will need explicit support for metadata.function (but it should be easy to add).
Currently, the function level annotations contain some unnecessary fields, e.g. the length of the number of annotations per function is always 1 and the code location is always 0. Would it make sense to separate the format for those annotations from the one used in instruction level annotations?
One could e.g. agree that annotations are either function level or instruction level. This could be separated by namespace (e.g.
metadata.function.*
vsmetadata.code.*
) to have a well defined behavior here. Branch hints would not be affected by this as they are always on instruction level.The annotations proposal would have to be adjusted to incorporate this change though.