-
Notifications
You must be signed in to change notification settings - Fork 50
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
Reduced allocations #202
Merged
peterhuene
merged 11 commits into
bytecodealliance:main
from
martindevans:linker_reduces_allocations
Jan 24, 2023
Merged
Reduced allocations #202
peterhuene
merged 11 commits into
bytecodealliance:main
from
martindevans:linker_reduces_allocations
Jan 24, 2023
Conversation
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
kpreisser
reviewed
Dec 13, 2022
Linker.DefineFunction
kpreisser
reviewed
Dec 14, 2022
kpreisser
approved these changes
Dec 15, 2022
CI failure due to an issue downloading a dependency:
|
- Using `Array.Empty` where possible - Get UTF8 bytes into a stackalloc `Span<byte>` instead of a `byte[]`
…is prevents stack overflows with very long strings.
…ypes` - Returning `null` instead of a single item array which is never used in `GetTupleTypes` - Return a list from `GetTupleTypes` instead of an array which is always immediately converted to a list
- Using `Array.Empty` in `Function.Wrap` where possible - Removed `NullParams` (never used)
Co-authored-by: Konstantin Preißer <kpreisser@users.noreply.github.com>
…ine. It was only used in two places with trivial lifetimes.
9c95a63
to
853957a
Compare
Rebased onto master to fixed merge conflict. |
peterhuene
approved these changes
Jan 24, 2023
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.
Looks good, just two formatting nits 👍
Co-authored-by: Peter Huene <peter@huene.dev>
Co-authored-by: Peter Huene <peter@huene.dev>
Committed those two suggestions. Thanks for the review 👍 |
kpreisser
added a commit
to kpreisser/wasmtime-dotnet
that referenced
this pull request
Jan 24, 2023
…g overloads of Linker.DefineFunction, to reduce allocations for the strings.
peterhuene
added a commit
that referenced
this pull request
Jan 24, 2023
* Allow to specify functions using untyped callbacks, which allows to specify a callback of any type without the need to use a specific delegate type. The untyped callback will receive arguments and can set results as a span of ValueBox. For example, this allows to define trapping functions for a module's import without having to know the function time at compile-time, similar to Wasmtime's define_unknown_imports_as_traps. * Follow-Up: Initialize the result ValueBoxes with their expected ValueKind but a default value, as otherwise they all would be initialized with ValueKind.Int32. * Follow-Up: Pull the (int) cast up, to align with InvokeCallback(). * Fix wording. * Enhance the tests to also check the ValueKind. * Fix code style. Co-authored-by: Peter Huene <peter@huene.dev> * Add missing GC.KeepAlive() call (which corresponds to the changes from #206). * Apply the changes from #202 also for the two remaining overloads of Linker.DefineFunction, to reduce allocations for the strings. * Follow-Up: Adjust for the changes in #211. Co-authored-by: Peter Huene <peter@huene.dev>
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.
Array.Empty
where possibleMemory<byte>
rented from the shared memory pool instead of abyte[]
for
loopTypeHandle
used inMemory
- it was only used in two places with trivial lifetimes.