-
Notifications
You must be signed in to change notification settings - Fork 280
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
Refactor Instance
management within the CallStack
(take 2)
#1065
Merged
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
Also remove faulty debug_assert.
This also fixes a bug with instance reuse of tail calls when the call stack was temporarily empty while merging the tail call frames.
This has fewer indirections when using the default linear memory. Local perf measurements indicated up to 20% improvements for memory-intense workloads.
We now have a single MemoryCache and a single GlobalCache each caching the linear memory and global variable at index 0 respectively. The linear memory at index 0 makes sense to cache since Wasmi does not yet support multi-memory. The global at index 0 makes sense since it usually serves as the shadow stack pointer.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1065 +/- ##
==========================================
- Coverage 80.51% 80.50% -0.02%
==========================================
Files 268 269 +1
Lines 24927 24970 +43
==========================================
+ Hits 20070 20101 +31
- Misses 4857 4869 +12 ☔ View full report in Codecov by Sentry. |
Robbepop
changed the title
Replace
Refactor Jun 15, 2024
InstanceCache
by finer grained cachesInstance
management within the CallStack
(take 2)
The CallFrame::changed_instance (bool) field already contains all the necessary information for when to pop an Instance.
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 refactor the
CallStack
so thatInstance
is no longer part of eachCallFrame
.Instead the
CallStack
now has a dedicated stack forInstance
s and only pushes to this stack in case a function call changes the currently usedInstance
thus significantly reducing memory consumption for large call stacks.Furthermore this optimizes returning from functions since now the cached linear memory and global only need to be re-loaded in case the returned call actually changed the currently used
Instance
which is an uncommon case and thus re-loading happens less frequently in the common case, speeding up call-intense workloads.