Commit Graph

72 Commits

Author SHA1 Message Date
Gregory Hainaut 02861fabc8 pcsx2|common: replace throw() by noexcept 2017-05-13 10:38:35 +02:00
Gregory Hainaut 1a9a65d4d0 common: use = default instead of trivial destructor
Strangely clang-tidy didn't report them.

Commit was done with a sed to it need careful review.
2017-05-13 10:38:35 +02:00
Gregory Hainaut b951e24024 common: remove throw specifier on destructor
By default in C++11 destructors are noexcept.
Besides throw is deprecated
2017-05-13 10:38:35 +02:00
Gregory Hainaut a378e307b3 common: drop pthread TLS emulation
thread_local is supported by all C++11 compliant compiler

Keep a way to disable TLS for shared object to avoid issue of DTV
slot shortage.
2017-04-14 17:18:20 +02:00
Clang Format 1fba5cb580 reformat main common directory
Disable some reformat around emitter registers declaration and a massive cases.
2016-11-12 16:52:49 +01:00
Gregory Hainaut 10ea05bc6f common: remove old atomic wrapper
Use cross-platform std::atomic instead
2016-07-14 18:29:41 +02:00
Gregory Hainaut ca46921796 MTVU: use acquire/release semantics for atomic operation
* Avoid the generation of memory barrier (mfence)
* Based on the fact that it used to work on previous code without any
  barrier

v2:
* keep basic code in reset path
* use relaxed access for isBusy. The variable doesn't carry load/store
  dependency but is instead an hint to optimize semaphore post
2016-07-14 18:29:40 +02:00
Gregory Hainaut 610bf8a277 Common: delete most of the deprecated atomic API 2016-02-28 15:29:31 +01:00
Gregory Hainaut ca8955daf3 MTVU: port ScopedLockBool to std::atomic 2016-02-28 15:29:31 +01:00
Gregory Hainaut 60fe26ff2f common:threading: Port NonblockingMutex to std::atomic_flag 2016-02-28 15:29:00 +01:00
Gregory Hainaut 89fad4d3ad common: port ScopedPtrMT to std::atomic
v2: s/NULL/nullptr/
v3: tentative fix for MSVC
// ScopedPtrMT.h(91, 0): error C2593: 'operator ==' is ambiguous
2016-02-28 15:29:00 +01:00
Jonathan Li a74677acf7 utilities: Convert ScopedPtr to unique_ptr 2016-02-08 22:31:45 +00:00
Juha Laukkanen fc3ff48777 Darwin/OSX SysMessage stub & __POSIX__ define. 2015-11-30 12:18:44 +02:00
Jonathan Li 8312e21f00 utilities: Cleanup unused memcpy defines
All refer to memcpy, and only memcpy_fast is used, so there's no point
keeping them.

Also remove the _memset16_unaligned function prototype since there's no
function definition for it.
2015-09-12 10:00:49 +01:00
Gregory Hainaut a52f598369 spu2x:zzogl: disable TLS
builds an Utilies_NO_TLS.a archive of the common Utilities code. It replaces native TLS by a slower reimplementation

Rational: number of TLS slot is very limited by the GLIBc on linux. I hope it doesn't impact performance.
* Zzogl don't requires TLS AFAIK
* spu2x will likely use it for assertions only.

TLS exhaustion creates issue to dlopen plugins
    issue #384 : https://github.com/PCSX2/pcsx2/issues/384

But also for profiled build (-fprofile-generate)
    http://forums.pcsx2.net/Thread-WORKAROUND-build-with-fprofile-generate

If someone have a better idea, please raise your hand!
2014-12-08 22:26:46 +01:00
Ryan Houdek 3d37a6ce27 Removes the usage of __LINUX__ define
This is defined and set it a ton of different places.
It's checked in a whole lot more
Instead just use __linux__ like a real project should
2014-08-03 13:20:36 -05:00
Gregory Hainaut d5d19acb3f wx3.0: lots of cast...
Various string as still wrong but at least it can be compiled now.

I think the remaining issue are w_char with %s format (at least on linux)
2014-07-29 20:45:44 +02:00
gregory.hainaut 136300ab2e linux compilation fix
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4868 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-08-12 18:25:21 +00:00
cottonvibes ac9bf45f98 pcsx2: Implemented Threaded VU1 :D
Threading VU1 took a lot of rewrites and new code to make possible (MTGS, microVU, gifUnit...), but we finally got to the point where it was feasible, and now we've done it! (so now everyone can stop complaining that pcsx2 only takes advantages of 2 cores :p).

The speedups in the games that benefit from it are great if you have a cpu with 3+ cores (generally a 10~45% speedup), however games that are GS limited can be a slowdown (especially on dual core cpu's).

The option can be found in the speedhacks section as "MTVU (Multi-Threaded microVU1)". And when enabled it should should show the VU thread-time percentage on the title bar window (Like we currently do for EE/GS/UI threads).

It is listed as a speedhack because in order for threading VU1 to have been a speedup, we need to assume that games will not send gif packets containing Signal/Finish/Label commands from path 1 (vu1's xgkick). The good news is very-few games ever do this, so the compatibility of MTVU is very high (a game that does do this will likely hang).

Note: vs2010 builds and Linux builds need to be updated to include "MTVU.h" and "MTVU.cpp".


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4865 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-08-12 02:31:49 +00:00
Jake.Stine 91851c6222 Trace Logging:
* Cleaned up trace logging and switched from C++ initializers to C-style const arrays.  Kinda mixed on which I like better, but decided to go with the general rule of thumb that a bit less C++ weirdness is probably a good thing.
 * Removed __assume() feature from pxFail and pxFailDev, due to the likeliness of unwanted/unexpected compiler behavior (MSVC only).  To hint the compiler that code should be unreachable, explicitly use pxAssume(false).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3643 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-08-16 15:01:13 +00:00
Jake.Stine 912872af80 Introducing a mostly revamped Tracelog and Console log system. Various console log sources can now be toggled on/off on the fly, allowing end users to enable more verbose logging when they encounter problems. Both console and trace sources can be given automatic prefixing.
DevNotes:  DevCon logs are now available in *Release* builds as well as Devel builds, and can be enabled from the Console window's "Sources" menu.  They are disabled by default in Release builds, and are always enabled regardless of the ini setting in devel builds.  Debug logs are still strictly available in debug builds only.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3609 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-08-06 05:46:09 +00:00
Jake.Stine 934578c8fe ReorderingMTGS: Added a new optimized memcpy_amd_qwc, for use by GIFpath copies. After much studying, we determined this is about as efficient as memcpy will ever get, for what we're doing with it.
DevNot:  Win32-only at the moment -- needs a GAS port (but that shouldn't be hard).  I made some notes in the code about it.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/ReorderingMTGS@3472 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-07-12 19:40:30 +00:00
Jake.Stine 1c7fc3e176 Mostly-new host exception system (host meaning the C++ / SEH exceptions, not the VM's PS2/MIPS exceptions). Main purpose is to make specifying diagnostic and end-user messages more sane. Secondary goal was to remove the need for C++ multiple and virtual inheritance, which are buggy in MSVC still, and problematic even when they aren't buggy.
I also re-implemented R5900 runtime exception handling for TLB Miss and such (devbuilds only, for now).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3335 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-06-28 18:03:54 +00:00
Jake.Stine a7b2855412 Refactoring: (boring)
* renamed PersistentThread to pxThread (shorter, sweeter, and the 'persistent' part is obsolete since its now a full blown thread manager since some while ago).
 * Renamed a bunch of the PostMethodToMain stuff to Rpc_TryInvoke*  (for remote procedure call).  It's probably not a good use of the term, but I'm bummed I can't think of anything better/shorter.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3238 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-06-19 13:42:32 +00:00
Jake.Stine 12bdd9dc10 * Fixed death-by-recursion caused when a thread threw an exception.
* Fixed some minor bugs when processing idle events.
 * Plugin Load/Init/Shutdown/Unload are all called from the Main/UI thread again; this is important for plugins that issue popup warning/error messages.

DevNotes:
 * Added ScopedPtrMT, a multithread-safe version of ScopedPtr.
 * MTGS errors are still not handled as gracefully as they should be; namely the MTGS thread doesn't restart itself (it's on the TODO list).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2958 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-07 03:20:58 +00:00
Jake.Stine 70d47bf240 Copyright 2010 : PCSX2 and plugins! (notable exception: didn't update copyright info in any Gabest plugins)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2937 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-03 14:08:02 +00:00
Jake.Stine 1507d72cad UI Bugfixes:
* Fixed several obscure deadlock issues.
 * Savestate actions block; such that only one load or save is permitted at a time.
 * Savestates now work through temp files, so that the existing file is not corrupted in case errors occur.
 * Exiting the emu while a savestate is saving will still save the state before completely quitting.
 * Plugin init errors are handled more gracefully.

Developer Notes:
 * Added some event diagnostic trace logging stuff.
 * More preliminary work on memorycards -- moved them to their own dialog box and started implementing things, but still a lot of work to do before it's ready for use.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2936 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-03 13:51:46 +00:00
Jake.Stine 5d37925617 Major UI renovations!
* Added versioning info to savestates! (along with some other bugfixes)
 * Simplified the Boot and System menus -- removed the old Skip BIOS hack and replaced it with the new BOOT2 injection method (which is considered hack-free at this time).
 * Removed lots of UI deadlock gotchas.
 * Some new confirmation dialogs and better error handling.
 * Implemented an exclusive SysExecutor thread, which serves the purpose of executing system/VM commands and events in uninterrupted order (including suspend, resume, savestates, etc.)



 * ... and probably broke linux!

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2911 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-04-27 13:12:03 +00:00
sudonim1 4457fe40fc Removed all trailing whitespace in *.c *.cpp *.h because it irritates me.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2897 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-04-25 00:31:27 +00:00
Jake.Stine 4383cb5b0c Added CPU and GPU load readouts (currently Win32 only). Documented possible methods for implementation in linux. (linux project files aren't updated yet, short on time -- sorry!)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2520 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-01-25 15:31:17 +00:00
Jake.Stine e747337d63 A big old crapload of UI and thread management changes. Recoded the EventSource/EventListener system to be more C++ and less hacky C. Probably breaks Linux!
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2474 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-01-22 15:22:01 +00:00
Jake.Stine a63115988b PS2E v2 (plugin interface) tweaks and additions.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2402 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-27 12:15:21 +00:00
Jake.Stine 9473e69b7f Thread Local Storage Fixes:
* Implemented TlsVariable, a nifty alternative to __threadlocal, suitable for archaic operating systems that don't have native TLS support (namely Mac OS/X).
 * Added a forced reference to TLS in AppInit so that TLS is sure to be available to DLLs (otherwise windows doesn't init TLS by default).
 * Disabled TLS support in the x86emitter by default, since it's looking increasingly like we won't find a use for multithreading PS2 sub-components (can be re-enabled later if spontaneous brilliance at a later date proves me wrong).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2396 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-24 22:22:34 +00:00
Jake.Stine 500c1dbfeb Re-implemented Ping() into wxApp, this time using Idle events (for once I found a use for them!). This because the YieldToMain logic wasn't ever going to work right since wxWidgets lacks a way to poll the event loop for pending events. End result: More responsive GUI dialogs and junk. ;)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2376 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-21 11:52:14 +00:00
Jake.Stine c17455c702 User Interface code cleanups and bugfixes. some highlights:
* Configuration panels are all modal-less now, so that you can open the config panel and leave it open while running games.
 * Handful of thread sync improvements.
 * Fixed on-the-fly interpreter/recompiler configuration.
 * Fixed plugin hotswapping (mostly works, but still a little funny at times)
 * All new assertion dialogs and popup message handlers.
 * RecentIsoList defaults to 12 instead of 6

Dev Notes:
 * I had to create a new set of assertion functions called pxAssume*.  Originally I hoped to avoid that complexity, and just use a single one-assert-fits-all case, but turned out blanketly using __assume() for all assertion cases wasn't reliable.
 * wxGuiTools: Replaced the operator, with operator& -- the latter has proper order of precedence, the former required () to scope correctly. >_<

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2339 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-14 12:18:55 +00:00
Jake.Stine ba473e0a7f * Redid console logging to use stdout instead of the buffered queue (probably less buggy).
* Removed some hacks from cpuDetectInit's use of cpuId.
 * Improved assertion checking for thread affinity.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2327 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-07 22:43:16 +00:00
Jake.Stine 03449cf682 * Improve GUI responsiveness while doing things like enumerating/loading plugins.
* ConsoleLogger Optimization: Improved performance considerably for when the log gets spammed by EEcore or MTGS threads.

DevNotes:
 * Added a new pxYieldToMain() method (currently implemented in Win32 only).  It provides a smart way to allow passive-task worker threads to yield time to the Main Thread when important messages are pending (keyboard or mouse clicks, primarily).  It also replaces the wxGetApp().Ping() stuff, which never worked anyway due to wxCommandEvents having a higher priority than native system messages.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2253 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-26 03:37:10 +00:00
Jake.Stine b288e82b95 Couple more MTGS sync fixes, and some final optimizations.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2247 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-24 20:11:43 +00:00
Jake.Stine 48ca426be4 Added AtomicBitTestAndReset() to thread tools and added a Normalize helper to 'Path' namespace.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2242 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-24 08:32:39 +00:00
Jake.Stine 87b443a873 Some preliminary work for improving multithread recoverability and deadlock handling. (not really doing much useful yet)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2234 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-22 09:47:52 +00:00
Jake.Stine af7bb73948 Fixed the Recent Iso List, which got broken a few revs back... and many more wee bug fixes, most are too unimportant to list here!!
Code Cleanups:
 * cpuDetect: Split Win32/Linux code portions into separate modules. (probably breaks linux)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2205 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-16 13:54:32 +00:00
Jake.Stine 376a2c94b1 Added some hourglass cursors for various things; renamed more Semaphore and Mutex APIs (I'm too indecisive >_<)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2109 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-11-01 09:27:16 +00:00
Jake.Stine e92e3fb4bb I speal gewd. (Aquire -> Acquire)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2103 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-31 19:25:46 +00:00
Jake.Stine bc2aa38aa1 Implemented ELF loading! :D
Renamed a bunch of functions/methods in the Threading namespace that have been bugging me for a while.  (MutexLock is renamed to Mutex, Lock() is renamed to Aquire(), etc)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2102 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-31 19:18:29 +00:00
Jake.Stine efc35405f8 Reorganized the exception/signal handlers, setjmp/longjmp, and SysCoreThread stuff:
* Exception/Signal handling now uses an EventSource, so that multiple handlers can be registered.  This is in preparation for (eventual) more complete MIPS TLB support in the VTLB memory model.
 * Improved code isolation, so that recompiler-specific code is primarily in iR5900-32.cpp (cleans up Counters.cpp and SysCoreThread.cpp)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2063 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-23 20:24:59 +00:00
Jake.Stine f172829737 aligned_stack:
* Added -fno-strict-aliasing to the ever growing list of gcc optimizations that can potentially cause perfectly good C code to generate entirely broken results.
 * Removed the preferred-stack=2, since this branch *should* run fine without it now.
 * Have Release builds in Linux SIGKILL when encountering an unexpected SIGSEGV.
 * Fixed some deadlock issues with the new console logger (it introduced cancel points, which is a good thing!  unless you're the EE recompiler and you swallow up any attempt by GCC to cancel a thread)
 * Compilation error fixes.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/aligned_stack@2049 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-21 08:57:05 +00:00
Jake.Stine 27174c3f5b * Improved the framelimiter sleep mode more (less cpu used and more responsive to fps fluctuation near the 60fps line at the same time)
* Added timeBeginPeriod() to improve the Win32 kernel scheduler resolution (improves sleep accuracy and thread responsiveness)
 * hackfixed some code that made exiting pcsx2 "slow" sometimes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2041 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-19 23:13:22 +00:00
arcum42 29e8fe94e9 Change a few project options and get rid of _unused.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2036 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-19 10:42:36 +00:00
Jake.Stine 6c631e009d Yet more thread sync fixes, mostly to do with rapid reset/resume/suspend/exit actions.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2030 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-18 12:30:00 +00:00
Jake.Stine d69f6610e8 More threading improvements:
* Added TimedLock to MutexLock
 * Use MutexLock::TimedLock as a replacement for some sloppy semaphore use in SysCoreThread and PersistentThread.
 * Minor fixes to thread cleanup when exiting the App
 * Added some extra deadlock protection to the blocking Wait and Lock functions for Mutexes and Semaphores.
 * Moved MutexLock and Semaphore implementations into their own files.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2022 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-17 18:21:30 +00:00