Skip to content

Code Annotations - #1724

Closed
yuri91 wants to merge 4 commits into
WebAssembly:mainfrom
yuri91:annotations
Closed

yuri91 wants to merge 4 commits into
WebAssembly:mainfrom
yuri91:annotations

Conversation

@yuri91

@yuri91 yuri91 commented Oct 11, 2021

Copy link
Copy Markdown
Contributor

This PR adds support for Code Annotations.

See WebAssembly/tool-conventions#167 for context and WebAssembly/tool-conventions#173 for the specification.

In particular this pr implements the following:

  • Parsing code annotation sections in BinaryReader, providing appropriate callbacks that a BinaryReaderDelegate can implement:
    • BinaryReaderObjdump: show the sections in a human-readable form
    • BinaryReaderIr: add code annotations in the IR as expressions
  • Parsing code annotations in text format, adding them in the IR like the BinaryReaderIR does
  • Writing the code annotations present in the IR in the proper sections when converting IR to binary
  • Support in wasm-decompiler for showing the annotations as comments in the pseudo-code

All the features have corresponding tests.

Support for code annotations is gated through the --enable-code-annotations feature. For reading/writing in the text format, --enable-annotations is also required.

Missing features:

  • Support for function-level code annotations (offset 0)
  • Extensive validation in validator.cc (like making sure that all annotations are at the same code offset of an instruction)

Added parsing from binary and general callbacks for generic code
annotations.
Basic logging and info in objdump.
The annotations are shown in the line before the referenced instruction,
as a C-style line comment.
@yuri91

yuri91 commented Feb 24, 2022

Copy link
Copy Markdown
Contributor Author

Outdated.
I made a new PR with the new format (and the new name for the feature: Code Metadata) here: #1840

@yuri91 yuri91 closed this Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant