Skip to content

Toolchain roundtrip differs from original input #641

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

Closed
ddcc opened this issue Jul 15, 2016 · 2 comments
Closed

Toolchain roundtrip differs from original input #641

ddcc opened this issue Jul 15, 2016 · 2 comments

Comments

@ddcc
Copy link
Contributor

ddcc commented Jul 15, 2016

When I run a small C program through s2wasm, it generates a main function with implicit type:

(func $main (param $0 i32) (param $1 i32) (result i32)

However, when I run this output through wasm-as and wasm-dis, the implicit type has become explicit:

(type $1 (func (param i32 i32) (result i32)))
(func $main (type $1) (param $var$0 i32) (param $var$1 i32) (result i32)

Is this behavior intentional? If so, why are we doing this, instead of requiring all non-indirect functions to have implicit or explicit type?

@kripken
Copy link
Member

kripken commented Jul 15, 2016

There is still some confusion and flux in the spec about what type-less functions' types are and how they work, see WebAssembly/spec#301 and the discussion there. Once that's sorted out we can figure things out here.

Currently what happens here is that to emit the binary format we need to create actual types for functions that are not listed as having types in the wast, since the binary format only has actual types. On the way back, we don't try to undo that, as we have no way of knowing if the type was created just for the binary format, or was always there.

@tlively
Copy link
Member

tlively commented Jan 6, 2025

s2wasm no longer exists.

@tlively tlively closed this as completed Jan 6, 2025
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

No branches or pull requests

3 participants