-
Notifications
You must be signed in to change notification settings - Fork 308
Add PrunedStore
and use it in Wasmi's executor
#1449
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
Conversation
This is important to enforce that all TypedStore<T> are of equal sizes.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1449 +/- ##
==========================================
+ Coverage 71.47% 71.50% +0.02%
==========================================
Files 161 161
Lines 16352 16364 +12
==========================================
+ Hits 11688 11701 +13
+ Misses 4664 4663 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This way PrunedStore is pointer sized.
This is an API can can more easily be wrapped for an indirect call via a PrunedStore.
This is a better name since this type manages both, function parameters and results.
This allows to call host functions via a PrunedStore.
This way they cannot be used with foo.bar() syntax to disambiguate them with their Deref[Mut] impls.
It no longer holds a reference to a Store<Prune> but simply is the shape of a Store<Prune> and now has #[repr(transparent)] to make transmutation sound.
This is just for demo purposes (it works) and not final code. Call hooks from Wasm -> Host are now handled at the TypedStore.
Also make RestorePrunedWrapper::restore infallible.
I just benchmarked the Wasmi executor that is now using the new Performance is affected a lot. It seems that Wasmi can still achieve the same performance, but op-codes are affected very differently. For example, |
PrunedStore
PrunedStore
and use it in Wasmi's executor
Things I have already tried out to fix the performance regressions of this PR:
|
This prevents LLVM from generating very weird phi gigantic nodes.
Despite the remaining performance issues (e.g. |
Closes #1448
Unblocks #1433
This adds a
PrunedStore
that can be created from aStore<T>
. It can safely be restored back to aStore<T>
and use certainStore<T>
related methods. However, this conversion is not entirely free.PrunedStore
provides an efficient way to access theStoreInner
parts of aStore<T>
.Note: the code to convert between
Store<T>
andPrunedStore
usesunsafe
Rust code. I execute thePrunedStore
conversion tests withmiri
and it did not find any unsoundness while running the tests. The entire Wasmi testsuite passes using thePrunedStore
.Downsides
T
inStore<T>
is now required to be'static
. Not a very big deal in common user code but not great either, especially since Wasmtime'sStore<T>
does not have this requirement. This is probably because Wasmtime simly does not perform theTypeId
check at all.tiny_keccak
) others perform way worse (e.g.counter
). This indicates that Wasmi performs the same overall but performance of different op-codes changed significantly.