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: include simd128.h and wasm-rt-exceptions.h where necessary #2236

Merged
merged 5 commits into from
May 12, 2023

Conversation

keithw
Copy link
Member

@keithw keithw commented May 12, 2023

Copy link
Collaborator

@shravanrn shravanrn left a comment

Choose a reason for hiding this comment

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

lgtm % comment

}
}

void CWriter::WriteV128Decl() {
Write("#include <simde/wasm/simd128.h>", Newline(), Newline());
Write("#ifndef WASM_RT_SIMD_TYPE_DEFINED", Newline(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need the guard given that you also have simd_used_in_header_?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately I think we still need the guard, given that this is sometimes going in the .h file, and C forbids duplicate typedefs even if they're identical. If the embedder includes two module .h files, we don't want a collision. :-/

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.

lgtm.. I'll let @shravanrn approve since its based on his PR.

[&](const auto& x) {
return x->kind == ExternalKind::Func &&
func_uses_simd(module_->GetFunc(x->var)->decl.sig);
}));
Copy link
Member

Choose a reason for hiding this comment

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

How come we have have all this nice modern style of C++ but we still have to type of out .begin() and .end() everywhere.. :(

Also, why does the third lambda have the & capture specifier? (sorry I'm still not used to reading C++ lambdas).

Copy link
Member Author

@keithw keithw May 12, 2023

Choose a reason for hiding this comment

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

:-) I think if we upgraded to C++20 we could probably use std::ranges::any_of, which finally gets rid of the .begin() and .end().

The third lambda is the only one that uses the module_ member (for GetFunc), so it needs to capture it (and capturing implicitly with & seemed like the simplest way to do that).

@keithw keithw enabled auto-merge (squash) May 12, 2023 17:32
@keithw keithw mentioned this pull request May 12, 2023
@keithw keithw disabled auto-merge May 12, 2023 18:31
@keithw keithw enabled auto-merge (squash) May 12, 2023 18:31
@keithw keithw merged commit 8e0b8da into main May 12, 2023
14 checks passed
@keithw keithw deleted the wasm2c-includes branch May 12, 2023 18:50
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

3 participants