feat(bindgen): add support for stream reads with count > 1#1441
Open
andreiltd wants to merge 1 commit intobytecodealliance:mainfrom
Open
feat(bindgen): add support for stream reads with count > 1#1441andreiltd wants to merge 1 commit intobytecodealliance:mainfrom
andreiltd wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
af586d5 to
e89e776
Compare
Collaborator
|
Hey @andreiltd should I be reviewing this just yet? You just rebased I think but should I wait for the other PRs to land in |
Member
Author
|
Hey @vados-cosmonic yeah, not yet, this depends (includes): #1445 but it looks like 1445 is failing so I will have to figure out that first and then I will rebase this one. |
This adds `readMany(count)` support to generated p3 streams so host-side byte consumers can perform Canonical ABI stream reads instead of pulling one byte at a time. It uses the transferred count from the packed stream result when reading host buffers.
Member
Author
|
It's ready now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
readMany(count)support to generated p3 streams so host-side byte consumers can perform Canonical ABI stream reads instead of pulling one byte at a time. It uses the transferred count from the packed stream result when reading host buffers.I believe that the current implementation is correct, it's just that iteratrd on single bytes is very inefficient. I originally came across this when tried to run
p3_cli_hello_stdouttest from wasmtime:The
writefunction is a bit surprising in the sense that it will not loop until the data is sent over, but instead it will try to send the data at most once. Injcowe will receive a single byte and reporttransferred = 1, which is correct behavior. The looping function iswrite_allwhich with our current implementation will indeed print the whole string.I need to have a look if
tx.writereports warning that we are dropping result that must be used, which would make the debugging much easier.