aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmldiskcache
Commit message (Collapse)AuthorAgeFilesLines
* Fix tst_qmldiskcache::cacheResources() and cacheModuleScripts() on WindowsFriedemann Kleint2018-09-201-22/+30
| | | | | | | | | Rewrite the tests to not try to delete the cache, but operate on sets of newly created files. Task-number: QTBUG-70609 Change-Id: I63135794e2c52048da12977e5c40c0bcce5a24b1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for disk caching of ES modulesSimon Hausmann2018-08-174-1/+55
| | | | | | | | | | | | | | | | | | Two minor fixes needed for this otherwise straight-forward change: (1) When compiling modules, use the full url for the source file of the compilation unit, as that's what we use for the relocation check when loading the cache file. (2) Record the proper source time stamp for cache invalidation. As a bonus, when importing scripts from .qml files, we now also attempt to use the cached version that we created on the fly in an effort to replace heap memory with mmap backed memory - just like we do for .qml files. Change-Id: I5b03a18e3c44d537c3242cb1d969636df32fe42a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Reduce memory consumption when loading AOT generated cache filesSimon Hausmann2018-08-011-11/+16
| | | | | | | | | | | | | | | | | Separate the qml data (objects/imports) from the general compilation unit data. It's only the former that needs to be re-generated as part of the type re-compilation and by separating it we can allocate memory just for that and keep using the mmap'ed general unit data for everything else (including byte code). Another upside of this change is that it allows eliminating the recently introduced concept of a backing unit again. Saves ~149K RAM with the QQC1 gallery. Task-number: QTBUG-69588 Change-Id: Ie88a4286feb7e2f472f58a28fa5dd6ff0a91c4b6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Encapsulate access to CompiledData::Object and CompiledData::ImportSimon Hausmann2018-07-311-7/+7
| | | | | | | | This will make it easier to move the data out of CompiledData::Unit and into a separate data structure. Change-Id: I32e6233a66f2279b44cc06ef7c3505db4a565f98 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up compilation unit string resolutionSimon Hausmann2018-07-311-7/+7
| | | | | | | | | Replace use of CompiledData::Unit::stringAt with CompilationUnit::stringAt as central place, in preparation for allowing derived compilation units to retrieve strings from base units. Change-Id: Ifafe6c18a9fd8d1e2259a60c17200124869b4c2d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up constant storage for CompiledData::BindingSimon Hausmann2018-07-311-1/+1
| | | | | | | | | | Store doubles in bindings in the constant table of the compilation unit instead of each binding. This removes one of the two 8 byte members of the value union and also allows for sharing of constants throughout a .qml file. Change-Id: I1d7daafdb7f24e34c14cd160d2dcb2c5aaac1c50 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix import of precompiled .js filesSimon Hausmann2018-07-311-0/+4
| | | | | | | | | | | Loading those must not fail the file relocation test, so set the source file names to empty, as we also do for .qml files. Also added tests for all the scenarios: no embedded file paths for AOT files but absolute paths for run-time created cache files. Change-Id: I3fc92e89cfd0da512afeac22bd0da3e915ec46ea Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-301-1/+7
|\ | | | | | | | | | | | | | | Conflicts: examples/quick/tableview/pixelator/main.cpp examples/quick/demos/ Change-Id: Id7eaae6584017a4ab4ec9dd97b56d5c1a417f0e3
| * tst_qmldiskcache: speed up testThiago Macieira2018-07-221-1/+7
| | | | | | | | | | | | | | | | On some systems, we *do* have sub-second file time resolution, so we don't have to wait one second. Change-Id: Id2be776c7ae0467c9d9ffffd1543325ce53f10fd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Try to load QML cache from CacheLocation if side-by-side failsThiago Macieira2018-07-271-0/+42
| | | | | | | | | | | | | | | | | | This could happen if the .qmlc file is stale or corrupt for some reason. In that case, we should try to load a cache file from the user's CacheLocation. Change-Id: Id2be776c7ae0467c9d9ffffd1543204272a531d1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Always generate QML cache files in the cache directory, never in sourcesRichard Weickelt2018-06-211-6/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | This patch eliminates the annoying behavior of the QML compiler that .qmlc cache files are stored alongside the sources. When cache files are generated at run-time, then they are always stored in the application's local cache directory defined by QStandardPaths::CacheLocation (qmlcache subfolder). The application's uninstaller is responsible for cleaning up the cache directory during removal. If explicitly precompiled QML files exist at the source location, then they are loaded from there and no cache file is being generated. Storing cache files in the source directory is as problematic as an in-tree build. The cache files pollute the source directory and create unnecessary inconvenience with version control systems. [ChangeLog][QtQml][QQmlEngine] QML cache files are now always stored in the application's cache directory when being generated at run-time. If precompiled QML files exist at the source location, then they are loaded and no cache file is being generated. The application's uninstaller is responsible for cleaning up the cache during removal. Task-number: QTBUG-56150 Change-Id: I5a64b7f958e782e03c71873a82cef4b07011cbf1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Minor data structure cleanupSimon Hausmann2018-01-221-24/+0
| | | | | | | | The cache files are architecture and ABI independent, so we can remove any associated field/code as well as the workaround for Android. Change-Id: Ia52a5be886fc22a2105460e003e7a76af7dc1818 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/dev' into HEADLars Knoll2017-10-221-0/+61
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4isel_moth_p.h src/qml/compiler/qv4ssa.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm_p.h src/qml/jit/qv4regalloc.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexp.cpp src/qml/jsruntime/qv4regexp_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp tests/auto/qml/qml.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
| * Fix qml cache invalidation when changing dependent C++ registered QML singletonsSimon Hausmann2017-09-121-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a qml file uses a qml singleton, we need to reliably detect when the singleton changes and re-generate the cache of the qml file using it. This is a scenario covered and fixed by commit 5b94de09cc738837d1539e28b3c0dccd17c18d29, with the exception that currently QML singletons registered via qmlRegisterSingleton were not added to the list of dependent singletons for a qml file. We can fix this by extending findCompositeSingletons() to also cover the singletons that do not originate from a qmldir file. [ChangeLog][Qt][Qml] Fixed bug where sometimes changes to a qml singleton would not propagate to the users or cause crashes. Task-number: QTBUG-62243 Change-Id: I16c3d9ba65fd82e898a29b946c341907751135a9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix function offset check in compiled data cached on diskErik Verbruggen2017-09-081-4/+6
| | | | | | | | | | | | | | | | The code for a function are now stored inline to the function, so the previous offsets were bogus. Change-Id: Ia8f28e56116bd9bcce1c5619e45af866f1bbf5e4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/new-backendLars Knoll2017-08-221-3/+3
|\| | | | | | | Change-Id: Iff06429f948ac6cdec77a9e5bb8c5375c56fe705
| * Use QQmlType by valueLars Knoll2017-08-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | QQmlType is now refcounted, and we need to use it by value, to control it's lifetime properly. This is required, so we can clean up the QQmlMetaTypeData cache on engine destruction and with trimComponentCache() Task-number: QTBUG-61536 Change-Id: If86391c86ea20a646ded7c9925d8f743f628fb91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Change QVERIFY(.. == ..) to QCOMPAREErik Verbruggen2017-07-051-2/+2
| | | | | | | | | | Change-Id: If6e5b29d17b35d62ffb3fe9f7d47ceb1fcbbfad2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix QML disk cachingErik Verbruggen2017-07-051-7/+9
| | | | | | | | | | | | | | | | | | | | Add correct generator name (always moth for the interpreter). Also fix the test: where we generated a dummy function 0, we now don't do that anymore, so correct the function index, and the check for the code offset. Change-Id: I4c07b2b53483c513dfaf8993e1d0111bcc825179 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Split up qv4codegen into several filesLars Knoll2017-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | And changed the namespace of those classes to QV4::Compiler. ScanFunctions should over time also move into its own file. Change-Id: If084acea4a9a20b9c79ad47dac19e02dc720e098 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove now unused filesLars Knoll2017-06-301-2/+0
| | | | | | | | | | | | | | | | | | Remove all files from the old compiler pipeline that are now unused. This includes the whole IR, JIT code generation, and the old Moth Isel. Change-Id: I50d06abfbcf0e9755a54ed94638f8bb74f9512b1 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Various compile fixesLars Knoll2017-06-221-4/+4
|/ | | | | | | | Make sure all libs and tests compile again after the latest changes. Change-Id: I749d3d2d0109cc97df2ecec93809ea8a1b3014a9 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9Simon Hausmann2017-03-251-0/+53
|\
| * Fix caching of QML singleton typesSimon Hausmann2017-03-131-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a QML file depends on a QML singleton, we failed to include it in the dependency hash. Thus changes to the QML singleton did not result in a re-creation of the caches of files that use it. The list of singletons comes from random-ordered hashes in the qml import handling. We provide an order to the direct dependencies by sorting by the singleton type names. Task-number: QTBUG-58486 Change-Id: Ie7e9d006f9bf3a60af1f819ee439c29bc234bd8a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Avoid an extra stat() on the source .qml file when loading cacheSimon Hausmann2017-03-221-1/+1
|/ | | | | | | | | For timestamp comparison it is not necessary to create another QFileInfo() object and call exists() and lastModified(), when we can pass that information through from the type loader. Change-Id: I225cd36e672f1f390bddb4e6ebfafa3fc1269795 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix QML cache not being invalidated when source path changesSimon Hausmann2017-01-021-5/+53
| | | | | | | | | | | | When somebody renames the directory name underneath a QML file and its cache file, then we need to re-generate the cache as it contains the fully path of the source path. That is sometimes used to resolve relative URLs (such as images) and therefore needs updating (by re-creating the cache). Task-number: QTBUG-57644 Change-Id: I9766668859aad8e9d71f278c3f26c0585258c14e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix handling of qrc:/// urls with disk cachingSimon Hausmann2016-11-231-1/+20
| | | | | | | | | | | | Use the right function for converting a qrc:/// url to a local path. QUrl::toLocalFile() gives us an empty path, which prevents us from getting a time stamp and comparing it against the stamp in the cache file. This fixes disk caching with samegame. Change-Id: Id3eb270f1f7a7f25143d2f075a45f32bdb0384c5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix qrc testSimon Hausmann2016-11-231-1/+5
| | | | | | | | | Make this test pass when we have the time stamp available in the qrc data (since commit d20773824529d191e7b483b505107dce6c1b1c3d in qtbase) or when not (when the engine falls back to the program executable). Change-Id: Idb9a6951d76515a2482d573b40da99871bc442cd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix excessive invalidation of QML disk cachesSimon Hausmann2016-10-181-0/+100
| | | | | | | | | | | | | | | | | | | | | We use an MD5 checksum over the meta-object data to verify that the types a QML file depends on haven't changed since the cache was generated. However when the dependent types are QML types, then the meta-object data contains dynamically generated type names such as QMLTYPE_1234, which is non-deterministic. To address this, we resort to the checksum over the meta-object data only for C++ types (if those change it's likely an incompatible change) and for QML types use the fact that all the information about the QML declared types comes from the QML file only, which means we can in that case simply use a checksum over the QV4::CompiledData memory chunk. In addition we need to ensure that the generated CompiledData memory chunk is deterministic by avoiding any uninitialized bytes (memset) and using a map instead of a hash for the mapping of object index to object id. Task-number: QTBUG-55926 Change-Id: I27c840b1960ad36b486198e504b70989c22a3972 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Fix written time stamp in QML cache files for QRC sourcesSimon Hausmann2016-10-141-1/+10
| | | | | | | | | | For loading and verification we compare against the time stamp of the executable, so we should do the same thing when generating the cache data. Task-number: QTBUG-55926 Change-Id: If5922e76b8ae86185f6eacb6aeeb5c3afbc1f8d5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Enable disk cache for files coming from resourcesSimon Hausmann2016-08-123-0/+34
| | | | | | | | By storing the cached data in QStandardPaths::CacheDir + "/qmlcache/" + sha1(filename) Change-Id: I6a8b4ca701019204fff362504697c3dac9f54bf1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix restoring of local aliases from disk cacheSimon Hausmann2016-08-061-0/+44
| | | | | | | | Local aliases are always "resolved". We must be careful not to access the same field in the union otherwise and mistake it as property index. Change-Id: I6369cdba145a62dcdaa10d8f4ee84bfa3cbfa0e3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Enable QML/JS disk cache by defaultSimon Hausmann2016-08-051-1/+1
| | | | | | | Except on Windows, where there is still one bug to fix. Change-Id: I1a22f42859733eedd37596a3e8fc09680720ff10 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Fix interaction of files selectors with disk cachingSimon Hausmann2016-08-041-0/+52
| | | | | | | | Make sure to save the .qmlc/.jsc files to the location determined by the file selectors. Change-Id: If535bb1e4f0d20ac692b3d8e6d563f77cd00446b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Safeguard disk cache loading with checksum verificationSimon Hausmann2016-08-041-5/+117
| | | | | | | | | | | | | | | When loading a QML component from the disk cache, compare the checksum of the dependent types against the checksum when the cache was created. Any change in the meta-object of a dependent type should trigger a re-creation discard of the cache and consequent re-creation (in the test-case). Unfortunately this also requires extending the existing hack in the unit test to deal with the low second precision on HFS+ in order to pass the tests. Change-Id: Ib8e899347680f7be676788388e9c23a09b0277e3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Improve robustness of qml disk cachingSimon Hausmann2016-07-231-7/+114
| | | | | | | | Perform various basic checks before proceeding to load an existing cache file, including the qt version, architecture, data structure version and others. Change-Id: Ie822b056e944ac120643aad260e97f62616688bf Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add support for saving/loading the moth interpreter byte codeSimon Hausmann2016-07-211-10/+0
| | | | | | | | With the JIT and moth supporting persistence, we can enable the disk cache tests unconditionally. Change-Id: I6d6652411237001433a32a2de21d1f78f51b43ef Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve robustness of qml cache expiry checkingSimon Hausmann2016-07-191-0/+5
| | | | | | | | | | | Instead of relying on two time stamps in the file system (source file and cache file), make the determination on whether the source file is newer than the cache solely depend on the time stamp of only the source file. This means that when cache files are stored in archives for example their modification date does not need to be preserved upon extraction. Change-Id: I0b4362663868c6fb9bd7e106028161b2d67274d4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up implicit component registrationSimon Hausmann2016-07-151-0/+42
| | | | | | | | | | | | | When assigning an object to a property that is a QQmlComponent, we implicitly "wrap" a Component {} around the object declaration. In the QML IR this is only half-heartedly represented. In order to correctly determine dependencies later when saving and to support QML files that use implicit components but don't import QtQml or QtQuick explicitly, we must also extend the file imports accordingly. This is now done (and tested) by emulating a "import QtQml 2.0 as QmlInternals" and then using "QmlInternals.Component". Change-Id: I26f4f53a35675b52d4bd39f23359b0ac8f9678c5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix endian support in compiled data structuresSimon Hausmann2016-07-141-10/+10
| | | | | | | | | | | | The goal is to make the compiled data structures persistent on disk. In order to make it possible to create these data structures on a "host" system that may have a different endianness than the target system, we now make all the word sized fields little-endian. The template wrappers from QJson provide zero-overhead access for little-endian machines (the vast majority) while maintaining a large degree of source compatibility. Change-Id: I3d30da1fcf3bffb98dbe9337d3a35482fb7b57c8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Added basic support for saving compilation units to diskSimon Hausmann2016-06-172-0/+189
Hidden behind a QML_DISK_CACHE=1 environment variable we will now attempt to save a binary representation of the type compilation for Foo.qml next to it called Foo.qmlc. Change-Id: I27e800b50cdb186669256fd277578ea1f1e70513 Reviewed-by: Lars Knoll <lars.knoll@qt.io>