We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5442 - [PATCH] Optimize and fix spinlock behavior for Windows on ARM
Summary: [PATCH] Optimize and fix spinlock behavior for Windows on ARM
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: atomic (show other bugs)
Version: HG 2.0
Hardware: ARM Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-03 18:24 UTC by Cameron Gutman
Modified: 2021-01-03 18:36 UTC (History)
0 users

See Also:


Attachments
Patch (1.50 KB, patch)
2021-01-03 18:25 UTC, Cameron Gutman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Gutman 2021-01-03 18:24:54 UTC
The current implementation of SDL_AtomicUnlock() is not safe for Windows on ARM because it only enforces a compiler memory barrier before unlocking, rather than a real hardware memory barrier.

There's also a little optimization opportunity in SDL_AtomicTryLock() too, since using the InterlockExchange variant with acquire semantics is faster on ARM since it avoids generating a 'dmb' instruction.
Comment 1 Cameron Gutman 2021-01-03 18:25:36 UTC
Created attachment 4635 [details]
Patch
Comment 2 Sam Lantinga 2021-01-03 18:36:22 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/1cfb48c58bbd