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

wasm2js: Add Table operations #6650

Merged
merged 17 commits into from
Jun 11, 2024
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Jun 11, 2024

TableGet, Set, Size, Grow, Fill, Copy.

Also move "null" into shared-constants, to make the code
more consistent overall.

@kripken kripken requested a review from tlively June 11, 2024 20:24
@kripken kripken changed the title wasm2JS: Add Table operations wasm2js: Add Table operations Jun 11, 2024
@@ -2236,28 +2235,40 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m,
visit(curr->right, EXPRESSION_RESULT));
}
Ref visitTableGet(TableGet* curr) {
unimplemented(curr);
WASM_UNREACHABLE("unimp");
return ValueBuilder::makeSub(ValueBuilder::makeName(FUNCTION_TABLE),
Copy link
Member

Choose a reason for hiding this comment

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

Do we validate elsewhere that the module has only one table? If not, we might want to raise an error here and on the other operations if the table is not at index 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

We do have an error up front about that, it is a built-in assumption throughout wasm2js.

// TODO: Remove this restriction when wasm2js can handle multiple tables
if (wasm->tables.size() > 1) {
Fatal() << "error: modules with multiple tables are not supported yet.";
}

@kripken kripken merged commit 2dcf670 into WebAssembly:main Jun 11, 2024
13 checks passed
@kripken kripken deleted the wasm2js.tables branch June 11, 2024 21:13
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.

None yet

2 participants