aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata_p.h
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * Clean up type dependency hashing for QML cachingSimon Hausmann2017-03-131-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of passing the engine parameter all the way through the data structure generator, along with the dependent type data structure that is unused otherwise, let's simply provide a function object for the dependency hashing. This is also in preparation for adding singleton types to the dependency hash. Task-number: QTBUG-58486 Change-Id: I5bb5e5c06b7b5c77195cec3da13141333cfea7a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-8/+10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
| * | | 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>
| * | | Protect CompilationUnit member usage against word size differencesSimon Hausmann2017-03-171-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we only use the runtimeStrings offset in JIT generated code, so move that into a standard layout base class and use that instead. Task-number: QTBUG-58666 Change-Id: Id933ba5df3a6990e89886c2b328e9e814ec5e413 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | Prepare run-time method calling mechanism for cross-compilationSimon Hausmann2017-03-171-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way of encoding the offsetof() of the method_ members in QV4::Runtime is not portable when cross-compiling from a 64-bit host (where the offsetof would be calculated on) to a 32-bit target (where the offset would be different), or vice versa. In preparation for making this work, this patch first replaces the direct use of the run-time members with use through a void * and an enum for indexing. This gives us some type-safety in some places and will also allow for a translation of the pointer offset from host pointer indexing to target pointer indexes. As a bonus we can avoid going through the engine->runtime indirection in the interpreter altogether and call the static methods right away. Task-number: QTBUG-58666 Change-Id: I3cd6459523923a9719408317fa729bca19c2bf3c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-141-5/+3
|\| | | | | | | | | | | Change-Id: I0ec164ce6e8099e6e4d6b40a3c7340737473ef4b
| * | Fix crash when loading cache files generated ahead of timeSimon Hausmann2017-03-071-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The offset of the runtimeStrings array differed between a V4_BOOTSTRAP build and the regular library build. This is an intermediate fix until QTBUG-58666 is fixed properly. Change-Id: Id1310ffa82f1079c1acef7730db41186fa62610f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | Fix qmlcachegen command line parametersSimon Hausmann2017-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | Add support for specifying the output file name Change-Id: I3ec3cecae2334a7640baa928c0739c5521496d2d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Make the decision about whether to use a Simple callcontext earlierLars Knoll2017-03-091-1/+2
|/ / | | | | | | | | | | | | | | | | All required information is already available when creating the CompiledData::Function, so determine at that point whether we use a Simple or full CallContext. Change-Id: Ife489ca2ca6eaf2ffc7843544a56e8bd86590e9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Re-do QML type compilation of ahead-of-time generated QML cache filesSimon Hausmann2017-01-311-2/+3
| | | | | | | | | | | | | | | | | | | | As we currently lack the ability to do type resolution at AOT cache generation time, we need to re-do the work after loading the cache file, making us essentially only re-use the code and avoiding the step of parsing. Change-Id: I12844692d4766345d8a313b59d21abf1f868e2d1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add fixes for INTEGRITYKimmo Ollila2017-01-311-25/+29
| | | | | | | | | | | | | | Full definitions of types are needed in static_casts. Change-Id: I028ffc40a76cdb16cb297a181b3d9dfe9d09c945 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QtQml: Fix developer build with MinGW-W64 / gcc 5.3.0Friedemann Kleint2017-01-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assign QJsonPrivate::qle_bitfield<>.val directly to initialize it instead of using the assignment operator in classes aggregating it, fixing errors: qtbase/src/corelib/json/qjson_p.h: In member function 'uint QV4::Compiler::JSUnitGenerator::registerIndexedGetterLookup()': qtbase/src/corelib/json/qjson_p.h:187:35: error: 'l.QJsonPrivate::qle_bitfield<0, 4>::val' is used uninitialized in this function [-Werror=uninitialized] uint i = qFromLittleEndian(val); ^ compiler\qv4compiler.cpp:110:26: note: 'l' was declared here CompiledData::Lookup l; Disable -Wuninitialized in QV4::Moth::InstructionSelection::callBuiltinConvertThisToObject() and callBuiltinPopScope(), fixing errors: In member function 'virtual void QV4::Moth::InstructionSelection::callBuiltinPopScope()': compiler\qv4isel_moth.cpp:1188:38: error: '*((void*)& call +4)' is used uninitialized in this function [-Werror=uninitialized] Instruction::CallBuiltinPopScope call; ^ compiler\qv4isel_moth.cpp: In member function 'virtual void QV4::Moth::InstructionSelection::callBuiltinConvertThisToObject()': compiler\qv4isel_moth.cpp:1338:49: error: '*((void*)& call +4)' is used uninitialized in this function [-Werror=uninitialized] Instruction::CallBuiltinConvertThisToObject call; Task-number: QTBUG-58476 Change-Id: I3448cd8b75e9588ffb1bcc1526a56450731f1744 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Include the JIT assembler in qmldevtoolsSimon Hausmann2017-01-281-1/+5
| | | | | | | | | | | | Change-Id: I69b74e01dcffe82caafb7aa8495b3036afc2b933 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Include the interpreter codegen and QML cache saving code in qmldevtoolsSimon Hausmann2017-01-281-3/+11
| | | | | | | | | | Change-Id: Ic3f1476b87bfa7ab0c280c928e9ac97f92698336 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | qml: Rename importCache vars to typeNameCacheRobin Burchell2017-01-251-1/+1
|/ | | | | | | | | | | | | | | This better reflects what it is, and especially removes some confusion in QQmlTypeCompiler which has a m_importCache member (of type QQmlImports), which lead to some strange-to-read things like this: m_importCache.populateCache(*importCache); Which is now: m_importCache.populateCache(*typeNameCache); Change-Id: I7590dd1ba71ca77a8d964250a0d517156b723f8e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Bump QML cache file versionSimon Hausmann2016-12-091-1/+1
| | | | | | | | After the recent data structure changes this seems appropriate to force a cache rebuild for those following the branch in release builds. Change-Id: Ie4c0534729a752137068b8f24beb9d15e7895c46 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.8.0' into 5.8Lars Knoll2016-12-071-2/+6
|\ | | | | | | Change-Id: I19804e880005c66880eeabfaebf0b1093de80e6b
| * Fix compilation error with ICC 17: it doesn't like auto and commaThiago Macieira2016-12-041-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | The error is a warning upgraded via -Werror and the message doesn't even make sense to me: error #3373: nonstandard use of "auto" to both deduce the type from an initializer and to announce a trailing return type Intel-Issue-ID: 6000164202 Change-Id: I73fa1e59a4844c43a109fffd148caf09a1952e92 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | V4: Simplify strict-mode setting on call context objectsErik Verbruggen2016-12-061-3/+3
|/ | | | | | | Previously this required an extra shift to move the bit to the lsb. Change-Id: I04674c3bad34d60af13728fe9a7dd120a188c26f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change Import::type from quint8 to LEUInt32James McDonnell2016-10-251-2/+2
| | | | | | | | | | | | | | Import::type used to be a quint32. The switch from quint32 to quint8 changed the alignment of other structures in the compiled blob. On QNX, the alignment isn't appropriate for some of the instructions that the compiler uses to access/modify the structures and a BUS error occurs. Changing Import::type to LEUInt32 puts the alignment back the way it was before. Simpler than trying to figure out how to get everything aligned correctly with a quint8 at the front of the structure. Task-number: QTBUG-56341 Change-Id: Ia6f4daff5f615f9c5dbcc34ce8c3c9a89bab2b69 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix excessive invalidation of QML disk cachesSimon Hausmann2016-10-181-2/+6
| | | | | | | | | | | | | | | | | | | | | 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>
* QML: Align CompiledData::Function fields betterErik Verbruggen2016-10-111-6/+8
| | | | | | | | Align all fields on an 8-byte boundary to make sure there are no bus errors or penalties for unaligned access. Change-Id: Ia455860bb0403178882b80e1036f067666386e77 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Bump cache file format versionSimon Hausmann2016-08-301-1/+1
| | | | | | | ... after the recent changes to codegen and runtime API. Change-Id: Id6f1ebf7b0c4dfab050c7262209dbe26116b2e7b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make the unit mapping on Windows configurable with regards to executable mappingSimon Hausmann2016-08-171-2/+3
| | | | | | | | | | If we generate byte code, then we can mmap without the executable flags, otherwise we need them. This should make things work out of the box on platforms where special rights are needed before executable mappings are allowed. Change-Id: I24e663f85d661bc51cd3bf2463547b1d1590ea32 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Separate header verification and mmap handling of CompiledData::UnitSimon Hausmann2016-08-091-1/+2
| | | | | | | | ...into a separate class. This will make it easier to specialize the handling for Posix and Windows platforms. Change-Id: I995538fa8239eac8586c96812086e50b4c19257f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crashes with attached property accessSimon Hausmann2016-08-081-1/+1
| | | | | | | | | | | | We currently embed the attached object ids in the generated code, which is not stable because they come from a hash and the meta-objects of the attached types are also not part of the check-sum verification. So for now disable accelerated access in order to proceed with qtquickcontrols2 integrations. This needs to be re-enabled later with proper checking and stable lookups. Change-Id: I54a3f0c905ee26fb80f4e2687a2901a11a921b38 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use on-disk compilation unit if availableSimon Hausmann2016-08-041-2/+4
| | | | | | | | | | | If we succeeded in saving the compilation unit to disk, then attempt to use it right away. This replaces the C++ heap usage for the compilation unit data as well as the anonymous allocated executable memory with file-backed mmap'ed memory. That means the memory can be discarded when overall availability is low and paged in on-demand. Change-Id: Ide1b1e11752d861eb049a99a26ca12cec5e2502e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix interaction of files selectors with disk cachingSimon Hausmann2016-08-041-1/+1
| | | | | | | | 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-0/+3
| | | | | | | | | | | | | | | 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>
* Fix endianness in constant handlingSimon Hausmann2016-08-031-2/+5
| | | | | | | | When running on a big-endian system, we need to convert the constant values into big-endian once and then it's possible to access them directly. Change-Id: I655bad7b7734e3b95e79e5f688f0b4041d0c41c4 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add a checksum to the generated QML compilation unitsSimon Hausmann2016-08-021-1/+9
| | | | | Change-Id: Icd5b1d805059981cbbb4c0eb2a5c842d59223839 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Cleanup: Move ResolvedTypeReference(Map) one scope upSimon Hausmann2016-08-011-27/+29
| | | | | | | | The class is a candidate for further functionality, it doesn't have to be nested in CompilationUnit. Change-Id: I100553160f5ae34f66b9f8ff5df9f636da2ffb67 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Improve robustness of qml disk cachingSimon Hausmann2016-07-231-3/+12
| | | | | | | | 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>
* Improve robustness of qml cache expiry checkingSimon Hausmann2016-07-191-0/+2
| | | | | | | | | | | 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>
* Added basic loading of compilation units from diskSimon Hausmann2016-07-191-0/+3
| | | | | | | | This remains hidden behind the QML_DISK_CACHE flag until all backends support it and the verification code is in place. Change-Id: Ic77c64e20a2dc4c43473c47640e09f8070237e85 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix compilationSimon Hausmann2016-07-191-0/+2
| | | | | | | | | Commit be491913c036b148cd4f90fa0132e269a507dbad regressed the build with some compilers that complained that the RegExp fields were uninitialized. Fix is the same as for the Lookup class. Change-Id: Ie6b2adf14496d75845f6a9d9b8fc680e61aa1155 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Split out creation of alias properties in the property cachesSimon Hausmann2016-07-151-0/+2
| | | | | | | | | | | | Similar to the regular property cache creation code, this also has to become a template function so that it can be run on the compilation units loaded from disk in the future. What is shared between the code path of a fresh compilation vs. re-use of a unit from disk is the code to propagate the CompiledData::Alias entries into entries in the property cache. The code for iterating through the component spaces and resolving the alias references is not shared. Change-Id: I04c2a5575310400156b457ae7b709cffecb7455e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix alias resolution algorithmSimon Hausmann2016-07-151-1/+3
| | | | | | | | | | | The resolution of aliases needs to to be solved in iterations as an alias can refer to another alias, which may not be created yet in the property cache by the time we try to perform the resolution. Therefore the alias resolution code works off a list of pending aliases after the initial pass of resolution. This also requires the ability to detect circular references. Change-Id: Id4e159b9c713aa8a8a095759e22e3fac456a38a0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Android: Fix crashBogDan Vatra2016-07-151-1/+3
| | | | | | | Make sure all the sturcture fileds are aligned Change-Id: I6f6dad67262e50026f7e86320bcd818a478ebc35 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify CompiledData::Unit serializationSimon Hausmann2016-07-151-13/+0
| | | | | | | | | | | | | | | There are currently two places where we calculate the total size of a CompiledData::Unit including all of its data, once in its calculateSize() function and then when constructing the Unit itself. This is error prone when trying to do changes to the layout, as two places need to be adjusted. Instead we can centralize the populating of the entire CompiledData::Unit header, the calculation of the various offsets as well as the entire size in one shot in a new generateHeader function. Afterwards we can allocate the final amount of memory and copy the remaining bytes across and assemble the final data structure. Change-Id: Ic26d7812e59d2bee2f45cd72742e3195a56950df Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove unused fields in CompiledData::FunctionSimon Hausmann2016-07-141-1/+0
| | | | | | | | The table for referencing the inner functions is not needed. This also allows making the function offsets table a local variable. Change-Id: I3f1a1d6ab8c4f417edeafdc174e5b41d2d2b611b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix endian support in compiled data structuresSimon Hausmann2016-07-141-134/+179
| | | | | | | | | | | | 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>
* Minor cleanup in location handlingSimon Hausmann2016-07-131-3/+3
| | | | | | | | | | | | | | Store the line and column in CompiledData::Location as unsigned values. The qmlSourceCoordinate() function(s) already now act as normalizers, mapping values <= 0 to 0 as indicator for a missing/invalid line/column. Valid values start at 1 and therefore there is no need to store negative values in the location structure. Coincidentally this also fixes a bunch of warnings about conversions from signed to unsigned. Change-Id: Ic69ff395d4991989aede695f2e8c58903f1bd2bf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move type compilation independent bits out of QQmlTypeCompilerSimon Hausmann2016-06-201-1/+1
| | | | | | | | | | The type validation is something that works on the final compilation unit, so it can be done separately. The same applies to the composite type registration and object/binding calculation. Both steps will be shared with compilation units loaded from disk. Change-Id: I43636d7ac76077c76289d7c1c9eba5e9c6b8239a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Added basic support for saving compilation units to diskSimon Hausmann2016-06-171-0/+11
| | | | | | | | | 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>
* Move object/binding counter code to CompilationUnitSimon Hausmann2016-06-171-0/+2
| | | | | | | | | | The code to update the counters operates entirely on data structures from CompilationUnit, so it makes sense to move it into that class. Plus - you guessed it - this will also be called when not using the type compiler in the future. Change-Id: I644b0914980b799be1020ed74d2791b127bbcf9f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Moved import cache and type resolution cache codeSimon Hausmann2016-06-171-1/+2
| | | | | | | | | | The code reads mostly from QQmlTypeData internal data structures, so it's cleaner to move it there - we can remove the getters for these internal fields. And it also allows for re-use later when not using the type compiler. Change-Id: I36cfaf3f1cecd6c8b223ee08516884a07bc60d6c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Added iterator interfaces to QV4::CompiledData::*Simon Hausmann2016-06-171-0/+67
| | | | | | | | These interfaces are required in order to be able to use the QQmlPropertyCacheCreator template. Change-Id: I371e7102aac00fd607fc6a8ad7ffc18996608758 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up property cache array handlingSimon Hausmann2016-06-161-6/+1
| | | | | | | | | | | | | The QQmlPropertyCacheVector in the CompilationUnit encapsulates the property caches for the objects declared in the QML tree as well as the bits indicating whether a VME meta-object is needed. The ref-counting for the caches in that vector was done "manually" and thus error prone. This patch replaces the vector with a wrapper container that has explicit move semantics and takes care of the addref() and release() calls upon insertion, replacement and destruction. Change-Id: If805fe016f1a1c70e56f8a90909ab87b653ea026 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanup: generalize type reference collection codeSimon Hausmann2016-06-141-0/+31
| | | | | | | | | | For loading compilation units from disk we'll have to scan the unit for type references, in order to correctly load dependencies. In preparation for that this patch template'izes the loops so that they can work on the Qml IR as well as on the CompiledData::Object structures. Change-Id: I32e4e3277e16c5a2d1bf6baf24456c9837c189ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>