Large graphical Qt applications heavily rely on heap allocations.
Jemalloc is a general-purpose malloc(3) implementation designed to
reduce heap fragmentation and improve scalability. It also provides
extensive tuning options.
Add a -jemalloc configure option, disabled by default. When enabled, Qt
and user code link to jemalloc, overriding the system's default
malloc().
Add cooperation with jemalloc for some Qt key classes: QArrayData (used
by QByteArray, QString and QList<T>), QBindingStoragePrivate,
QDataBuffer (used by the Qt Quick renderer), QDistanceFieldData,
QImageData, QObjectPrivate::TaggedSignalVector, QVarLengthArray.
This cooperation relies on two jemalloc-specific optimizations:
1. Efficient allocation via fittedMalloc():
Determine the actual allocation size using nallocx(), then adjust the
container’s capacity to match. This minimizes future reallocations.
Note: we round allocSize to a multiple of sizeof(T) to ensure that
we can later recompute the exact allocation size during deallocation.
2. Optimized deallocation via sizedFree():
Use sdallocx(), which is faster than free when the allocation size
is known, as it avoids internal size lookups.
Adapt the QVarLengthArray auto tests on capacity.
Non-standard functions docs are at https://jemalloc.net/jemalloc.3.html
[ChangeLog][QtCore] Added optional support for the jemalloc allocator,
and optimized memory allocations and deallocations in core Qt classes to
cooperate with it.
Change-Id: I6166e64e66876dee22662d3f3ea3e42a6647cfeb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
New upstream version.
Importing note: 10.45 is missing a licence file for the sljit
dependency. This is tracked upstream at
https://github.com/PCRE2Project/pcre2/issues/686
so it may get fixed in 10.46 (in which case the import script /
qt_attribution.json may need to be amended).
[ChangeLog][Third-Party Code] PCRE2 was updated to version 10.45.
Pick-to: 6.9 6.8 6.5
Change-Id: Ifa0430782bed8ffb1c26f44ca6eb06cd26aaa1f9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We don't need anything that the class provided, but we needed it because
everything is in a large .mm source file.
I've also removed portions of qcore_mac.mm that aren't needed for
bootstrapped tools, like telling whether dark mode is in effect (the
bootstrapped tools aren't GUI). I've also had to remove the check for
running under Rosetta, which hopefully is going to affect no one:
running moc & cmake_automoc_parser under Rosetta is going to be mighty
slow. Just use a native set of tools instead.
Change-Id: I4c0c716a5b57833abf63fffdf0c66b9ebaccffdb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
We don't need to discover the application's name or file path. This also
removes the only use of QStandardPaths::findExecutable(), so we can
remove the entire class too.
Change-Id: Id297dc9b56ada635cfc9fffd679ead9378fffb03
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
The three bootstrapped tools should validate their arguments properly,
so there's no need to have them print something. They aren't means to
test the Qt classes either, so assertions shouldn't apply.
Change-Id: I580758610c7262414b64fffd54f84eb16743673d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
And fix some compilation bugs if QT_NO_DEBUG_STREAM is defined.
Drive-by fix the grammar in the qcommandlineparser.cpp qWarning().
Change-Id: Ia9287ea189ae4a4b7545fffdbff7dbb9196de519
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
The previous commit removed the one use of QUuid and, through it,
QCryptographicHash in one of the three bootstrapped tools.
Change-Id: I31b7f9f6aa402709bad7fffd3a65e86be7f6d882
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
... except, of course, the implementation file, which therefore has to
be excluded from PCH'ed builds.
Remove qvsnprintf.cpp from libbootstrap, as it's no longer needed
after porting all five uses of qsnprintf() in QtCore to C++11's
std::snprintf(), which even Windows implements with std behavior.
The reason we're removing the function is that std::snprintf() is the
better alternative: qsnprintf() just introduces even more platform
variance than any implementation-defined behavior of C or C++
snprintf().
To wit:
- On Windows, the return value is sometimes "wrong"
(cf. Windows-specific qsnprintf() tests in tst_qbytearray.cpp)
- On WASM and at least some Android configurations, it is incorrectly
implmented using the QString::asprintf().toLocal8Bit() work-around,
even though both platforms have a working snprintf().
QString::asprintf() is implemented in Qt itself, so has some
differences:
- the `a` format for hex floats is not supported
- %ls expects char16_t*, not wchar_t* (these are, in general, not
the same width)
We will deprecate these functions in 6.9, but before we do, we need to
get the Qt code in order, and that's where this macro comes in.
[ChangeLog][QtCore] Added the QT_NO_QSNPRINTF macro to disable
qsnprintf() and qvsnprintf(), which will also be deprecated in 6.9.
See the documentation for details why we take this step.
Task-number: QTBUG-127110
Pick-to: 6.8
Change-Id: I4e1c1f213bcfd615f83387f5f51e77fa1ff2062e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Fixes build with clang-cl on Windows.
This is a workaround for
https://github.com/llvm/llvm-project/issues/25679
Change-Id: I6dc8b045376101d8b8cc26fe5db3e7bf87a6a8f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qiterable.cpp is even a comment-only source.
Change-Id: I01ec3c774d9943adb903fffd17b79d567a435594
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
That is, use the inline functions that refer to <numeric_limits> and
<cmath> directly, instead of the out-of-line wrappers. Someone should
verify if the hacks for QNX's <math.h> are still required.
Change-Id: I01ec3c774d9943adb903fffd17b7ee560b4b71b9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Bootstrapped tools don't usually need to list directories; they should
operate on file lists passed to it by the build system instead.
This may deserve a QT_FEATURE.
Change-Id: I01ec3c774d9943adb903fffd17b7ecfba2702fc5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Done by harmonizing the use on the QT_CONFIG(temporaryfile) macro and
fixing one test that was missing. We can't remove the older macro
because it is marked PBULIC) but we don't need to use it ourselves.
Change-Id: I01ec3c774d9943adb903fffd17b7eb4dd1a4e63f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
The bootstrapped tools really mustn't produce random output (they must
always be reproducible exactly). Therefore, ensure we don't need this
file.
Change-Id: I01ec3c774d9943adb903fffd17b7eb94dbd4be89
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
I added QT_NO_VARIANT to qconfig-bootstrapped.h to be clearer on what
the #ifs are, but there's no testing of that feature outside of
QT_BOOTSTRAPPED.
Change-Id: I01ec3c774d9943adb903fffd17b7e8ac4340fb89
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It was only used by the cmake_automoc_parser so it would write a 64-bit
in big-endian format. So bypass QDataStream and write it native
endianness.
Change-Id: I01ec3c774d9943adb903fffd17b79c78e56db4cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It makes more sense there, as all the other functions in that file are
about early termination. This allows us to remove qglobal.cpp from the
bootstrap library, because qglobal.cpp now only has the callback tables.
Amends 8f13af5d7b9b659208a8a93e6581d30b434dae1f.
Change-Id: I01ec3c774d9943adb903fffd17b7ea92404bdbd3
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Use QDirListing in the Bootstrap build instead of QDirIterator.
Drive-by changes:
- more const variables
- use emplace_back() instead of append() where appropriate
Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Apart from some source code reshuffling, 10.43's JIT has
dropped its support for ARMv5.
[ChangeLog][Third-Party Code] PCRE2 was updated to version 10.43.
Pick-to: 6.7 6.6 6.5
Change-Id: I7909f0a9358f38282f5eaeacd2eb10529b47e63c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
- kIOMasterPortDefault -> kIOMainPortDefault
- Use UTType instead of Carbon Core functions/constants
- NSWorkspace iconForFileType -> iconForContentType
- Removed obsoleted kUTTypeInkText pasteboard type
There are still a few more, but these will be fixed in follow ups.
Change-Id: Ibbca226d578b4ba64bd9c8c5d0addc1870114a20
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
It appears to be used only in qlalr, which is, however, not
bootstrapped.
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Idc16d957bf687238c7b0ee603d8b092e2048ef18
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unity build is disabled by default for all 3rdparty libraries, so we
don't need to set the manually anymore; and for the plugins we can use
NO_UNITY_BUILD instead.
Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ia2f83ae083924d31adf07e7647b34ae6571ed01f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add exclusions for issues that are likely not fixable
(3rd party code, X11 define clashes, etc) in 3rd party,
tools and plugins.
Pick-to: 6.5
Task-number: QTBUG-109394
Done-with: Amir Masoud Abdol <amir.abdol@qt.io>
Change-Id: I698c004201a76a48389271c130e44fba20f5adf7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
[ChangeLog][QtCore][QTimeZone] QTimeZone is now always defined;
feature timezone now controls most of its prior API and some new API
is added, most of it always present, to enable QTimeZone to package a
Qt::TimeSpec and, for Qt::OffsetFromUTC, its offset. Prior to this
change, APIs using Qt::TimeSpec had to provide a separate function
taking a QTimeZone alongside a function taking a Qt::TimeSpec and
optional offset; it will now be possible to unify these into a single
function taking a QTimeZone. Adaptation of other Qt classes to do so
shall follow.
Task-number: QTBUG-108199
Change-Id: If5ec3cc63920af882ebb333bf69cde266b1f6ad7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
syncqt.pl adds an extra dependency on perl when building Qt. Modern C++
provides the convenient cross-platform way to access a filesystem and
to use regular expressions, so we may replace the perl script with C++
application. The syncqt executable is built at configure time and
installed as QtCore tool. It's running at configure time to deliver the
required header files for IDE to build a consistent code model and at
the build time to keep tracking changes in header files and generate
the missing aliases without reconfiguring. 'syncqt' only parses header
files from a CMake build tree, so the resulting Qt installation only
contains interfacing headers that belong to the platform that Qt is
built for. 'sync.profile' files are not used as the 'source of truth'
for sync qt procedure anymore, all the necessary information is taken
from either CMake files at configure time or from the module header
files while parsing them.
syncqt.pl is still in place since it's required as fallback solution
for a smooth transition to the new syncqt implementation for all qt
repositories.
This patchset only enables the C++ based syncqt for 'qtbase'
repository.
From the performance perspective C++ version works faster then perl
script, also the configure time is reduced significally on subsequent
reconfigurations - up x2 times faster when re-configuring repository,
but it also takes time to compile the tool itself the first time.
Numbers for qtbase:
syncqt.pl syncqt.cpp
initial: 0m16,035s 0m20,413s
reconfig: 0m6,819s 0m3,725s
The syncing procedure can be run separately for each module using
<ModuleName>_sync_headers targets. The 'sync_headers' target can be
used to sync all the modules at once.
Task-number: QTBUG-87480
Task-number: QTBUG-103196
Change-Id: I8c938bcaf88a8713b39bbfd66d9e7ef12b2c3523
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Unifies our approach to calling CoInitializeEx and CoUninitialize,
removing a lot of boilerplate in the process, and also fixes a few
bugs where we would incorrectly balance our calls to CoInitializeEx
and CoUninitialize.
The optimistic approach of qfilesystemengine_win.cpp of calling
CoCreateInstance without initializing the COM library explicitly
has been removed, as calling CoInitializeEx should be a noop in
the situation where it's already been loaded.
Change-Id: I9e2ec101678c2ebb9946504b5e8034e58f1bb56a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Inline the data members into the only remaining user (qdir.cpp) and
remove the class.
As a drive-by, fix the non-idiomatic use of QT_BUILD_CORE_LIB to mean
!QT_BOOTSTRAPPED and apply the guard consistently to the declaration,
too.
Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-105747
Change-Id: If2c780dd96e2a2e331cabdc42fd920874e7737b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
For now qassert.h is included in the middle of qglobal.h, since some of
the code below needs it, but this will be cleaned up when that code is
moved in its own header.
Task-number: QTBUG-99313
Change-Id: I2cdfed44f5c8772c1dad4797cf8edc6cb4c964b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
qcontainerfwd.h was relying on the forward declaration of QByteArray in
qglobal.h, so add the missing forward declaration there.
Additionally, had to move the implementations of qTzSet() and qMkTime()
to qenvironmentvariables.cpp along with environmentMutex.
Task-number: QTBUG-99313
Change-Id: I233aff305c2fedaf0a48362cc99ff2d6f6c0ee54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This partially reverts commit c25a5b4e1fc9e74f1f3ab1001db4fbae267d7831.
We need qtemporaryfile.cpp in the bootstrap library, because qfile.cpp
uses QTemporaryFileName - even if QTemporaryFile has been disabled.
Re-adding qtemporaryfile.cpp does not increase the bootstrap library's
size significantly, because since c25a5b4e1f we have
#define QT_NO_TEMPORARYFILE
in qconfig-bootstrapped.h, and that disables compilation of
QTemporaryFile but leaves QTemporaryFileName intact.
Pick-to: 6.4
Fixes: QTBUG-103805
Change-Id: I6947ca303edb36fc359bd5d07c1cbd88098905fb
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
... in new qlocaltime* files, now that it's decoupled enough from the
internals of QDateTime for this to be possible. Part of the
consolidation of time_t code in one place.
Move assorted constants from qdatetime.cpp to a private namespace in
qdatetimeprivate_p.h to be shared between q*time.cpp hereafter (fixing
an out of date comment in the process - julianDayFromDate() is long
gone).
Task-number: QTBUG-95993
Change-Id: I03d97e959118041f9d86b8bb2e738599bc0b17e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This removes the hack that creates a copy of bootstraplib sources to
avoid rebuilding the world if a bootstraplib source file changed.
Said hack led to confusing behavior:
- when accidentally editing bootstraplib copies instead of the real
sources
- when header files were changed in a way that were incompatible to the
bootstraplib source copy
This reverts commit 80a8ead08d1fea926850d1da61f693dfe26ed5b0.
This reverts commit 743bb66744e762d10754426e43d42b24cc7bff0f.
The official way to avoid the QTBUG-92269 problem is now to set
QT_HOST_PATH=<host-Qt-installation> and QT_FORCE_FIND_TOOLS=ON.
If you want to build the tools as well, set QT_FORCE_BUILD_TOOLS=ON.
Fixes: QTBUG-92269
Change-Id: I226bf5792f9ca8e7e207dc53e01c2903018d82d3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When QT_USE_BOOTSTRAP_SOURCE_COPY is ON, there are situations where
includes like
"../../3rdparty/sha1/sha1.cpp"
in qcryptographichash.cpp cannot be resolved. For example,
out-of-source MSVC builds are affected.
In-source builds are working by accident, because we're adding the
include path "<qtbase-build-dir>/src/corelib/global", and
<qtbase-build-dir> is <qtbase-source-dir>.
Linux/macOS builds are working by accident, because we're adding the
include path "<qtbase-source-dir>/src/3rdparty/forkfd".
Fix this by explicitly adding the directory where qcryptographichash.cpp
resides to INCLUDE_DIRECTORIES.
This amends commit 743bb66744e762d10754426e43d42b24cc7bff0f.
Fixes: QTBUG-102720
Change-Id: I55fcc186ea4c81134c39023ced3f04458230109b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Whenever a source file is touched that belongs to the bootstrap library,
all bootstrap tools are rebuilt. This includes moc. The moc binary
however, is a dependency whose invalidation results in a rebuilt of
quite some parts of Qt.
There's no easy way to turn off this dependency. To mitigate the
rebuilds, the bootstrap lib now can use a copy of the corelib sources.
That means the bootstrap lib is not rebuilt if its sources are changed.
This is basically the situation we had in Qt5.
The sources are not updated on reconfiguration. There's a new target
'update_bootstrap_sources' that can be built to update the copied source
tree of the bootstrap lib.
This new behavior can be controlled with the variable
QT_USE_BOOTSTRAP_SOURCE_COPY. It's on by default for developer builds.
Fixes: QTBUG-92269
Change-Id: I50234df66590c39594d208424394c7a600dc5606
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Those classes are not used by any bootstrapped tool.
Also remove the QT_BOOTSTRAPPED code paths.
Change-Id: Ic5a9b153a578fedcba37cd81a62ccf0182a2d34f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Those classes are not used by any bootstrapped tool.
Change-Id: I82fc32e16d044b91ab3a79109ab98a3010df2e2d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's not used by any bootstrapped tool.
Change-Id: Id6751e80bb34642aeaea1c2bb4f24b480280623d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This class is used by androidtestrunner, which is not bootstrapped.
Change-Id: Ie75b4dd039f773a8ccb58f243bf9f74a5121c3f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>