-
Notifications
You must be signed in to change notification settings - Fork 199
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
c#: Use stack when the list is smaller than a given value #1144
Merged
jsturtevant
merged 1 commit into
bytecodealliance:main
from
jsturtevant:stackalloc-when-can
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wishful thinking - not blocked for this PR:
It would be awesome if we could see this in context of some generated sample.
Maybe we can have wit->C# integration test in which the C# file is committed into git ?
That would show up as delta in the generated code in the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are tons of integration tests in https://github.com/bytecodealliance/wit-bindgen/tree/main/tests
Currently we don't check any into source, but having something like the that does have some value. I typically pull a PR and take a look at the source changes if I am unsure so would find this useful.
@alexcrichton any thoughts on this? I suppose the Rust version is a macro so you don't really have source to check in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to finagle but would require some frobbing of the infrastructure. We do this in Wasmtime for example for the output of the
wasmtime::component::bindgen!
macro and we could do something similar for the generators in this repository. Most generators are already running "codegen tests" to ensure the output compiles and we could probably update that all to save/restore snapshots in-tree. Probably wouldn't run the tests themselves but you'd still be able to see diffs in PRs.Personally I like having "golden snapshot" tests like that in-tree and I also like to review output changes as opposed to changes-of-how-to-output-code. The only downside is "big PRs" but I find it pretty easy to skim over the generated code changes.
Basically that's a long-winded way of saying that I think it'd be quite reasonable to add this to the repo. Basically run bindings generation for everything in
tests/codegen
and check in the results in-tree.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that we didn't need to have every test in
tests/codegen
but maybe something like theflavorful
example checked in? I think it might be overwhelming to have to many files changed in a PR. Anyways I will open an issue to track.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1146