Commit Graph

580 Commits

Author SHA1 Message Date
rdb 84ed141b2a Squash merge webgl-port branch into master
Adds support for emscripten as a build target / platform, and adds a WebGL renderer back-end
2024-01-25 15:37:38 +01:00
rdb 034f1ea358 patomic: Implement futexes on macOS using ulock API
This is what is also used by the libc++ futex implementation on macOS, and should be more efficient than the fallback hash table approach
2023-10-21 14:46:51 +02:00
rdb 86aa437804 dtoolbase: Fix static init ordering regression
This was a regression in bf65624298 that caused crashes on startup in static builds due to the "small" DeletedBufferChain array not being initialized early enough

For some reason it wasn't being constant-initialized, it is now by setting the _buffer_size field to 0 initially and changing it later in get_deleted_chain
2023-10-09 12:49:04 +02:00
rdb 115a716a7d Implement support for custom TypedWritable subclasses in Python
Fixes #1495
2023-07-26 19:55:40 +02:00
rdb 72d610b8ae dtoolbase: Fix compiler warnings in MemoryHook 2023-02-22 16:47:14 +01:00
Frang 275fe32079
create PY_EXTENSION and friends (#1415) 2023-01-04 20:54:53 +01:00
rdb 2d606c07e3 dtoolbase: Remove unused `get_best_parent_from_Set()`
This method is no longer used as of e6f870ece6

Fixes #1421
2023-01-03 23:09:35 +01:00
Cary Sandvig 3247903d7b add more HAVE_PYTHON
Also add some more #endif comments.
2022-12-23 13:38:46 -05:00
rdb 05b3fe2170 dtoolbase: Use `patomic<size_t>` for memory usage counters 2022-12-03 22:42:03 +01:00
rdb 82522a7bef dtoolbase: Fix compile error in patomic.I with HAVE_THREADS=UNDEF 2022-12-03 21:53:02 +01:00
rdb 316b0009ae Merge branch 'release/1.10.x' 2022-10-31 23:10:39 +01:00
rdb d8a537b59b dtoolbase: Add comment clarifying assertion in DeletedBufferChain
[skip ci]
2022-10-31 19:26:59 +01: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
rdb 6e14591a8b CMake: Don't link to mimalloc if it is not enabled 2022-10-05 13:57:41 +02:00
rdb 27e54ffd75 Merge branch 'release/1.10.x' 2022-10-03 18:38:47 +02:00
DJs3000 f6fac95a78 Added e2k support (MCST Elbrus 2000) (#1367)
Closes #1367
2022-10-03 18:29:41 +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 c62d2319e0 CMake: Add --exclude-libs flags to static thirdparty libraries
Matching makepanda, this avoids symbol conflicts and may have optimization benefits.

This is a temporary hack until CMake 3.24 is released, which offers a cleaner way of doing this.
2022-03-09 16:23:37 +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 c356285212 dtoolbase: Compilation fix for broken STLs without atomic::value_type 2022-02-24 11:41:54 +01:00
rdb c3ce8164bc dtoolbase: Add atomic wait and notify operations from C++20
Adds patomic_signed_lock_free, patomic_unsigned_lock_free, and patomic_flag with wait/notify methods modelled after C++20.  Implemented using futexes, falling back to a mutex+condition variable hash table if not supported.  (Currently the hash table has a fixed size of 64, which we could increase if necessary, but we really shouldn't even have a fraction of that number of simultaneously sleeping threads...)

Other atomic types are unaffected at the moment, in part because futexes are really restricted to 32-bit ints on Linux anyway
2022-02-23 23:20:26 +01:00
rdb a37dfa727e makepanda: Support building with mimalloc on Windows, experimentally
Partial backport of 07545bc9e3 for Windows, requires building with `--override USE_MEMORY_MIMALLOC=1 --override USE_DELETED_CHAIN=UNDEF` for optimum effect
2022-02-06 15:29:25 +01:00
rdb 07545bc9e3 dtoolbase: Use mimalloc on Windows, disable USE_DELETED_CHAIN
Windows' malloc has awful performance.  mimalloc is orders of magnitude faster, even faster than DeletedBufferChain.  Therefore, only enable USE_DELETED_CHAIN on Windows when building without mimalloc.

On Linux, mimalloc doesn't appear to be measurably faster than glibc's own allocator.  Both are marginally than DeletedBufferChain, though, and substantially faster in the multi-threaded case, so USE_DELETED_CHAIN is disabled there in all cases.
2022-02-04 23:50:57 +01:00
rdb 39d69f13de dtoolbase: Change DeletedBufferChain to use new C++11-style atomics 2022-02-04 20:52:31 +01:00
rdb 8034cb5a92 dtoolbase: Introduce patomic<> as replacement for AtomicAdjust
This typedefs to std::atomic<> when building with true threading, and uses a dummy implementation without.

This lets us use the full range of atomic operations offered by C++11, including explicit specification of memory fences.  Using barriers lets the compiler generate more optimal code since currently we are using the quite strict sequential-consistent memory ordering for all operations.  ReferenceCount has been changed to use the correct barriers (I hope).  This may especially make a difference on weak ordering systems such as ARM.

Over time we should gradually replace the use of AtomicAdjust with the new patomic file.
2022-01-30 01:53:36 +01:00
rdb eaf8cb79d5 Add pickle support to a variety of classes 2021-12-12 18:35:44 +01:00
rdb 7dab0df061 cmath: Fix compilation error on macOS with sincos 2021-11-28 16:48:45 +01:00
rdb 480226a97a cmath: Use combined sincos on GNU where it is available 2021-11-28 16:14:36 +01:00
rdb 4a33e8866e dtoolbase: Add missing overloads for std::round on macOS 10.6 2021-08-04 13:35:27 +02:00
rdb 2a5b5030ba dtoolbase: Fix ability to use std::round() compiling for macOS 10.6 2021-08-04 13:18:43 +02:00
rdb 51b6a90fcb dtoolbase: Remove hacky support code for old libstdc++ on macOS 2021-03-26 21:08:29 +01:00
rdb 8cbe36b352 Merge branch 'release/1.10.x' 2021-03-01 19:33:27 +01:00
rdb 4b24ac86a5 dtoolbase: Fix issues building with C++20 2021-03-01 10:16:03 +01:00
rdb 06921aba93 CMake: replace "CVS" with "Git" 2021-01-18 23:50:08 +01:00
rdb 243fd10db0 CMake: Set PANDA_BUILD_DATE_STR if SOURCE_DATE_EPOCH is set
Adds CMake support for the 54638bfc10 change.

One thing to note, compared to makepanda, is that CMake doesn't automatically rebuild the file if this env var is changed.
2021-01-18 23:49:03 +01:00
rdb ae3d8c2663 dtoolbase: More elegant fix for NeverFreeMemory memory leak
Better fix for 74983d19a4 is to just switch to an std::multimap.  This couldn't go in the 1.10.x branch due to the risk of ABI change.
2020-12-20 01:02:15 +01:00
rdb dee8df9427 Merge branch 'release/1.10.x' 2020-12-20 01:02:08 +01:00
rdb 74983d19a4 dtoolbase: Fix small memory leak in NeverFreeMemory
It's using a set purely keyed by number of remaining bytes, so if there are two pages with the exact same number of remaining bytes, one of them gets lost.

See #1077
2020-12-20 00:19:37 +01:00
rdb ed397b3ab8 Merge branch 'release/1.10.x' 2020-12-09 17:59:37 +01:00
rdb 951c182c0e makepanda: Preparatory changes for Big Sur / arm64 builds 2020-11-30 19:46:20 +01:00
rdb b655aa86c5 Merge branch 'release/1.10.x' 2020-08-17 13:05:51 +02:00
LD 9f0fc0a594 dtoolbase: Fix bad double-prec NaN/inf detection in release build
Fixes #987
Closes #988
2020-08-17 12:16:33 +02:00
rdb 36c3d3e622 Merge branch 'release/1.10.x' 2020-05-05 18:15:57 +02:00
rdb 9159fc1029 operator delete should check for null pointer before deallocating
It is a pervasive belief that using "delete" with a null pointer is safe, so our custom delete operators should also handle this case correctly.

This may fix regressions introduced by #934
2020-05-05 18:13:13 +02:00
rdb 798066a05b dtool: remove outdated plugin-specific settings 2020-04-30 21:43:31 +02:00
rdb c9520c8daf Merge branch 'release/1.10.x' 2020-03-06 10:15:25 +01:00