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

Reduce primitives type set for Wasm in FFI #2511

Closed
mversic opened this issue Jul 19, 2022 · 1 comment
Closed

Reduce primitives type set for Wasm in FFI #2511

mversic opened this issue Jul 19, 2022 · 1 comment
Assignees
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST

Comments

@mversic
Copy link
Contributor

mversic commented Jul 19, 2022

Wasm allows only a subset of C ABI compatbile datatypes. The types supported are 32-bit and 64-bit sized types. This means that a flag is needed to convert u8/i8 and u16/i16 to u32/i32 when building FFI API for wasm. This affects integers as function arguments or inside structures as well as repr(int) enums. A special care should be taken in handling bool type conversion

@mversic mversic added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Jul 19, 2022
@mversic mversic added the Red label Jul 27, 2022
@Erigara Erigara self-assigned this Jul 27, 2022
@mversic
Copy link
Contributor Author

mversic commented Jul 28, 2022

After some discussion with @Erigara it is decided that only primitives u8/i8 and u16/i16 will be special handled when wasm feature is activated. This means that references or aggregate types, such as &u8 or &[u8] will not be converted to *const u32 and (*const u32, usize) respectively, rather they will be turned into raw pointers *const u8 and (*const u8, usize). These types are repr(C) as are the types they dereference to. If any special handling is required, it is the callers responsibility.

@mversic mversic changed the title Reduce type set for Wasm in FFI Reduce primitives type set for Wasm in FFI Jul 28, 2022
appetrosyan pushed a commit that referenced this issue Aug 14, 2022
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
@Erigara Erigara closed this as completed Aug 15, 2022
s8sato pushed a commit to s8sato/iroha that referenced this issue Aug 15, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 6, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 6, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 6, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 7, 2022
BAStos525 pushed a commit to mversic/iroha that referenced this issue Sep 7, 2022
…dger-iroha#2590)

Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
Signed-off-by: BAStos525 <jungle.vas@yandex.ru>
mversic pushed a commit to mversic/iroha that referenced this issue Sep 8, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 9, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 9, 2022
BAStos525 pushed a commit to mversic/iroha that referenced this issue Sep 9, 2022
mversic pushed a commit to mversic/iroha that referenced this issue Sep 9, 2022
BAStos525 pushed a commit to mversic/iroha that referenced this issue Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

No branches or pull requests

2 participants