Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of wasmbinary to wat #207

Open
wants to merge 10 commits into
base: stylus
Choose a base branch
from
Open

Conversation

joshuacolvin0
Copy link
Member

@joshuacolvin0 joshuacolvin0 commented Mar 10, 2024

Initial implementation. The wasm instructions are currently not formatted in wat format, so everything is provided, but result is not valid wat.

Resolves STY-22

@cla-bot cla-bot bot added the s label Mar 10, 2024
@joshuacolvin0 joshuacolvin0 marked this pull request as ready for review March 11, 2024 19:31
for (i, type_idx) in self.functions.iter().enumerate() {
let i1 = i as u32;

let export_str = match self.maybe_func_name(i1 + 1) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concerned that incorrect index is being used here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

@joshuacolvin0 joshuacolvin0 changed the title Initial implementation of wasmbinary to wat STY-22: Initial implementation of wasmbinary to wat Mar 11, 2024
@rachel-bousfield rachel-bousfield changed the title STY-22: Initial implementation of wasmbinary to wat Initial implementation of wasmbinary to wat Mar 12, 2024
Copy link
Collaborator

@rachel-bousfield rachel-bousfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some simplifications & fixes. There's just two things to note

  • The reason function names are sometimes wrong is that we're not considering imports. If a WASM has no imports, then the names are correct. However if there's n imports, the names will be shifted n away. Fixing this requires changing func_name, maybe_func_name, etc to distinguish imports from local functions.
  • Some of the changes affect Module printing, which may be worth checking again and fixing where visually affected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants