Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4380 +/- ##
==========================================
+ Coverage 32.98% 33.09% +0.11%
==========================================
Files 489 489
Lines 58019 58063 +44
==========================================
+ Hits 19137 19217 +80
+ Misses 35542 35481 -61
- Partials 3340 3365 +25 |
Contributor
❌ 8 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
bragaigor
reviewed
Feb 13, 2026
eljobe
approved these changes
Feb 13, 2026
This file contains hidden or 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
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
caller-envlibrary exposes static implementations ofMemAccessandExecEnvtraits.For the first one, a ZST (zero-size-type)
StaticMemis provided. Since it doesn't use any static data, callers actually can always create a new cost-free instance ofStaticMem, without any need for a common static variable. Changes:pub static mut STATIC_MEM: StaticMemStaticMem) instead of a static var in wasm libs; this allows to removeunsafe {}block declaration thereFor
ExecEnvtrait we have another ZSTStaticExecEnv. However, this one used two auxiliary mutable statics (TIMEandRNG) to mimic Go runtime state. It turned out that we already have available structGoRuntimeState(with exactly such two fields). Changes:GO_RUNTIME_STATE: Lazy<Mutex<GoRuntimeState>>TIMEandRNGstatic varsStaticEnv) instead of a static var in wasm libsAlso, moved
GoRuntimeStatefromjittocaller-envand madecreate_pcgfunction private.Note on thread-safety
The old code was not thread safe. What is more, it wasn't even single-thread safe (that's why the warnings about mutable references to mutable statics created). The new code is thread safe:
Lockis a thread safe mechanism for single initializationMutexis thread safeHowever, they both come from the
spinlibrary, providing spin lock (without control yielding etc). This is because,caller-envis used in no-std environments, where we cannot use thestdtools (likeLazyLockorMutex) and we don't have access to OS-level primitives.In fact, we probably do not have to be thread safe here, as this code is rather for single threaded execution. However:
Mutexes (includingproveranduser-testcrates)RefCell, we would have to wrap them anyway in some auxiliary struct and dounsafe impl<T> Sync for Wrapper<T> {}to tell compiler that we are sure that this will be single threaded execution so that it allows us to use it in a static variableWhat is more, in single-threaded environment, spin lock should not incur visible overhead.
part of NIT-4432