Commit Graph

301 Commits

Author SHA1 Message Date
rdb 126cd374e9 pipeline: Fix compile warning with pipelining disabled 2023-02-24 09:48:12 +01:00
rdb eefb51f510 dtoolutil: Add small_vector implementation and use it
This vector implementation does is optimized for the case of having only a small number of elements, which are stored directly on the vector object rather than being allocated from the heap.  If the capacity exceeds this small number, then a heap allocation is done.

This should improve performance in a couple of cases where vectors typically store 1 element and rarely more than that.
2023-02-22 16:48:11 +01:00
rdb 5e26aae1ff cleanup: Fix assorted issues uncovered by clang-tidy 2023-02-12 18:17:03 +01:00
rdb 2157f1162e pstats: Proper thread cleanup after a thread exits (PStats 3.2)
The thread will linger around in the server as long as there is data (so, it will be removed after `pstats-history` seconds)

Fixes #450
2023-01-10 14:37:39 +01:00
Frang 275fe32079
create PY_EXTENSION and friends (#1415) 2023-01-04 20:54:53 +01:00
Cary Sandvig 3247903d7b add more HAVE_PYTHON
Also add some more #endif comments.
2022-12-23 13:38:46 -05:00
rdb 863a38e901 pipeline: Display error if joining thread failed
This can occur if a thread tries to call join on itself
2022-12-03 21:48:34 +01:00
rdb f02a3156ca pipeline: Avoid dynamic allocation in PipelineCycler when using 1 stage
Eliminates a level of indirection at cost of 8 bytes per cycler
2022-11-21 20:23:03 +01:00
rdb 9bd66baa1c Merge branch 'release/1.10.x' 2022-11-21 19:02:50 +01:00
rdb 09f8634433 pipeline: Minor optimizations in cycler copy constructor
When copying a dirty cycler, don't use two separate lock-grabbing calls to add to the clean set, then remove from clean set and move to dirty set

Short-cut the cdata copy loop for the common case of only 1 stage
2022-11-21 18:31:54 +01:00
rdb bdb0f0b56a pipeline: Don't use yield ASM intruction on ARM < 7 2022-10-25 16:35:28 +02:00
rdb bf65624298 dtoolbase: Make MemoryHook constant-initialized
init_memory_hook() is no longer required, eliminating static initialization order issues

This required moving the DeletedBufferChain map elsewhere, which now also has a const-initialized array for relatively small allocations.

Also, deletedChain.T has been renamed to deletedChain.I

Fixes #539
2022-10-24 13:26:03 +02:00
rdb ee1db0630a pipeline: _mm_pause alternative on non-x86 Windows 2022-10-23 14:21:39 +02:00
pmp-p 2208cc8bff pipeline: support android no thread build
Closes #1323
2022-06-29 19:11:00 +02:00
rdb ecf4d19e83 Merge branch 'release/1.10.x' 2022-05-10 16:12:36 +02:00
rdb 42a19860d5 Fix errors when compiling headers with MinGW 2022-05-10 15:58:33 +02:00
rdb fbea0056f5 general: Allow compiling Panda headers on Windows without NOMINMAX 2022-05-10 15:58:33 +02:00
rdb 98d70147bd pipeline: Fix Thread::bind_thread() assertion on Android 2022-03-12 16:48:46 +01:00
rdb 370b635534 dtoolbase: Fix missing __stdcall when compiling for 32-bit Windows 2022-03-02 09:57:24 +01:00
rdb a0be50c769 general: Fix assorted compiler warnings 2022-03-01 16:09:07 +01:00
rdb 583c9f1857 pipeline: Fix issues with calling convention on 32-bit Windows 2022-03-01 12:19:13 +01:00
rdb c2d088f232 pipeline: Don't use Sleep(1) to yield on Windows
Use Sleep(0) instead.  Sleep(0) is not guaranteed to yield, which is a problem, but Sleep(1) can easily take up to 16 ms, which is really unacceptable except in very low-priority thread.  But really, you shouldn't be relying on force_yield() for anything except with the SIMPLE_THREADS model.

There is also SwitchToThread(), but in fact it is even weaker than Sleep(0).
2022-02-23 23:20:53 +01:00
rdb 70c49a6416 pipeline: Add Thread::relax() for more efficient busy waiting
Equivalent to cpu_relax() or the pause instruction on x86
2022-02-23 23:20:30 +01:00
rdb fd033e66f1 pstats: Add support for profiling thread context switches
Disabled by default, enable with `pstats-thread-profiling true` in Config.prc
2022-02-22 18:02:39 +01:00
rdb 46a1ad3544 pipeline: Improve performance of Thread::get_current_thread() substantially
Speedup is realised by using thread-local variables.  Note that on Windows we can't inline get_current_thread, but it's still faster this way than calling TlsGetValue.

In theory the cache line alignment should help avoid false sharing but I have not profiled that extensively.
2022-02-04 23:49:39 +01:00
rdb f6322d8c93 pipeline: De-inline ConditionVarDummyImpl methods
This is the only ConditionVar implementation to import thread.h directly
2022-01-30 02:03:18 +01:00
rdb cc865e6d21 pipeline: Don't exit process when SystemExit happens on external thread
PyErr_Print() causes the process to be forcibly exited when a SystemExit exception occurred, this is a big issue on Android.
2021-12-10 14:56:01 +01:00
rdb 44e10d10a0 Support deploying Python apps for Android using bdist_apps 2021-12-07 21:00:08 +01:00
rdb b1b05c2be9 thread: Allow arbitrary std::function (incl. lambdas) in GenericThread 2021-12-01 11:31:45 +01:00
rdb fac6916151 pgraph: Major traversal optimizations
In particular, these optimize the traversal of nodes that are not in view, which are discarded more efficiently.
This change affects both the cull and collision traversers.
2021-11-16 17:30:33 +01:00
rdb 8cbe36b352 Merge branch 'release/1.10.x' 2021-03-01 19:33:27 +01:00
rdb bdb2ef1631 pipeline: Fix crash upon exception in custom thread
We can't call PyErr_Restore() without a valid thread state, which won't exist in a custom thread if we just called PyGILState_Release().  Not sure how this has ever worked.
2021-03-01 16:19:53 +01:00
Daniel 4f63ef635d panda: Remove PyEval_InitThreads calls when compiling against Python 3.9+
Cherry-pick from #1053
2020-12-12 00:16:58 +01:00
Daniel 54cb519dc9 panda: Remove PyEval_InitThreads calls when compiling against Python 3.9+
Closes #1053
2020-11-23 10:56:09 +01:00
rdb e4819f2b5c pipeline: fix compilation error on Windows with simple threading 2020-04-01 18:59:44 +02:00
Leandro (Cerberus1746) Benedet Garcia 5f7809469c general: removed all WIN32, WIN32_VC and friends 2020-02-05 22:45:03 -07:00
rdb b272af8bbf Merge branch 'cmake' 2020-01-22 11:20:51 +01:00
rdb 1bb4a032aa Drop support for Windows XP 2020-01-13 15:06:44 +01:00
Sam Edwards dbe7a2f94b Merge branch 'master' into cmake 2019-09-06 04:05:12 -06:00
rdb d1d244dfd2 pipeline: per-frame output message should be spam, not debug 2019-09-06 09:48:11 +02:00
Sam Edwards 5fa4af9189 CMake: Rely on GNUInstallDirs to specify install paths
This makes multiarch OSes happy as they can dictate that
64-bit libraries go into 'lib64'
2019-08-31 00:48:42 -06:00
Sam Edwards 1a654cba04 CMake: Record the location that headers are installed
This populates INTERFACE_INCLUDE_DIRECTORIES on the targets
after they're installed.
2019-08-30 22:58:18 -06:00
Sam Edwards 088949e2a1 CMake: Update for upstream changes 2019-06-04 00:00:09 -06:00
Sam Edwards 039f5af34e Merge branch 'master' into cmake 2019-06-03 23:12:23 -06:00
rdb c4a01ac564 pipeline: give Mutex and ReMutex more Pythonic semantics
This allows using mutices in with-blocks and wraps up the functionality of acquire() and try_acquire() into a single acquire(blocking=True).

Furthermore, the GIL is no longer released in cases of no contention.
2019-05-12 20:58:13 +02:00
Sam Edwards b8f3c7eb63 CMake: Move some symbols from dtool_config.h to -D flags
The symbols moved aren't used in any headers, so they don't
have to be in the installed dtool_config.h. Removing them
keeps the recompiling to a minimum when an optional feature
is toggled.
2019-04-15 22:16:05 -06:00
Sam Edwards 6097d34ead CMake: Neatly format everything for readability and consistency 2019-04-14 22:37:18 -06:00
Sam Edwards 9c90ad596e CMake: Update for upstream changes 2019-03-12 02:05:06 -06:00
Sam Edwards f8161cc529 Merge branch 'master' into cmake 2019-03-12 02:03:16 -06:00
rdb 6d927aaa52 Merge tag 'v1.10.1' 2019-02-14 23:21:57 +01:00