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

We shouldn't be making DiplomatReceiveBuf for scalar structs #662

Open
Manishearth opened this issue Aug 28, 2024 · 0 comments
Open

We shouldn't be making DiplomatReceiveBuf for scalar structs #662

Manishearth opened this issue Aug 28, 2024 · 0 comments
Labels
B-js JS backend

Comments

@Manishearth
Copy link
Contributor

method_info.alloc_expressions.push(
format!("const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, {size}, {align}, false);")
.into()
);

This appears to unconditionally use a DiplomatReceiveBuf (for multi-valued-returns that get turned into outparams) even for structs that are a ultimately wrapping a single outparam.

I believe the Wasm ABI only does the multi-value outparam when the result type has multiple scalar fields. I think CyclicStructA/CyclicStructB may already exercise this use case, so the first step would be checking if tests written around those types work.

When fixing this we should also inspect the nearby DiplomatResult code which may also have bugs around this.

@Manishearth Manishearth added the B-js JS backend label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-js JS backend
Projects
None yet
Development

No branches or pull requests

1 participant