Nekotekina
5d934c8759
Improve narrow() and size32() with src_loc detection
2020-12-09 16:26:20 +03:00
Nekotekina
e055d16b2c
Replace verify() with ensure() with auto src location.
...
Expression ensure(x) returns x.
Using comma operator removed.
2020-12-09 15:43:38 +03:00
Nekotekina
77aa9e58f2
shared_ptr.hpp: add trivial conversion for shared/single types
...
These conversions don't exist in std::shared_ptr-alike types.
But I don't want to bother with == operators until we have proper C++20.
Removed trivial conversion for atomic_ptr because it's heavyweight.
2020-12-07 15:33:28 +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
0892758994
Minor debugging enhancement
...
Use raise(SIGTRAP) in failed SIGSEGV handling and return.
2020-11-26 20:11:26 +03:00
Nekotekina
22a24446c1
Threads: fix minor race
...
Has already been in "fixed" state in past...
2020-11-26 20:11:26 +03:00
Nekotekina
b5d498ffda
Homebrew atomic_ptr rewritten (util/shared_ptr.hpp)
...
It's analogous to C++20 atomic std::shared_ptr
The following things brought into global namespace:
single_ptr
shared_ptr
atomic_ptr
make_single
2020-11-26 20:11:26 +03:00
Nekotekina
ca9898e838
JIT: increase likeliness of allocating 2M large pages
...
On top of enabled transparent hugepages hint (Linux).
2020-11-25 10:41:17 +03:00
Nekotekina
43952e18e2
Implement prefetch_write() and prefetch_exec() wrappers
...
Do some refactoring to prefetch_read() in util/asm.hpp as well.
Make all these function constexpr because they are no-ops.
2020-11-24 12:31:11 +03:00
Nekotekina
b954a41f2a
Threads: minor simplification
2020-11-24 01:09:04 +03:00
Nekotekina
d4c17ecda5
Simplify communication with thread pool
...
Add "entry_point" member to "thread_base".
Don't use "m_thread" to exchange values.
2020-11-23 11:32:34 +03:00
Nekotekina
a4458e2c8c
Clean thread pool at exit.
...
Execute TLS destructors.
Test atomic wait list.
2020-11-23 10:20:42 +03:00
Nekotekina
71f1021648
Fix thread pool entry point and get_cycles()
...
Fix possible race between thread handle availability.
Don't treat zero thread as invalid one.
Now entry point is full is assembly.
Attempt to fix #9282
Also fix some TLS.
2020-11-21 17:18:42 +03:00
Nekotekina
60cff6f3d4
Attempt to fix #9271
2020-11-21 07:09:48 +03:00
Nekotekina
c0f3d1f06d
Basic constexpr support for u128 (MSVC)
...
Added explicit conversion op to u64.
Added constexpr path for +,-,>>,<< ops.
Make almost all methods constexpr.
Removed a lot of redundancy.
2020-11-20 15:04:17 +03:00
Nekotekina
36f1193497
Fix u128 type on MSVC (subtraction, minus)
...
All subtraction operations were broken.
2020-11-19 16:38:06 +03:00
Nekotekina
d789250976
Add thread_ctrl::get_thread_stack
...
Returns addr and size of current thread's stack.
2020-11-17 05:33:46 +03:00
Nekotekina
dfae7bd073
SPU: Fix some stat printing
2020-11-15 04:41:16 +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
0c7f9458c0
Fix thread pool resource management.
...
Make sure no tail call happens (change ret address to a trampoline).
Make sure thread handles don't leak if the pool is full.
2020-11-13 17:17:45 +03:00
Nekotekina
ab365fe494
Fixed thread pool a bit
...
Use 128-bit allocator instead of queue.
When pool is full (128), threads just terminate as before.
2020-11-13 13:32:44 +03:00
Nekotekina
67785a918c
Implement simple thread pool
2020-11-13 03:32:24 +03:00
RipleyTom
1378645413
Adds SIGPIPE to ignored exceptions(unix)
2020-11-12 07:08:59 +03:00
Eladash
829a697c39
Fix vm::check_addr calls in Thread.cpp
2020-11-11 17:40:46 +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
1c99a2e7fb
vm: add map_self() method to utils::shm
...
Add complementary unmap_self() method.
Move VirtualMemory to util/vm.hpp
Minor associated include cleanup.
Move asm.h to util/asm.hpp
2020-11-08 16:43:15 +03:00
Megamouse
6fcc68699a
unify patch log
2020-11-07 19:22:40 +01: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
Megamouse
a3eb5c2d63
More Header cleanup
2020-11-06 22:14:05 +01: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
cc07e5306e
Improve shared_mutex
...
Wait/notify only on c_sig, should reduce spurious wakeup noise.
2020-11-06 00:10:16 +03:00
Nekotekina
34fa010601
Improve cond_var notifiers
...
But nobody uses it anyway, so clean up includes.
2020-11-06 00:10:16 +03:00
Nekotekina
7d56069243
Fix HAS_OVERCOMMIT usage in JIT.cpp
2020-11-05 18:50:19 +03:00
Nekotekina
ebdf93e5dc
Fix 1 warning in MSVC
2020-11-05 06:45:01 +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
b66628baca
Improve low-level mmap utilities (Linux/BSD)
...
Add madvise (MADV_WILLNEED) on utils::memory_commit
Add madvise (MADV_FREE or MADV_DONTNEED) on utils::memory_decommit
Improve shm_open pseudo-random name (not used on Linux)
2020-11-04 14:59:26 +03:00
Nekotekina
ba5ed5f380
Fix vm::lock_range wrong check
...
Minor header refactoring.
2020-11-04 14:59:26 +03:00
Nekotekina
2d38d8a639
Fix NEVER_INLINE attribute
...
Similarly to FORCE_INLINE, it doesn't imply inline on some compilers.
2020-11-04 14:59:25 +03:00
Nekotekina
1b8bf081b5
Upgrade to LLVM 11 Stable
2020-11-02 21:23:25 +03:00
Nekotekina
86fc842c89
TSX: new fallback method (time-based)
...
Basically, using timestamp counter.
Rewritten vm::reservation_op with the same principle.
Rewritten another transaction helper.
Add two new settings for configuring fallbacks.
Two limits are specified in nanoseconds (first and second).
Fix PUTLLC reload logic (prevent reusing garbage).
2020-10-31 15:34:14 +03:00
Megamouse
2cee26c3e7
Cleanup some includes
2020-10-31 11:53:46 +01:00
Nekotekina
605d57c541
sys_event: cleanup (replace vm::temporary_unlock)
...
Also made minor changes in sys_rsx.cpp.
Removed unused exception std headers.
2020-10-30 17:49:07 +03:00
Nekotekina
f972fa26a4
Derive RSX Replay thread from cpu_thread
...
Its id is set to 0, so fix some id_type() usages.
2020-10-30 17:36:11 +03:00
Nekotekina
8ce0819b42
SPU: add stx/ftx counters
...
Just count pure transaction successes and failures.
2020-10-29 18:57:57 +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
4966f6de73
vm: improve range_lock and shareable cache (Non-TSX)
...
Allocate "personal" range lock variable for each spu_thread.
Switch from reservation_lock to range lock for all stores.
Detect actual memory mirrors in shareable cache setup logic.
2020-10-27 17:56:19 +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