aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assemblercommon_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Move engine-specific data out of base compilation unitUlf Hermann2024-01-081-2/+2
| | | | | | | | | | 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>
* 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>
* 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>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | 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>
* 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>
* CMake: Disable JIT for arm64 when doing macOS universal buildsAlexandru Croitor2021-04-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* JSRuntime: Provide an optional symbol tableUlf Hermann2019-10-161-3/+3
| | | | | | | | | | 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-171-1/+1
|\ | | | | | | | | | | | | | | | | 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-121-1/+1
| |\ | | | | | | | | | Change-Id: I6472cd72b27c69257efe54376e428274ebf68050
| | * Fix various accumulator-saving problemsUlf Hermann2019-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | 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-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Transform V4_ENABLE_JIT into a featureUlf Hermann2019-04-251-3/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-151-1/+0
|\| | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlpropertycache.cpp Change-Id: Ie7727499700b85cc0959ef3abb30d55dc728b659
| * V4: Fix JS tail call crashes on win32/linux32Erik Verbruggen2019-02-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | For platforms where arguments are passed on the stack, we would do an invalid (off-by-one) calcultion to see where we should put arguments for a tail call, thereby overwriting other values. As we don't write to these memory locations anywhere, and the arguments are exactly the same as calls to jitted code (which is done by design), we could just as well re-use them. Change-Id: If4118b2023da6dc301252a1579a36df0e0cbc3a5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | V4: Generate labels for backward jumpsErik Verbruggen2019-01-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When analyzing the bytecode from top-to-bottom in a single pass, we don't know when a jump back to previously seen code occurs. For example, in the baseline JIT we would already have generated code for some bytecode when we see a jump back (like at the end of a loop body), and we can't go back and insert a label to jump to. As JavaScript has no goto's, the only backward jumps are at the end of loops, so there are very few cases where we need to actually generate labels. This was previously handled by analyzing the bytecode twice: once to collect all jump targets, and then second pass over the bytecode to do the actual JITting (which would use the jump targets to insert labels). We can now do that with one single pass. So the trade-off is to store 4 bytes more per function plus 4 bytes for each loop, instead of having to analyze all functions only to find where all jumps are each time that function is JITted. Change-Id: I3abfcb69f65851a397dbd4a9762ea5e9e57495f6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | V4: Collect trace information in the interpreterErik Verbruggen2019-01-251-1/+2
|/ | | | | | | | | | | | | | | Collect type information about values used in a function. These include all parameters, and the results of many bytecode instructions. For array loads/stores, it also tracks if the access is in-bounds of a SimpleArrayData. Collection is only enabled when the qml-tracing feature is turned on while configuring. In subsequent patches this is used to generated optimized JITted code. Change-Id: I63985c334c3fdc55fca7fb4addfe3e535989aac5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Fix stack alignment in JITted codeErik Verbruggen2019-01-101-2/+2
| | | | | | | | | | | Helper calls done for to-integer and to-number conversions did not align the stack on 16byte boundaries, which could lead to crashes if somewhere in that call a vector instruction is used that expects such alignment. Task-number: QTBUG-71325 Change-Id: Ieec05a93a1f69b538e6c8930b8eb64cbe85c35d4 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make sure not to clobber tail call arguments when unrolling stackErik Verbruggen2018-11-011-3/+6
| | | | | | | | | | | | | When the accumulator doesn't overlap the return value registers, we move the accumulator value there when doing a function exit. This happens for arm32 and arm64. This is a problem when doing a tail call: these registers are also used to store the first two arguments for the call, so restorating will wipe them. Task-number: QTBUG-71212 Change-Id: Ifd82729e8741418c1b54e804724893e02bd180c7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* ES7: Implement Tail Position Calls in the runtimeErik Verbruggen2018-10-051-11/+50
| | | | | Change-Id: If1629109722496b3fd10b36b2376548440f2fee9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4: Add JIT kind to disassemblyErik Verbruggen2018-08-301-1/+1
| | | | | Change-Id: I6dd1cd6f795a93a186e84f5ab1c606f7e23fb85d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* V4: Split PlatformAssemblerCommon (and base classes) in its own fileErik Verbruggen2018-08-271-0/+697
This makes it easier to re-use them later on, without inheriting all extra stuff that the baseline JIT needs. Change-Id: I9368b16017b8b9d99f8c005a5b47ec9f9ed09fb0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>