aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Move engine-specific data out of base compilation unitUlf Hermann2024-01-082-3/+3
| | | | | | | | | | We want to re-use the base compilation unit for different engines. To do that, we cannot have data in there that belongs to a specific engine. Pick-to: 6.7 Task-number: QTBUG-120189 Change-Id: I8e43e7ec6c1cd33249dc4ed15fec16babc6d06fb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Enable compilation of PlatformAssembler_X86_64_SysV on VxWorksŁukasz Matysiak2023-10-131-1/+1
| | | | | | | | | | | x86_64 VxWorks doesn't match any of the ifdefs conditions that guard PlatformAssembler_X86_64_SysV. Because of that, jit fails to compile. Solve the problem by adding VXWORKS as one of the supported systems. Task-number: QTBUG-115777 Change-Id: Ifb035dc54b9d15e585dd7a7f7480e051016be4ca Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Eliminate "done" from iteratorsUlf Hermann2023-09-082-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of dragging another stack value around to mark if the iterator was done, rather pass it an offset it should jump to if so. It can then jump over any IteratorClose instruction while the ExceptionHandler can still point to the IteratorClose instruction. For this to work, we also have to refrain from checking for exceptions as part of IteratorNext or IteratorClose. If IteratorNext generates an exception, it also jumps to the "done" label, after which we dispatch the exception. We don't want to jump to the exception handler for other instructions in between as that would close the iterator. The iterator should _not_ be closed if it has just thrown an exception, though. The same holds for IteratorClose: If it throws an exception, we don't want to jump back to the beginning of the loop's exception handler, since that would produce an infinite loop. We also don't want to reset the exception handler before IteratorClose because it needs to also be reset if the iterator does not need to be closed. This saves quite a few instructions and stack variables on actual iteration. For destructuring, we have to change the execution flow a bit. We need to first perform the iteration for non-rest parameters, saving the results in separate stack slots. This way we can apply our new "jump if done" behavior if the iterator runs out or produces an exception itself. We then save the "done" state in a separate stack slot, as before. During the assignment of the iteration results to the actual variables, we install an exception handler, so that we can still close the iterator if one of the initializers throws an exception. This produces a few more instructions than before: 1. We need to set and read the "needsClose" variable explicitly rather than having IteratorNext and IteratorDone do it implicitly. 2. We need an additional CheckException after the iteration. 3. We need an additional conditional Jump over the IteratorDone. Everything considered, the savings we get for regular iteration and the more consistent semantics of the instructions involved are well worth the few extra instructions on destructuring, especially since everything those extra instructions do was done implicitly by the iterator instructions before. For consistency, the IteratorNextForYieldStar instruction is refactored to work the same way as IteratorNext: In case of either an exception or "done" it jumps to an offset, and we refrain from individually exception-checking each IteratorNextForYieldStart instruction. Task-number: QTBUG-116725 Change-Id: I9e2ad4319495aecabafdbbd3dd0cbf3c6191f942 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* JIT: STORE_IP() before lookupsUlf Hermann2023-06-231-0/+2
| | | | | | | | | | Lookups can throw exceptions and we want those reported with correct line numbers. Pick-to: 6.6 Fixes: QTBUG-114483 Change-Id: Ie922df8a4207bd8b3746f0f3a256f6fcac0b43d6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* JIT: Fix buffer writing in vprintf()Ulf Hermann2023-06-141-4/+14
| | | | | | | | | | | qvsnprintf() can return -1, as well as QIODevice::write(). We must not pass a negative number to memset(), and we need to loop the writes in case the actually written bytes were less than what we asked for. Coverity-Id: 408783 Change-Id: Id697ae38c0342afa81590a570358d5fcc3aa8656 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move ScopedStackFrame into qv4stackframe_p.hUlf Hermann2023-05-171-2/+5
| | | | | | | | | | | This is where it belongs. We need to apply some tricks to avoid cyclic includes, but that's better than what we have so far. Also, sort and clean up the includes in the affected files. Change-Id: Ia7a957d06c0ca284045d831417740c3f9920bc92 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* JIT: Add missing {STORE|LOAD}_ACC() to CreateCallContextUlf Hermann2023-03-151-0/+4
| | | | | | | | | | | | | We cannot assume anything about the accumulator register after calling PushCallContext::call(). Also add a note about not needing to re-load the accumulator on ThrowException. Pick-to: 6.5 6.2 5.15 Fixes: QTBUG-111935 Change-Id: I7196585e1d2697c215f4fe87d8d7ac9b98b622a3 Reviewed-by: <carl@carlschwan.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* JIT: Fix isNullOrUndefined bad logicOlivier De Cannière2023-02-151-2/+1
| | | | | | | | | | | | | | | | | | | A logic error was left over in isNullOrUndefined that didn't actually check for null of undefined after a change of encoding. tst_qqmllanguage::isNullOrUndefined() was added to check the bug doesn't happen anymore. Two cases are tested. The first is intended to run on the interpreter. It was fine before this change and should be fine afterwards. The second one calls the same function many times for JIT optimizations to kick in and compile the function. This should ensure the broken '??' and '?.' operators are fixed when running on the JIT. Amends c7722d4ed61d6a887e9f6c403ffa10b2048de2a4. Fixes: QTBUG-111088 Pick-to: 6.5 Change-Id: I0e6d77363770e801aa586588e242220dec9d5e0a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Change value encoding scheme to make space for larger pointersUlf Hermann2023-01-121-12/+23
| | | | | | | | | | | | | | | | | | On android and on some other platforms, the upper bits of a pointer are significant. We need to store them in our JS value encoding. Shift the bits around to make this happen. We now can store pointers of up to 57 bits. That's enough for everything we've seen so far. Fixes: QTBUG-101686 Fixes: QTBUG-91150 Pick-to: 6.5 Change-Id: I72e0fe63b27fca94840f82963e4d3936b3581b28 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Allow building the JIT on solarisUlf Hermann2023-01-111-1/+1
| | | | | | | | | It's not really supported but we can add this one clause if it helps. Pick-to: 6.5 Fixes: QTBUG-100010 Change-Id: Ibdc54b9da0ca9b4e92851dd9bbe2abf1a9b693c7 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Replace CallElement with separate instructionsUlf Hermann2022-11-072-13/+0
| | | | | | | | | | We need to do the subscript lookup before generating the arguments since the arguments may change the array. Fixes: QTBUG-106708 Change-Id: Ia3a0dd34c6ed8d39e86ad20911a632d691826322 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid both virtual and override on destructorsJohannes Kauffmann2022-08-281-1/+1
| | | | | | | | | | | Destructors don't need to be declared virtual when the destructor from the parent class is already declared virtual. Additionally, this removes the last usage of Q_DECL_OVERRIDE. Pick-to: 6.4 Change-Id: I7d43f5d5fbb1423319adde04d4994ada9daab6b1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-116-228/+12
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QtQml: Do not depend on transitive includesFabian Kosmale2022-03-041-0/+1
| | | | | Change-Id: I287a6e63397c2c6140c3bc3e7d83f3212709531e Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Fix logging categories in QtQml and friendsUlf Hermann2021-11-261-1/+1
| | | | | | | | Make sure they all start with "qt.qml" and move them into the Qt namespace. Remove dead ones. Change-Id: I3d7a3c08b797c29df6737b2c4a5cacb26cd82956 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid undefined behavior in the JITUlf Hermann2021-06-171-5/+5
| | | | | | | | | | | We need to add an entry to all the RegisterID enums, so that we can mark a RegisterID as invalid. Pick-to: 6.2 Task-number: QTBUG-94068 Change-Id: I5c13b271eade50fd63327612514ba7ebe33a5c39 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Evaluate type assertions in QMLUlf Hermann2021-05-262-0/+11
| | | | | | | | | | | | | | | | | | Type assertions actually check whether the expression matches the type, and return null if it doesn't. [ChangeLog][QtQml] You can use TypeScript-like type assertions using "as" now. In contrast to TypeScript, QML's type assertions are enforced at runtime. If the type doesn't match, null is returned for object types. Also, type assertions can only cast to object types. There is no way to create a value type or primitive type reference. As value types and primitives cannot be polymorphic, this doesn't matter, though. There are other ways of converting those. Task-number: QTBUG-93662 Change-Id: I00fce3d4ea7a8c6b4631c580eaf6c113ac485813 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Implement optional chainingMaximilian Goldstein2021-04-134-0/+34
| | | | | | | | | | | | | | | | | This change implements optional chaining (https://github.com/tc39/proposal-optional-chaining) by adding a new type of optional lookup with an offset to the end of a chain. If `undefined` or `null` is encountered during an access marked as optional, we jump to that end offset. Features: - Full support for all kinds of optional chain - With some codegen overhead but zero overhead during normal non-optional FieldMemberExpression resolution - Properly retains this contexts and does not need to resolve anything twice (this has been an issue previously) - No extra AST structures, just flags for existing ones [ChangeLog][QtQml] Added support for optional chaining (https://github.com/tc39/proposal-optional-chaining) Fixes: QTBUG-77926 Change-Id: I9a41cdc4ca272066c79c72b9b22206498a546843 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Disable JIT for arm64 when doing macOS universal buildsAlexandru Croitor2021-04-036-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our current approach to building universal macOS Qt is to pass 2 -arch flags to clang, which underneath spawn 2 clang invocations with each separate arch and lipo-s the result together. This approah also meanss that we do only one set of config tests for the main (first) architecture. Currently Qml doesn't support JITing for macOS on Apple Silicon (arm64), but if the first architecture is x86_64, the qml_jit feature will be set to 'true', and cause compilation errors when trying to build the arm slice of the jit source files. To circumvent that, and allow skipping compilation of JIT specific code, we have to apply the same trick we do in qtbase, which is to set a compile definition that takes the current architecture into account, and surround all relevant code with an #if block taking to account both the feature and current architecture. Use a custom hacky qt_extra_definition call to redefine the value of QT_FEATURE_qml_jit based on the original feature value and the current architecture. Additionally, surround the jit source files with #if QT_CONFIG(qml_jit). Amends 561a2cec9b95b22783a00b48078b532010357066 Task-number: QTBUG-85447 Change-Id: I28b286d218333076223177c456175f180888a667 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Optimize stack frame setup for AOT compiled functionsUlf Hermann2021-03-233-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When called via the metaobject system, parameters and return values are passed as void*, with accompanying type information in the form of QMetaType. The same format is expected when calling an AOT compiled function. Previously, we would first convert all the parameters to QV4::Value, just to convert them back the moment we notice that there is an AOT compiled function. This is wasteful. This change provides a second call infrastructure that accepts void* and QMetaType as parameter and return value format, and passes them as-is all the way to any AOT compiled functions. If there is no AOT compiled function, the conversion is done when detecting this, rather than when initiating the call. This also passes the information "ignore return value" all the way down to the actual function call. If the caller is not interested in the return value, we don't have to marshal it back at all. For now, we only add the extra "callWithMetaTypes" vtable entry to ArrowFunction. However, other callables could also receive variants optimized for calling with void*/int rather than V4 values. This required changing the way how function arguments are stored in the property cache. We squeeze the return type into QQmlPropertyCacheMethodArguments now, and we use QMetaType instead of integers. In turn, we remove some unused bits. Change-Id: I946e603e623d9d985c54d3a15f6f4b7c7b7d8c60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Store instruction pointer before CmpInUlf Hermann2021-01-271-0/+1
| | | | | | | | The "in" operator may throw an exception. Change-Id: I7d0b6e2212ac6ec237fbf14719349f8e23810028 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-12/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* masm: Add error handling for failed mprotect()Ulf Hermann2021-01-121-1/+2
| | | | | | | | | | | | If we cannot mprotect() we have to abort the JIT compilation. Delete RepatchBuffer.h as it is unfixable in that regard. Luckily we don't use it. Task-number: QTBUG-89659 Pick-to: 5.15 Change-Id: Ic5ddbdf51b471db4ddeaa75aab48b24c1f7ced56 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Adapt to changes in qtbaseUlf Hermann2020-09-151-1/+2
| | | | | | | | | Due to qiterable.h specializing a template declared in qmetatype.h we temporarily need to include it in a few tests so that the iterables work. Change-Id: Ia32392419dead76eaf2b91b2ec4157b726d8de74 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-3/+3
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add missing overrideAlexander Volkov2020-05-151-2/+2
| | | | | Change-Id: I439bcd0219b53ab0fa9450523ee0efcc75db68e7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix failing assertion in the GC with JITSimon Hausmann2020-04-271-0/+2
| | | | | | | | | | | | | | | | | | | | | Commit d4edf441257b7e5782a6c25802d821647ffcba45 fixed the issue for architectures where the return value register overlaps with the accumulator register and thus clobbers it (x86-64, x86). The issue however persisted on ARMv7 (and in theory also ARMv8). Further investigation suggests that another source of clobbering of the accumulator register may be the caller of the JIT generated code itself, since we never explicitly initialize the register. So if one of the first byte code instructions is the creation of a call context or ConvertThisToObject - anything that saves the register to the JS stack frame - then we could end up with the GC trying to mark a value that contains garbage (or looks like a managed, typically). Change-Id: I719e189c3314c85adb23fb2ab2a0acf26a418d4e Task-number: QTBUG-83384 Pick-to: 5.15 Pick-to: 5.12 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix failing assertion in the GC with the JITSimon Hausmann2020-04-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit db3dd029d7cd911712102efd5ea71868494f9f6f introduced the saving of the accumulator register on the JS stack in more situations. This unveiled another bug: When the physical ACC register contains garbage, we may end up saving it on the stack and thus making it visible to the GC. That one may trip with the infamous Q_ASSERT(m->inUse()) assertion failing when the value looks like a managed pointer but in fact isn't. So the question is: How can garbage end up in the physical ACC register? Thanks to a detailed bug report from David Faure, KDE's ktexteditor kateindenttest (testCstyle:comma6 in particular) triggered this situation when run with aggressive GC, where the prologue of a generated constructor function started with two instructions CreateCallContext ConvertThisToObject The first instruction is a call into the run-time with CallResultDestination::Ignore - it's a "void" call. The second instruction starts with STORE_ACC and also ends up allocating memory, triggering the GC when run with aggressive mode enabled. The problem here is the ::Ignore option for the return value. It means that the ReturnValueRegister is clobbered and may contain anything. If the ReturnValueRegister is the same as the AccumulatorRegister, then the STORE_ACC call later will end up writing "garbage" into the JS stack. As a remedy, this patch treats the ::Ignore case special and loads undefined into the ACC when the return value register and the ACC register are the same. Change-Id: I82c7a3456125f9c87e83abb9eb54465106873560 Task-number: QTBUG-83384 Pick-to: 5.15 Pick-to: 5.12 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* make LinkBufferBase::finalizeCodeWithDisassembly() less genericRolf Eike Beer2019-12-121-1/+1
| | | | | | | | | It is actually called from only one place, so adapt it to what that caller really needs, removing more excessive newlines. Change-Id: Ieb1a24ddb911d86af1f862e35e4fdd7ad2d9ff13 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* JSRuntime: Provide an optional symbol tableUlf Hermann2019-10-164-54/+46
| | | | | | | | | | The method names are only used for debugging purposes. We don't need to pass them through production code. Centralize the names of all the runtime methods in a symbol table and only look them up when actually printing them. Change-Id: I0d9d7db04b961841242acdbaaa7a2ba29b1f4ff2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-174-3/+23
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4baselinejit.cpp src/qml/jsruntime/qv4vme_moth.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: Iec7cd27ddad0281bd3b7833fb6b252f66a6ae5d6
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-09-124-3/+23
| |\ | | | | | | | | | Change-Id: I6472cd72b27c69257efe54376e428274ebf68050
| | * Fix various accumulator-saving problemsUlf Hermann2019-09-034-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to keep the accumulator alive across function calls. This requires: 1, Saving the accumulator on the stack if the function might allocate, to protect it from the garbage collector. However, we don't need to do that if the result of the function is to be saved in the accumulator and the function itself doesn't use the accumulator as argument. In this case the previous value becomes unaccessible and we might as well GC it. 2, In the JIT, restoring the accumulator from the stack after the function call if we want to ignore the return value. 3, Therefore, also saving the accumulator on the stack before calling in case of 2. We assume that we don't need to keep the accumulator alive across the jump to the exception handler. Saving the accumulator more often than necessary is detrimental for performance. To make sure the assumption holds, explicitly load the accumulator with undefined _before_ jumping to any exception handler. Change-Id: I78cbc42847b8885a0659b23f3b81655b7f1a0bc4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-141-1/+0
|\| | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/qml/qjsengine/tst_qjsengine.cpp Change-Id: I34df194046a91ee8a076ce28022eb99d68e7f362
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-131-1/+0
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4memberdata.cpp Change-Id: I4e9ffc89d65279a42516f5547e93fb47fb571834
| | * JIT: Don't store accumulator on getTemplateLiteralUlf Hermann2019-06-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't use the accumulator in that method. It could contain any random value. Fixes: QTBUG-75642 Change-Id: I41f958c1174cce76d0d77e14d5617d441aaf1e11 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split QV4::Value into a static and a dynamic partUlf Hermann2019-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The static part can be used for compilation and won't resolve managed objects. This allows us to remove all the remaining V4_BOOTSTRAP. Change-Id: Id2f6feb64c48beb2a407697881aea8c0d791a532 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove the bootstrap code from assembler and JITUlf Hermann2019-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | We don't build the assembler or the JIT in bootstrap mode. Change-Id: Idc3a56cc1e9cfba415bef9cba221c8a60ee75010 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Make JavaScript execution interruptibleUlf Hermann2019-04-303-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an atomic isInterrupted flag to BaseEngine and check that in addition to the hasException flag on checkException(). Add some more exception checks to cover all possible infinite loops. Also, remove the writeBarrierActive member from QV4::EngineBase. It isn't used. Fixes: QTBUG-49080 Change-Id: I86b3114e3e61aff3e5eb9b020749a908ed801c2b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove tracing JIT infrastructureUlf Hermann2019-04-2928-9297/+58
| | | | | | | | | | | | | | | | | | | | | | | | The tracing JIT won't be finished. Therefore, remove the parts that have already been integrated. Change-Id: If72036be904bd7fc17ba9bcba0a317f8ed6cb30d Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
* | | Transform V4_ENABLE_JIT into a featureUlf Hermann2019-04-256-18/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way you can enable or disable the JIT when configuring Qt. The conditions for the availability of the JIT have also been cleaned up. There is no reason anymore to artificially restrict availability on x86 and x86_64. The reason for the existence of those clauses are old problems on windows that have been fixed by now. However, on arm and arm64, we need a specialization of the cacheFlush() function for each OS to be supported. Therefore, restrict to the systems for which such a specialization exists. iOS and tvOS are technically supported and you can enable the JIT via the feature flag now. Due to Apple's policy we disable it by default, though. Change-Id: I5fe2a2bf6799b2d11b7ae7c7a85962bcbf44f919 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | JIT: Avoid QString::sprintf()Ulf Hermann2019-04-172-3/+3
| | | | | | | | | | | | | | | | | | | | | It's deprecated Change-Id: Id901056e3a4ca378fb03486cd941e7e7222ffbc4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4 tracing: Add a scheduler for the tracing JIT IRErik Verbruggen2019-03-2814-21/+3559
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a scheduler for the graph nodes, which first reconstructs the control-flow graph, and then places all remaining nodes inside the basic blocks. The output of this pass is an MIFunction (MI = Machine Interface), which uses a representation suitable for feeding to an assembler. Note however that it still uses "virtual registers" at this point, so the next pass will have to place those virtual registers in physical registers or on a stack. The code for the dominator tree calculation, block scheduling, loop info and the blockset were lifted from the 5.10 JIT. Change-Id: I11c4cc3f64fedba6dd4275b35bbea85d30d76f7d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | V4: Add a lowering pass to the traced JITErik Verbruggen2019-03-224-1/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pass converts high-level operations like e.g. a JSAdd to lower level operations, like a runtime call. This pass will be extended to take trace information, which can indicate that it can be lowered to e.g. an AddInt32. Change-Id: Ieae8df235217189c90048515e199f7e7c7f220b3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into HEADUlf Hermann2019-03-227-223/+48
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4jithelpers.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtimeapi_p.h src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/qqmltypemodule_p.h Change-Id: If28793e9e08418457a11fc2c5832f03cab2fcc76
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-215-126/+42
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| | * Remove dead compile time QML context/scope property and id object codeSimon Hausmann2019-03-202-116/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After enabling lookups in QML files, we can remove all the code that tries to deal with (type) compile time detection of access to id objects and properties of the scope/context object. This also allows removing quite a bit of run-time code paths and even byte code instructions. Task-number: QTBUG-69898 Change-Id: I7b26d7983393594a3ef56466d3e633f1822b76f4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Implement dummy QML lookups for "global" variablesSimon Hausmann2019-03-204-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When resolving names in the context of QML bindings, we now direct runtime access to QQmlContextWrapper::resolveQmlPropertyLookupGetter. At the moment this does basically the same as Runtime::method_loadName, which we called earlier. However this now provides the opportunity to optimize lookups in the QML context in a central place. When performing a call on a scope or context object property, we also did not use a CallName() instruction - which would have gotten the thisObject wrong - but instead we use a dedicated CallScopeObjectProperty and CallContextObjectProperty instruction. These rely on identifying these properties at compile time, which goes away with lookups (and also doesn't work when using ahead-of-time compilation). Therefore the qml context property lookup is using a getPropertyAndBase style signature and Runtime::method_callQmlContextPropertyLookup uses that. For the tests to pass, some error expectations need adjusting. In particular the compile-time detection of write attempts to id objects is now delayed to the run-time. The old code path is still there and will be removed separately in the next commit (as it is massive). Task-number: QTBUG-69898 Change-Id: Iad1ff93d3758c4db984a7c2d003beee21ed2275c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Baseline JIT: Save accumulator in toInt32LhsAcc()Ulf Hermann2019-03-191-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | toInt32LhsAcc convertes both the lhs and the accumulator to int32. If the accumulator is not saved, a GC run during the conversion of the lhs might trash its value. Fixes: QTBUG-74058 Change-Id: Ic42693061c7d483bb430d77bcc095de6ff9a6843 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4: Add trace slot for UPlusErik Verbruggen2019-03-224-4/+4
| | | | | | | | | | | | | | | Change-Id: I0bb5055024e30c32b82e1555c820ea5ced8923f5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>