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

wasm2c: restore older versions of some spec tests #1853

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

keithw
Copy link
Member

@keithw keithw commented Mar 8, 2022

Test wasm2c against versions of the "missing" spec tests (tracked at #1737) from before the bulk-memory and reference-types proposals were merged (as of commit WebAssembly/testsuite@a8bcbaf). It seems helpful to make sure these tests don't break through various refactors (including our #1814 which doesn't currently pass all of these). These can be replaced with the current versions of the tests once wasm2c supports bulk-memory and reference-types.

I had to make two changes to get these tests to pass today:

1. https://github.com/WebAssembly/testsuite/blob/a8bcbafe6d2fb191ce0188de0e18fdc107fa2598/elem.wast#L15-L18 (removed duplicate $t ids or else wast2json errors)
2. https://github.com/WebAssembly/testsuite/blob/a8bcbafe6d2fb191ce0188de0e18fdc107fa2598/exports.wast#L119-L137 (removed table export section or else wasm2c triggers an assertion failure)

@keithw keithw requested a review from sbc100 March 8, 2022 11:06
@sbc100
Copy link
Member

sbc100 commented Mar 8, 2022

In general I like the idea of have more test coverage.

The fact that you have to modify these tests makes me a little sad. Could we perhaps fix the code to support the old tests without modifying them? Or would that end up moving the code backwards in some way?

How far are we from supporting bulk-memory and reference-types and thus not needing this PR? Could you make it clear in the README.txt that these files should be delete as soon as we do support support bulk-memory and reference-types. Perhaps with a link to https://github.com/WebAssembly/wabt/issues/1737?

@keithw
Copy link
Member Author

keithw commented Mar 8, 2022

The fact that you have to modify these tests makes me a little sad. Could we perhaps fix the code to support the old tests without modifying them? Or would that end up moving the code backwards in some way?

I'm guessing it would be pretty doable since wast2json and wasm2c passed these tests in the pass. Let me take a look.

How far are we from supporting bulk-memory and reference-types and thus not needing this PR?

We've started working on this because of our own needs (you can see WIP at https://github.com/fixpointOS/wabt/tree/bulk-memory), but if possible I'd rather not have to implement these features once for the un-instanced code and then rebase/reimplement for instanced modules (or vice versa). So if it were up to us and based on your comment in #1833, the sequence would go:

  • Get this PR merged (after changes necessary to include the un-modified old tests)
  • Get our module_instancing branch passing these newly added (but old) tests
  • Finish implementing bulk-memory on top of our module_instancing branch
  • Start and finish implementing reference-types on top of our module_instancing branch
  • Confirm that all the current versions of the spec tests pass, restore them to the spec directory, and remove old-spec
  • If rlbox passes the testsuite by this point, rebase it on top of module_instancing; otherwise, worry about it later.
  • Merge module_instancing

Thoughts?

Could you make it clear in the README.txt that these files should be delete as soon as we do support support bulk-memory and reference-types. Perhaps with a link to https://github.com/WebAssembly/wabt/issues/1737?

Sure.

@sbc100
Copy link
Member

sbc100 commented Mar 8, 2022

That order of work sounds right to me! Thanks again for working on this.

@keithw keithw force-pushed the wasm2c-restore-tests branch 2 times, most recently from c28a111 to 095e2f2 Compare March 9, 2022 01:38
Test wasm2c against versions of the spec tests from before bulk-memory
and reference-types were merged (as of commit a8bcbaf in the testsuite
repo). These should be replaced with the current versions once wasm2c
supports bulk-memory and reference-types.
@keithw keithw force-pushed the wasm2c-restore-tests branch from 095e2f2 to c687fe2 Compare March 9, 2022 01:39
@keithw
Copy link
Member Author

keithw commented Mar 9, 2022

Here you go -- the changes necessary to get the old tests passing unmodified were pretty small.

I was a little nervous removing the short-circuit here (https://github.com/WebAssembly/wabt/blob/main/src/c-writer.cc#L1029-L1033) that was recently added in 1c8efb3, but, it doesn't seem to add a warning or other breakage when I take this out. Re: the comment there, even if a module has no types, the table can still be exported (which is what the failing test seemed to hit).

Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM. Can you explain why you needed those changes under src?

src/c-writer.cc Show resolved Hide resolved
test/run-spec-wasm2c.py Show resolved Hide resolved
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.

2 participants