Commit Graph

33 Commits

Author SHA1 Message Date
Ivan Chikish 804665df69 Fixup futex_waitv redefinition 2023-08-03 14:32:46 +03:00
Ivan Chikish d34287b2cc Linux: use futex_waitv syscall for atomic waiting
In order to make this possible, some unnecessary features were removed.
2023-08-02 21:46:06 +03:00
Nekotekina 4b787b22c8 Implement FN (lambda shortener)
Useful for some higher order functions.
Allows to make short lambdas even shorter.
2022-07-08 14:47:41 +03:00
Megamouse a16d8ba3ea More random changes 2021-04-11 14:01:51 +03:00
Nekotekina a8e0d261b7 types.hpp: more cleanup
Also fix compilation.
2020-12-22 19:08:09 +03:00
Nekotekina b7bf316c1a Don't randomly include "stdafx.h"
It's file for precompiled headers.
Include what is used, don't rely on transitive includes.
2020-12-22 14:32:30 +03:00
Nekotekina b59f142d4e Move types.h to util/types.hpp 2020-12-12 15:12:01 +03:00
Nekotekina bd5253047b Improve DYNAMIC_IMPORT
Don't call get_proc_address every time if if failed.
Also rename Utilities/dynamic_library.h to util/dyn_lib.hpp
2020-11-10 01:44:31 +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 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
Nekotekina 97ae5ab561 Add imports for some undocumented NTDLL functions
Some of them are available only since Windows 8.
2020-10-24 14:16:32 +03:00
Nekotekina 59d9e7ce98 Revert "Atomics: use WaitOnAddress if available (Win8+)"
This reverts commit f0fd7e2e19.
2020-10-21 09:59:08 +03:00
Nekotekina f0fd7e2e19 Atomics: use WaitOnAddress if available (Win8+) 2020-10-21 00:22:08 +03:00
Nekotekina db7042b986 Restore using keyed events in waitable atomics on Windows 2019-10-18 23:08:00 +03:00
Nekotekina 9710473a2e atomic.hpp: use native semaphores on Windows
Windows: drop keyed events
Linux: keep using native futex
Implement unused POSIX semaphore path
Implement fallback semaphore with pure std (OSX, BSD, etc)
2019-09-24 05:01:00 +03:00
Nekotekina feee3838eb Revert "Revert "Remove `shared_cond` and simplify reservation waiting""
This reverts commit b70c08a2e8.
2019-09-24 05:01:00 +03:00
Nekotekina b70c08a2e8 Revert "Remove `shared_cond` and simplify reservation waiting"
This reverts commit 0a96497e13.
2019-09-14 00:02:48 +03:00
Nekotekina 0a96497e13 Remove `shared_cond` and simplify reservation waiting
Use atomic wait for reservations
Cleanup some obsolete code
2019-09-10 19:25:39 +03:00
Nekotekina f63e89f9b4 Implement waitable atomics
Moved Atomic.h to util/atomic.hpp
List source files in CMakeLists.txt
2019-07-29 03:04:55 +03:00
Nekotekina 9dc0368079 Rename cond_x16 to shared_cond
Extend capacity from 16 to 32.
Remove redundant m_total counter.
2019-06-04 16:37:50 +03:00
Nekotekina 4f152ad126 SPU: multithread compilation
Allow parallel compilation of SPU code, both at startup and runtime
Remove 'SPU Shared Runtime' option (it became obsolete)
Refactor spu_runtime class (now is common for ASMJIT and LLVM)
Implement SPU ubertrampoline generation in raw assembly (LLVM)
Minor improvement of balanced_wait_until<> and balanced_awaken<>
Make JIT MemoryManager2 shared (global)
Fix wrong assertion in cond_variable
2019-01-22 22:02:02 +03:00
Nekotekina 81c50bad69 lf_queue: implement wait() method
Synchronization does not occupy additional space by reusing LSB
2019-01-13 14:45:36 +03:00
Nekotekina 96cabeadff Rewrite condition variables
Implement helper functions balanced_wait_until and balanced_awaken
They include new path for Windows 8.1+ (WaitOnAddress)

shared_mutex, cond_variable, cond_one, cond_x16 modified to use it
Added helper function utils::popcnt16
Replace most semaphore<> with shared_mutex
2018-11-29 01:30:05 +03:00
Nekotekina 6104685ad6 Implement cond_one sync primitive
Change futex() args to use unsigned int
2018-11-05 13:14:11 +03:00
Nekotekina f588454d26 Internal: register WaitOnAddress family functions (WinAPI) 2018-10-19 22:22:35 +03:00
Nekotekina ca5158a03e Cleanup semaphore<> (sema.h) and mutex.h (shared_mutex)
Remove semaphore_lock and writer_lock classes, replace with std::lock_guard
Change semaphore<> interface to Lockable (+ exotic try_unlock method)
2018-09-03 23:00:36 +03:00
Jan Beich cd6bf37d06 Utilities: explicitly add more includes found by GCC
Utilities/Log.cpp: In member function 'void logs::file_writer::log(logs::level, const char*, std::size_t)':
Utilities/Log.cpp:559:9: error: 'memcpy' is not a member of 'std'
    std::memcpy(pos, text, frag);
         ^~~~~~
Utilities/Log.cpp:559:9: note: suggested alternative: 'empty'
    std::memcpy(pos, text, frag);
         ^~~~~~
         empty
Utilities/Log.cpp:560:9: error: 'memcpy' is not a member of 'std'
    std::memcpy(m_fptr, text + frag, size - frag);
         ^~~~~~
Utilities/Log.cpp:560:9: note: suggested alternative: 'empty'
    std::memcpy(m_fptr, text + frag, size - frag);
         ^~~~~~
         empty
Utilities/Log.cpp:564:9: error: 'memcpy' is not a member of 'std'
    std::memcpy(pos, text, size);
         ^~~~~~
Utilities/Log.cpp:564:9: note: suggested alternative: 'empty'
    std::memcpy(pos, text, size);
         ^~~~~~
         empty
Utilities/sync.h: In member function 'int futex(int*, int, int, const timespec*, int*, int)::futex_map::operator()(int*, int, int, const timespec*, int*, uint)':
Utilities/sync.h:110:20: error: 'find' is not a member of 'std'
     map.erase(std::find(map.find(uaddr), map.end(), ref));
                    ^~~~
Utilities/sync.h:110:20: note: suggested alternative: 'rend'
     map.erase(std::find(map.find(uaddr), map.end(), ref));
                    ^~~~
                    rend
2018-08-31 03:19:17 +04:00
Nekotekina 08cd8e0cb1 Cleanup: unused imports 2018-05-17 18:33:44 +03:00
pauls-gh fdef77d779 Set Windows timer resolution to 0,5ms (#4579)
* Fix for https://github.com/RPCS3/rpcs3/issues/4569
(Win 10 update 1803 performance regression)
2018-05-17 15:00:22 +04:00
Nekotekina 98fc131d47 util::dynamic_import
Futex implementation
2017-01-25 00:38:07 +03:00
Nekotekina 0f87c4485d Silly macro removed-2 2016-08-14 18:19:42 +03:00
Ivan edc92843a7 Hotfix (#1705) 2016-05-24 01:59:39 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00