aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4stacklimits.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Set default stack size safety margin for VxWorksKarim Pinter2025-10-211-27/+4
| | | | | | | | | | | | | The default safety margin for VxWorks is 1/8 of the stack size, which is read from the OS. Also adds environment variable QV4_STACK_SOFT_LIMIT, to overwrite V4 stack safety margin. These can be used to finetune the application with limited resources, also on other OSes. Task-number: QTBUG-115777 Change-Id: I82b5b02e75fae3f5d1971504d16a3dc0f1d5f3fd Pick-to: 6.8 6.9 6.10 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qv4stacklimits.cpp: Add missing includeFabian Kosmale2025-04-151-0/+1
| | | | | | | | | | We need to include fcntl on QNX, as we use O_RDONLY. Pick-to: 6.9 6.8 Fixes: QTBUG-135980 Change-Id: Ic1b6da04b72e3b02b3509f883a45172dc7a79f54 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Use base stack pointer directly returned from VxWorksKrzysztof Sommerfeld2024-01-091-7/+0
| | | | | | | | | Remove the `decrementIterator` function usage to calculate the base stack pointer, because it calculates invalid base stack pointer for VxWorks - VxWorks provides valid base stack pointer which doesn't need additional calculation. Task-number: QTBUG-115777 Change-Id: Ib9d133bb0a3e10c0f0a11f8831ea540741c935c7 Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QtQml: Re-add pthread_attr_init() to stackPropertiesGeneric()Ulf Hermann2023-09-291-0/+1
| | | | | | | | | | | | | | Before calling pthread_attr_get_np(), as opposed to pthread_getattr_np(), we do need to call pthread_attr_init(). Both the FreeBSD and the NetBSD manpages tell us to do so. Amends commit 9f4aeeabb982cfc4306c9d350dbb68f64914fb32. Pick-to: 6.6 6.5 Fixes: QTBUG-117513 Change-Id: Ic851ba2ffcf13d268b3a53d926cb92f7bed7a3d9 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add implementation for stack properties on VxWorksTomasz Kozlowski2023-09-221-0/+18
| | | | | | | | | | | | VxWorks does not have full support for POSIX threads and lacks pthread_attr_get_np function. Fix this by using taskInfoGet function, because tasks and threads are interchangeable on VxWorks. Task-number: QTBUG-115777 Change-Id: Ic284b1985b79e134860fb4dcdff861754bcc2ae4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Warnings: Suppress MinGW warning about out of bounds array accessOlivier De Cannière2023-08-231-0/+7
| | | | | | Fixes: QTBUG-116179 Change-Id: Ib32877fde13084a35c894aa2f00f2500b9ba7937 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML: remove pthread_attr_init() from stackPropertiesGeneric()Thiago Macieira2023-08-211-1/+0
| | | | | | | | | | | | | | | | | The docs for pthread_getattr_np() say: "The pthread_getattr_np() function initializes the thread attributes object referred to by attr" The comment in the glibc pthreads.h implementation even says: /* Initialize thread attribute *ATTR with attributes corresponding to the already running thread TH. It shall be called on uninitialized ATTR and destroyed with pthread_attr_destroy when no longer needed. */ Pick-to: 6.5 6.6 Change-Id: I964c2b1e6b834feb9710fffd177c32dbb898fa3c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* wasm: implement stackProperties()Morten Sørvig2023-01-161-0/+12
| | | | | | | | | | | | | | | Implement stackProperties() for Q_OS_WASM using the API provided by emscripten/stack.h, which is in practice more reliable than pthread_attr_getstack(). This API returns the logical stack region, which can be forwarded directly to createStackProperties(). Task-number: QTBUG-109942 Pick-to: 6.5 Change-Id: I123667ca76d51aeb89feac62feab73b72681f1a8 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Drop the stackBase != (void*)0 constraint in qv4stacklimitsMikolaj Boc2023-01-091-3/+0
| | | | | | | | | | | The assumption is incorrect on e.g. WASM where a 0 stack base address may appear. Moreover, there is no mention of 0 not being a viable address in pthread_attr_getstack's man page. Task-number: QTBUG-109942 Change-Id: I37a8dc28735881a9c3d4a0bef1fc3a6de707e0aa Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML: Add an accurate stack bounds checkerUlf Hermann2022-12-091-0/+355
This re-introduces a stack bounds checker. The previous stack bounds checker was removed in commit 74f75a3a120b07bbfe6904512b338db8850874e4 because the cost of determining the stack base was deemed too high. Indeed, determining the stack base on linux using the pthread functions costs about 200.000 instructions and the cost grows with the number of concurrently running threads. However, by reading /proc/self/maps directly we can trim this to about 125k instructions. Furthermore, with the new implementation we only need to do this once per engine. Calling JavaScript functions of the same engine from different threads is not supported. So we don't have to consider the case of checking the bounds of a different thread than the one the engine was created in. Furthermore, we get a more accurate number now, which means we don't have to re-check when we get near the boundary. Also, change QV4::markChildQObjectsRecursively() to use an actual QQueue instead of being recursive. This avoids the stack from overflowing when the stack is already almost full, and was leading to crashes in the stackOverflow tests. Make the stack smaller for the the tst_qquickloader::stackOverflow{,2} tests to run faster in the CI (and avoid the timeout). Task-number: QTBUG-106875 Fixes: QTBUG-108182 Change-Id: Ia5d13caa7d072526ff2a3e1713ec7781afc154a9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>