Repository navigation
interp: support atomic operations in global initializers - #5993
Draft
davecheney wants to merge 1 commit into
Draft
davecheney wants to merge 1 commit into
davecheney wants to merge 1 commit into
Conversation
davecheney
force-pushed
the
interp-atomicrmw
branch
3 times, most recently
from
October 26, 2026 02:03
3ac4cfb to
7d47e03
Compare
davecheney
force-pushed
the
interp-atomicrmw
branch
from
October 30, 2026 12:44
7d47e03 to
619fb5f
Compare
Package-level initializers can now use sync/atomic operations while TinyGo evaluates global variables. The interpreter handles atomicrmw and cmpxchg instructions in memory it owns, covering Add, And, Or, Swap, and CompareAndSwap without matching function names. This is safe during initialization because no other execution contexts exist yet. Volatile operations and external memory remain runtime operations.
davecheney
force-pushed
the
interp-atomicrmw
branch
from
October 30, 2026 12:45
619fb5f to
0b1b324
Compare
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.
Package-level initializers can now use sync/atomic operations while TinyGo evaluates global variables. The interpreter supports LLVM atomicrmw and cmpxchg for interpreter-owned memory, covering Add, And, Or, Swap, and CompareAndSwap without matching function names.
No competing execution contexts exist during initialization, so these operations can be evaluated as loads and stores. Volatile operations and external memory remain runtime operations.
Tests add interpreter coverage for atomicrmw and cmpxchg, plus global-initializer coverage for sync/atomic.