Nekotekina
567d23d856
Implement util/auto_typemap.hpp
...
Used in vm::block_t as an example.
2020-12-24 14:55:25 +03:00
Nekotekina
a8e0d261b7
types.hpp: more cleanup
...
Also fix compilation.
2020-12-22 19:08:09 +03:00
Nekotekina
43a58df8a0
Butcher narrow cast a little (don't print value).
...
Also remove some forward declarations from util/types.hpp
If they don't work properly, it's easier to remove them.
2020-12-22 14:32:30 +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
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
eec11bfba9
Move align helpers to util/asm.hpp
...
Also add some files:
GLTextureCache.cpp
VKTextureCache.cpp
2020-12-18 18:07:42 +03:00
Nekotekina
db9b7db531
Cleanup and move sysinfo.h -> util/sysinfo.hpp
2020-12-18 12:55:54 +03:00
Nekotekina
05099e2ae1
Replace uint64_t with u64
2020-12-18 12:23:53 +03:00
Nekotekina
fb29933d3d
Add usz alias for std::size_t
2020-12-18 12:23:53 +03:00
Nekotekina
360c4d1554
Simplify f16 type
2020-12-18 12:23:53 +03:00
Nekotekina
4cfa9b11f3
Move busy_wait() to asm.hpp
2020-12-18 12:23:53 +03:00
Nekotekina
c16fb61bea
fixed_typemap.hpp: Fix assignment operator for g_ptr
...
Maybe RPCS3 hangs will finally be gone.
2020-12-17 16:47:25 +03:00
Nekotekina
ca5f0444bf
shared_ptr.hpp: add wait support for atomic_ptr<>
...
As well as default mask and value transformation function overload.
2020-12-15 12:52:21 +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
e321765c54
Split BEType.h to util/v128.hpp and util/to_endian.hpp
2020-12-13 16:34:45 +03:00
Nekotekina
09d293592e
shared_ptr.hpp: fix is_same_ptr<>() trait
...
Implemented as constexpr function.
2020-12-13 15:39:36 +03:00
Nekotekina
a6a5292cd7
Use uptr (std::uintptr_t alias)
2020-12-12 16:29:55 +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
33c3977036
endian.hpp: minor simplification
...
And stop pretending...
2020-12-11 22:00:26 +03:00
Nekotekina
aa3aef4beb
std::chrono cleanup: always use steady_clock
2020-12-11 19:01:56 +03:00
Nekotekina
36c8654fb8
Remove HERE macro
...
Some cleanup.
Add location to some functions.
2020-12-10 12:30:22 +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
062c605eb1
atomic.hpp: fixup (rsp addressing)
2020-12-08 08:51:27 +03:00
RipleyTom
51dcb4a79d
Remove bom from .hpp files
2020-12-07 20:03:44 +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
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
RipleyTom
af8c661a64
Remove BOM markers
2020-12-06 15:30: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
983439076b
shared_ptr.hpp: fixups and updates
...
Fix atomic_ptr load() edge case.
Implement atomic_ptr::peek_op() to make possible to reduce load() overhead.
Implement atomic_ptr::compare_exchange() and friends.
Implement null_ptr constant, remove nullptr_t assignment/construction.
2020-12-04 14:10:53 +03:00
Nekotekina
019f566239
atomic.cpp: more phase splitting in notify_all()
2020-12-04 14:10:53 +03:00
Nekotekina
332410d20b
shared_ptr.hpp: improve atomic_ptr methods
2020-12-04 14:10:53 +03:00
Nekotekina
13a0b88755
atomic.cpp: improve hashtable access
...
Simplified, tried to use all ptr bits.
Try to prevent self-collisions (bug).
Hashtable size doubled (to 8 MiB).
2020-12-01 10:19:31 +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
872655369a
shared_ptr.hpp: fix critical bugs
...
Fix array initialization.
Fix reference counting.
Fix offset to refctr.
Add some features.
2020-11-27 14:32:41 +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
bd90e3e37f
atomic.cpp: shrink and simplify main hashtable
...
Reduce collision detection to 1 or 0 for now.
I think it should be offloaded to notifiers.
2020-11-26 20:11:26 +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
2b674d4d8c
utils::shm: allow 2M hugepages on demand
2020-11-25 10:41:17 +03:00
Nekotekina
487b572aa6
Linux: remove assertions on MADV_HUGEPAGE
...
It's a hint and is allowed to fail.
2020-11-25 10:41:17 +03:00
Nekotekina
600c0ea5ba
atomic.cpp: fix windows/std path
...
Always check condition after rearming internal semaphore.
2020-11-25 10:41:17 +03:00
Nekotekina
00e64920c8
Implement "slow mutex" without spin-waiting.
...
Benefits: only 1 byte.
Testing atomic wait.
2020-11-25 10:41:17 +03:00
Nekotekina
d8e9382573
asm.hpp: constexpr refactoring
...
Removed asm (what an irony), made many functions constexpr.
Removed some unused function, readding them should be trivial.
2020-11-24 13:20:40 +03:00
Nekotekina
ab248e170c
vm_native.cpp: add MADV_HUGEPAGE
...
It enables Transparend Huge Pages for some regions on Linux.
Although it can't be actively useful, it seems to do something.
Maybe it's even harmful for recompilers.
2020-11-24 12:31:11 +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
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