Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rvolosatovs
Copy link
Member

@rvolosatovs rvolosatovs commented Jul 11, 2025

This starts the process of moving wasip3 implementation from https://github.com/bytecodealliance/wasip3-prototyping/tree/0bcd54e714e70dbee4dd2d440abb3017997a061e/crates/wasi

  • implement wasi:clocks
    • just like in wasip2, timezone interface is not implemented yet
  • implement wasi:random
  • add stubs for Access::get and Accessor::with.
    • for now, these are implemented directly in the file they're used in to avoid an import. There is only one occurrence where we need these in this PR and the hoping is that by the time next PR lands, we'll have them available in the runtime.
  • add tests, but ignore them, since async machinery still panics. the tests are adapted from analogous p2 tests
  • allow specifying a subdirectory in WIT fetch script, since p3 WIT lives in a draft subdirectory
  • extract a common WasiCtxBuilder to use for both p2 and p3. Unfortunately, inheritance is sort of tricky here - I originally hoped to implement Deref on the p2/p3 builders, but that breaks the chaining that users are used to, e.g. builder.inherit_env().build() would not work, since inherit_env would return a reference to the inner builder, rather than the outer one. Just duplicate the methods for p2 and p3 for now - let's revisit once we have all of the interfaces implemented and more context on how we can handle this. A macro is potential solution. The reason these contexts are different types is primarily stdio - the abstractions are very different for wasip2 and wasip3.

closes #10061
closes #10063

refs bytecodealliance/wasip3-prototyping#228

@github-actions github-actions bot added the wasi Issues pertaining to WASI label Jul 11, 2025
@rvolosatovs rvolosatovs marked this pull request as ready for review July 11, 2025 21:22
@rvolosatovs rvolosatovs requested review from a team as code owners July 11, 2025 21:22
@rvolosatovs rvolosatovs requested review from pchickey and removed request for a team July 11, 2025 21:22
@rvolosatovs
Copy link
Member Author

#11127 has been added to the merge queue, so looks like I'll have to rebase this on Monday, moving back to draft

@rvolosatovs rvolosatovs marked this pull request as draft July 11, 2025 21:29
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

A few minor thoughts here and there, but overall looks great, thank you @rvolosatovs! With #11127 merged as well mind removing the #[ignore] on the tests to confirm they pass too?

Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
- hide `CommandPre`, since it is currently unusable
  bytecodealliance#11249
- use `Command::new` directly in examples, since `instantiate_async`
  does not provide a way to call an export

Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
@rvolosatovs rvolosatovs marked this pull request as ready for review July 16, 2025 10:44
@rvolosatovs
Copy link
Member Author

@alexcrichton review comments addressed, mind giving this another look?

@alexcrichton alexcrichton added this pull request to the merge queue Jul 16, 2025
Merged via the queue into bytecodealliance:main with commit d34bc53 Jul 16, 2025
42 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Ship WASIp3 Jul 16, 2025
@rvolosatovs rvolosatovs deleted the feat/wasip3-part1 branch July 16, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants