Nekotekina
2212a131ef
Fix some -Weffc++ warnings (part 1)
2021-03-31 11:27:09 +03:00
Nekotekina
729757b1dd
atomic.hpp: allow raw notify_all by pointer
2021-03-23 20:58:42 +03:00
Nekotekina
820390b7ed
atomic.cpp: remove raw_notify and simplify internal logic
...
Also permit zero size in waiters.
2021-03-23 20:19:10 +03:00
Nekotekina
e76d8eb046
Fix -Wstring-aliasing (gcc)
2021-02-18 19:38:22 +03:00
Jan Beich
96bde3df81
atomic.hpp: revert Clang < 11 workaround for u128
2020-12-22 09:00:34 +03:00
Nekotekina
bd269bccaf
types.hpp: remove intrinsic includes
...
Replace v128 with u128 in some places.
Removed some unused files.
2020-12-21 21:11:25 +03:00
Nekotekina
5f618814f6
atomic.hpp: use u128 as storage for masks/values
2020-12-21 13:51:23 +03:00
Nekotekina
fb29933d3d
Add usz alias for std::size_t
2020-12-18 12:23:53 +03:00
Nekotekina
4a883ba6ea
atomic.hpp: use SFINAE for waitable atomic detection
...
Add default_mask<> variable.
Refactor get_value<>().
2020-12-15 12:50:44 +03:00
Nekotekina
b59f142d4e
Move types.h to util/types.hpp
2020-12-12 15:12:01 +03:00
Nekotekina
6e05dcadb6
Reduce std::numeric_limits dependency
...
Please, stop pretending...
You need these templates for generic code.
In other words, in another templates.
Stop increasing compilation time for no reason.
2020-12-12 12:35:18 +03:00
Nekotekina
062c605eb1
atomic.hpp: fixup (rsp addressing)
2020-12-08 08:51:27 +03:00
Nekotekina
24e4e329ed
atomic.hpp: add atomic_t<bool> specialization
...
May be required in future, plus adds/hides some methods.
2020-12-07 17:13:12 +03:00
Nekotekina
b16cc618b5
atomic.hpp: add some features and optimizations
...
Add atomic_t<>::observe() (relaxed load)
Add atomic_fence_XXX() (barrier functions)
Get rid of MFENCE instruction, replace with no-op LOCK OR on stack.
Remove <atomic> dependence from stdafx.h and relevant headers.
2020-12-07 17:13:12 +03:00
Nekotekina
d1e7837422
atomic_t: cleanup type requirements
...
Add C++17 requirements.
Remove alignment requirements (auto-align type).
What's missing is to detect padding and forbid it.
2020-12-04 19:11:36 +03:00
Nekotekina
8efc22bd45
atomic.hpp: simplify and unify bit test instructions
...
Also make them available on all platform.
Rename some rare methods.
2020-12-04 14:33:38 +03:00
Nekotekina
3b8e3a9714
stdafx.h: remove BOM from custom included headers
...
Also add warnings about adding them.
2020-11-29 15:35:05 +03:00
Nekotekina
8b6d615aa6
atomic.hpp: remove/deprecate incomplete notify features
...
Notification with "phantom value" could be useful in theory.
As an alternative way of sending signal from the notifier.
But current implementation is just useless.
Also fixed slow_mutex (not used anywhere).
2020-11-26 06:31:36 +03:00
Nekotekina
27097cbcfe
atomic.hpp: alter atomic_storage<>::store a bit
...
Always fallback to exchange. May improve codegen on gcc.
2020-11-24 12:31:11 +03:00
Nekotekina
16cc88dd0e
atomic.hpp: fix atomic_wait::list regression
...
Typo-regressions. Also improve static asserts.
2020-11-23 09:26:25 +03:00
Nekotekina
280f5f0b54
atomic.hpp: redefine op::ne to actually mean "not equal"
...
WTF is "native endianness", it's native by default.
2020-11-23 09:24:16 +03:00
Nekotekina
3dd48a24ce
atomic.cpp: remove tiny redundancy
2020-11-17 15:22:04 +03:00
Nekotekina
badb3dc2dd
atomic.cpp/threads: remove old wait callback
...
Add new wait callback which simply collects statistics.
Shift workarounds towards actual problem detection.
2020-11-14 18:16:27 +03:00
Nekotekina
e48f160a29
atomic.cpp: continuation of fixing all-ones masks
...
Also added missing const noexcept.
2020-11-13 12:40:02 +03:00
Nekotekina
70761a4ef0
atomic.cpp: fix notification bug from few commits before
...
Make sure forced notification ignores mask comparison.
Also fix masks provided by smaller types to correct ones.
2020-11-12 05:01:44 +03:00
Nekotekina
7cd1e767be
atomic.cpp: implement some atomic wait operations.
...
Instead of plain waiting while equal to some value,
it can be something like less, or greater, or even bitcount.
But it's a draft and untested. Hopefully doesn't break anything.
2020-11-11 20:46:37 +03:00
Nekotekina
c047ab6147
atomic.cpp: waitable atomics got brutally rewritten
...
Hashtable increased and flatten, tree-alike extensions removed.
Some things simplified, so it can actually decrease perf a bit.
But most platforms shouldn't be affected.
Removed limit of 56 waiters per pointer.
Real limit now is about 65535.
2020-11-11 05:35:27 +03:00
Nekotekina
0bd989b118
atomic.cpp: allow waiting on multiple variables simultaneously
...
Arbitrary maximum set to 8, but really we need 2, maybe 3.
Added atomic_wait::list object for multi-waiting.
Added atomic_wait::get_unique_tsc just in case.
2020-11-07 18:18:02 +03:00
Nekotekina
1e45437498
Remove unused atomic with lock bit
2020-11-06 16:48:43 +03:00
Nekotekina
557f0c5a8a
atomic.cpp: remove load() from notify functions
...
Only compare masks for overlap for second overload (with mask provided).
Explicit "new value" can be provided in new 3-arg overloads.
Also rename atomic_storage_futex -> atomic_wait_engine.
2020-11-06 04:44:31 +03:00
Nekotekina
5248240e10
atomic.cpp: improvements.
...
Reduced static memory amount for waitable atomics.
Allow notifier to skip notifications if wait/notify masks don't overlap.
Improve raw_notify to wake up the thread by its id, add thread_id arg.
Add optional mask argument to notify_one() and notify_all().
2020-11-05 05:51:43 +03:00
Eladash
e791678dfc
atomic.cpp: fix memory ordering loads and release stores
2020-10-28 20:45:13 +03:00
Nekotekina
c491b73f3a
SPU: improve accurate DMA
...
Remove vm::reservation_lock from it.
Use lock bits to prevent memory clobbering in GETLLAR.
Improve u128 for MSVC since it's used for bitlocking.
Improve 128 bit atomics for the same reason.
Improve vm::reservation_op and friends.
2020-10-28 03:47:41 +03:00
Nekotekina
c50233cc92
atomics.cpp: add support for waiting on 128-bit atomics
...
Complementarily.
Also refactored to make waiting mask non-template arg.
2020-10-28 03:47:41 +03:00
Nekotekina
6806e3d5c7
atomic.cpp: implement notify callback
...
Notification can be very heavy, especially if we need to wake many threads.
Callback is set for cpu_thread in order to set wait flag accordingly.
2020-10-27 17:56:19 +03:00
Nekotekina
d344701fd5
atomic.cpp: add sparse atomics
...
Set alignment as second template argument (typically cache line).
2020-10-26 01:15:31 +03:00
Nekotekina
98ab5d5ba2
atomic.hpp: modernize inline assembly for lock bts/btr/btc
...
Use flag output (requires clang 9+).
2020-04-28 18:05:32 +03:00
Nekotekina
17f3a114be
Fat atomics: implement exchange() and compare_exchange()
...
Also includes compare_and_swap() and compare_and_swap_test().
Also includes fixes for load(), store(), and atomic_op().
2020-04-12 16:56:21 +03:00
Megamouse
078c31c1da
Qt: fix lupdate warnings (used for translation)
2020-04-06 20:59:58 +02:00
Eladash
13820d6802
SPU debugger: Show channels data
2020-04-03 18:37:21 +03:00
Eladash
ddf87864de
atomic_t: Fix regression from #7489
2020-02-15 14:07:52 +03:00
Eladash
eb8710d3c1
atomic.hpp: C-style casts cleanup
2020-02-15 11:37:13 +03:00
Nekotekina
7ea4eb0095
Atomic fix
...
Fix possible pointer arithmetic ops.
Fix fat atomics (currently unused).
2020-02-09 14:09:29 +03:00
Nekotekina
c0f80cfe7a
Use attributes for LIKELY/UNLIKELY
...
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina
59a0f810b9
Implement fat atomics
...
Atomics with embedded mutex bit.
2020-01-31 12:09:52 +03:00
Nekotekina
28eacc616a
C-style cast cleanup III
2019-12-01 00:32:44 +03:00
Nekotekina
2fc8844315
atomic.hpp: add atomic wait mask support
2019-09-13 15:53:34 +03:00
Nekotekina
aa99faa85d
atomic.hpp: add timeout support
2019-09-10 19:25:39 +03:00
Nekotekina
1668d6ee1b
atomic.hpp: implement wait callback interface
...
Will be used to wake up threads uniformly.
2019-09-10 17:43:04 +03:00
Nekotekina
4f22559ff0
Remove dumb overloads of atomic_op, fetch_op
...
And lf_queue::apply.
Fix inlining problem by passing F by value.
2019-08-14 20:28:34 +03:00