Commit Graph

802 Commits

Author SHA1 Message Date
JohnHolmesII be75a564ca Fix builds with musl c 2018-12-30 21:31:06 +03:00
Jan Beich 33f7a39f5d fs: implement copy_file() fallback
sendfile(2) on DragonFly and FreeBSD can only write into sockets.
2018-12-29 18:07:45 +03:00
msuih dbd4814584 Disable thread assignment for Intel 2018-12-24 19:33:08 +00:00
msuih 1dd3a4b3f0 Detect hyperthreading on Windows 2018-12-24 19:33:08 +00:00
vit9696 5a40c1802b Support macOS bundling for binary distribution 2018-12-16 18:17:21 +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 febe4d4a10 Implement class cond_x16
Use as reservation notifier
Limited to 16 threads but allows more precise control of contention
2018-11-26 00:23:29 +03:00
vit9696 634a5fa31c Fix macOS compilation 2018-11-19 14:39:33 +03:00
Nekotekina 1fdd013e4b fs: normalize atime (ensure atime >= mtime) 2018-11-17 14:40:11 +03:00
Nekotekina c719ae360d fs: disable ctime (return mtime instead) 2018-11-17 14:40:11 +03:00
Nekotekina 7180c1f2d0 typemap: make use of volatile qualifier
Use shared lock for volatile pointers
Use no lock for const volatile pointers
2018-11-09 16:19:59 +03:00
Nekotekina 6a30d5a6c1 shared_mutex: increase max_readers to 16383
Standard requires at least 10000 for SharedMutex concept
2018-11-09 16:19:59 +03:00
Nekotekina 6104685ad6 Implement cond_one sync primitive
Change futex() args to use unsigned int
2018-11-05 13:14:11 +03:00
Dennis Luxen 36d4614d12 Fix a warning that shift overflows data type width (#5116) 2018-10-23 18:49:01 +03:00
Nekotekina f588454d26 Internal: register WaitOnAddress family functions (WinAPI) 2018-10-19 22:22:35 +03:00
Nekotekina 1b37e775be Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina 8ca6c9fff0 Fix thread_base::get_cycles (Linux/POSIX) 2018-10-19 22:22:35 +03:00
Megamouse 76da3fa907 RSX/Overlays: don't press buttons on every iteration 2018-10-03 21:37:05 +02:00
Nekotekina a8a9c11bf8 typemap improvements 2018-10-02 23:26:54 +03:00
Nekotekina f6f72c1cf8 Rename -> typemap_ptr::unlock() 2018-10-02 23:26:54 +03:00
Nekotekina bc87c5808c Add cond_variable::wait_unlock 2018-10-02 23:26:54 +03:00
Nekotekina 4bef0f8dab Rename thread_abort (name conflict) 2018-10-02 23:26:54 +03:00
Nekotekina 3359e9a51b Minor thread fixes
Call thread result destructor
2018-10-02 02:22:26 +03:00
Nekotekina 7a024f3355 Implement shared_mutex::lock_unlock
Minor fix for shared_mutex::try_lock - don't optimize for pessimistic case
2018-10-02 02:22:26 +03:00
Nekotekina 8a1b5abee1 utils::typemap implemented
Container for all types
2018-10-02 02:22:26 +03:00
Nekotekina da6ce80f4f Make vm::get_super_ptr return contiguous memory
Cleanup RSX code complexity
2018-09-27 23:37:13 +03:00
Nekotekina 306f95a9ae New named_thread template (preview)
Old class named_thread renamed to old_thread
It's too hard to move in a single commit
2018-09-27 14:04:16 +03:00
Nekotekina b2f29cd4d4 LLVM: remove false alarm errors
Writable sections ARE supported
2018-09-27 12:16:43 +03:00
Nekotekina bb524db236 Implement utils::memory_reset 2018-09-27 12:16:43 +03:00
Nekotekina a605dd0a3f Add missing deleted operators 2018-09-27 12:16:43 +03:00
Nekotekina a8a8cd88a0 Implement lf_queue<>, lf_value<>
lf_queue<>: unbound FIFO queue with dynamic linked-list
lf_value<>: concurrently-assignable value readable without locking at the cost of memory (using dynamic linked list)

Add atomic_t<>::compare_exchange
2018-09-27 12:16:43 +03:00
Nekotekina 9e5b633779 shared_mutex cleanup
Rewrite to use unsigned arithmetic, shrink to u32
Ensure zero default unlocked state (will need it later)
Inline all public methods, rewrite lock_upgrade()
Remove try_lock_degrade(), lock_degrade() methods
Implement lock_downgrade() (now trivial)
Remove is_reading(), added is_free()
Added reader_lock::try_upgrade()
2018-09-27 12:16:43 +03:00
Rui Pinheiro 8b3d1c2c91 Implement address_range utility class 2018-09-24 15:26:40 +03:00
Rui Pinheiro a07cbaca8e Update ASSUME, add ASSERT and AUDIT
- ASSUME now uses __builtin_assume in clang
- ASSERT defined as a wrapper around verify
- AUDIT aliases ASSERT when _DEBUG or _AUDIT are set, otherwise empty
2018-09-24 15:26:40 +03:00
Rui Pinheiro 13faf4e816 Avoid silent failures in RSX violation handler 2018-09-24 15:26:40 +03:00
Lassi Hämäläinen 972de4c730 CMake: Fix Linux WITHOUT_LLVM build
- _XABORT_RETRY is defined in immintrin.h which wasn't included
2018-09-19 21:17:01 +03:00
Nekotekina 26da91c972 Optimize logs
Pass va_args instead of constructing a temporary array
2018-09-19 14:14:04 +03:00
Nekotekina 11e297c975 Remove explicit in atomic_t constructor
Match with std::atomic
C++17 now allows writing std::atomic<int> x = 3;
2018-09-19 14:07:38 +03:00
Lassi Hämäläinen 7aef811ff7 CMake: Refactor CMake build (#5032)
* CMake: Refactor build to multiple libraries

- Refactor CMake build system by creating separate libraries for
  different components
- Create interface libraries for most dependencies and add 3rdparty::*
  ALIAS targets for ease of use and use them to try specifying correct
  dependencies for each target
- Prefer 3rdparty:: ALIAS when linking dependencies
- Exclude xxHash subdirectory from ALL build target
- Add USE_SYSTEM_ZLIB option to select between using included ZLib and
  the ZLib in CMake search path

* Add cstring include to Log.cpp

* CMake: Add 3rdparty::glew interface target

* Add Visual Studio CMakeSettings.json to gitignore

* CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script

- LLVM is now built under 3rdparty/ directory in the binary directory

* CMake: Move finding Qt5 to 3rdparty/qt5.cmake script

- Script has to be included in rpcs3/CMakeLists.txt because it defines
  Qt5::moc target which isn't available in that folder if it is
  included in 3rdparty directory
- Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3
  and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so
  those properties are not defined for all targets under rpcs3 dir

* CMake: Remove redundant code from rpcs3/CMakeLists.txt

* CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check

- Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling
  usage of the LLVM submodule.
- Move option definitions to root CMakeLists

* CMake: Remove separate Emu subtargets

- Based on discussion in pull request #5032, I decided to combine
  subtargets under Emu folder back to a single rpcs3_emu target

* CMake: Remove utilities, loader and crypto targets: merge them to Emu

- Removed separate targets and merged them into rpcs3_emu target as
  recommended in pull request (#5032) conversations. Separating targets
  probably later in a separate pull request

* Fix relative includes in pad_thread.cpp

* Fix Travis-CI cloning all submodules needlessly
2018-09-18 13:07:33 +03:00
Nekotekina 4cebf431fd Add forgotten SAFE_BUFFERS 2018-09-17 12:18:40 +03:00
Nekotekina 9de31fc5ce Fix trailing zeros in CPU brand 2018-09-17 12:18:40 +03:00
Nekotekina ed8aa774bb Optimize logging via logs::channel
Use constant-initialized severity subobjects instead of temporaries
2018-09-16 00:36:20 +03:00
Nekotekina c5676e5649 Remove thread_ctrl::atexit
It was only a workaround for poor C++11 thread_local support
2018-09-15 17:09:56 +03:00
Nekotekina d347145855 Fix bitset formatting 2018-09-15 17:09:56 +03:00
Nekotekina 445e5def42 Remove safe_reader_lock, safe_writer_lock
It worked as a simple recursive locker for shared_mutex
But its design is flawed and thus can't be fully implemented
2018-09-15 17:09:56 +03:00
Nekotekina e8b5555630 Rewrite vfs::get and vfs::mount
Preprocess . and .. correctly
Don't use recursive locking
Also use std::string_view
Fix format system for std::string and std::string_view
Fix fmt::merge for std::string_view
2018-09-15 17:09:56 +03:00
Nekotekina 2226125728 atomic_t<>: remove inline assignment
Add atomic_op/fetch_op overloads with template argument (may be removed in future)
Remove args... in atomic_op (capturing lambda is preferred)
2018-09-09 12:59:24 +03:00
Nekotekina fb5cdf9769 atomic_t<>: extend fetch_op to support cancellation
Use std::invoke inside atomic_op/fetch_op
Remove op_fetch because it's easily replaced
Add fetch_dec_sat algorithm (conditional decrement)
2018-09-08 00:32:04 +03:00
Nekotekina ed9fb8405b Move rotate/cntlz/cnttz helpers to Utilities/asm.h 2018-09-08 00:32:04 +03:00
Nekotekina ee96807305 Remove explicit_bool_t, ignore, multicast<>
Remove vm::ptr operator %
This was a bad idea but explicit_bool_t was created almost for it
Other removed types are unused and have little to no meaning
2018-09-08 00:32:04 +03:00