-
Notifications
You must be signed in to change notification settings - Fork 44
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
Surface module cache for reuse. #1506
Merged
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
graydon
requested review from
leighmcculloch,
dmkozh and
sisuresh
and removed request for
sisuresh,
dmkozh and
leighmcculloch
January 9, 2025 08:00
graydon
force-pushed
the
reusable-module-cache
branch
3 times, most recently
from
January 10, 2025 19:34
86ea7ea
to
ad0d6d2
Compare
dmkozh
reviewed
Jan 11, 2025
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 to me overall, only not sure about the gating of the old behavior (left a comment about that).
5 tasks
jayz22
reviewed
Jan 14, 2025
graydon
force-pushed
the
reusable-module-cache
branch
2 times, most recently
from
January 18, 2025 07:45
692d056
to
9515643
Compare
dmkozh
reviewed
Jan 21, 2025
soroban-env-host/observations/23/test__address__invalid_strkey_to_address_conversion.json
Outdated
Show resolved
Hide resolved
graydon
force-pushed
the
reusable-module-cache
branch
from
January 22, 2025 02:38
468aa94
to
a3882e9
Compare
graydon
force-pushed
the
reusable-module-cache
branch
from
January 22, 2025 19:48
a3882e9
to
ecea5b9
Compare
dmkozh
approved these changes
Jan 22, 2025
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.
The goals of this PR are:
ModuleCache
from inside soroban to its embedding environment.Host
, and be reused from oneHost
to the next.ModuleCache
to be pre-populated from before the lifetime of a singleHost
, (eg. by stellar-core, with all the non-archived contracts currently live in the ledger, at startup or such.)These goals are accomplished by the following structural changes:
Host
into a separate traitErrorHandler
thatHost
implements, and adding a new traitCompilationContext
that extends bothErrorHandler + AsBudget
. This abstracts the services theModuleCache
needs from theHost
, such that the embedding environment can provide its ownCompilationContext
in the times pre- or post-Host
lifetime.Module
s inside theModuleCache
to use a refcounted-shared-mutablestd::map::BtreeMap
that can be incrementally and efficiently added-to or removed-from, and is not metered.Module
storage and arguments that wereRc<>
are madeArc<>
and the wholeModuleCache
is madeSend+Sync
. This is mainly because we want to work with the reusableModuleCache
across C++ threads, and while Rust has no idea about C++ threads it at least helps us shoot ourselves in the foot less if all the Rust code that works with it preserves the sense of "this would be threadsafe in Rust if Rust was making the threads".foo
=>wasmi_foo
andFoo
=>wasmi::Foo
. This is because this change was done as part of (and there'll be a followup PR including) work equipping theVm
andModuleCache
with an experimental wasmtime/winch backend. It turns out this PR's work (on just theModuleCache
reuse part) is high enough value, and agnostic enough to which backend it's using, that we want to split this work out, move it up in the schedule and explore getting it into as early a release as possible. But I didn't bother reverting-out thewasmi_
-qualification since it's intertwined with other changes here and harmless to keep.This PR is a continuation of #1511 and should be merged after it.
This PR implements CAP-0065