-
-
Notifications
You must be signed in to change notification settings - Fork 701
stub out atomic functions for AArch64 #22728
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,83 @@ module core.internal.atomic; | |
| import core.atomic : has128BitCAS, MemoryOrder; | ||
|
|
||
| version (DigitalMars) | ||
| version (AArch64) | ||
| { | ||
| /* These functions are all stubbed out. They await someone who knows what | ||
| they are doing with AArch64 atomics. | ||
| */ | ||
| enum IsAtomicLockFree(T) = T.sizeof <= size_t.sizeof * 2; | ||
|
|
||
| inout(T) atomicLoad(MemoryOrder order = MemoryOrder.seq, T)(inout(T)* src) pure nothrow @nogc @trusted | ||
| if (CanCAS!T) | ||
| { | ||
| return *src; | ||
| } | ||
|
|
||
| void atomicStore(MemoryOrder order = MemoryOrder.seq, T)(T* dest, T value) pure nothrow @nogc @trusted | ||
| if (CanCAS!T) | ||
| { | ||
| *dest = value; | ||
| } | ||
|
|
||
| T atomicFetchAdd(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value) pure nothrow @nogc @trusted | ||
| if (is(T : ulong)) | ||
| { | ||
| return *dest + value; | ||
| } | ||
|
|
||
| T atomicFetchSub(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value) pure nothrow @nogc @trusted | ||
| if (is(T : ulong)) | ||
| { | ||
| return atomicFetchAdd(dest, cast(T)-cast(IntOrLong!T)value); | ||
| } | ||
|
|
||
| T atomicExchange(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value) pure nothrow @nogc @trusted | ||
| if (CanCAS!T) | ||
| { | ||
| size_t storage = void; | ||
| return *cast(T*)&storage; | ||
| } | ||
|
|
||
| alias atomicCompareExchangeWeak = atomicCompareExchangeStrong; | ||
|
|
||
| bool atomicCompareExchangeStrong(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T)(T* dest, T* compare, T value) pure nothrow @nogc @trusted | ||
| if (CanCAS!T) | ||
| { | ||
| if (*dest != *compare) | ||
| { | ||
| *compare = *dest; | ||
| return false; | ||
| } | ||
| *dest = value; | ||
| return true; | ||
| } | ||
|
|
||
| alias atomicCompareExchangeWeakNoResult = atomicCompareExchangeStrongNoResult; | ||
|
|
||
| bool atomicCompareExchangeStrongNoResult(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T)(T* dest, const T compare, T value) pure nothrow @nogc @trusted | ||
| if (CanCAS!T) | ||
| { | ||
| if (*dest != *compare) | ||
| return false; | ||
| *dest = value; | ||
| return true; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| } | ||
|
|
||
| void atomicFence(MemoryOrder order = MemoryOrder.seq)() pure nothrow @nogc @trusted | ||
| { | ||
| } | ||
|
|
||
| void atomicSignalFence(MemoryOrder order = MemoryOrder.seq)() pure nothrow @nogc @trusted | ||
| { | ||
| // no-op, dmd doesn't reorder instructions | ||
| } | ||
|
|
||
| void pause() pure nothrow @nogc @trusted | ||
| { | ||
| } | ||
| } | ||
| else // X86 and X86_64 | ||
| { | ||
| private | ||
| { | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.