diff options
| author | Karim Pinter <karim.pinter@qt.io> | 2025-07-08 14:40:48 +0300 |
|---|---|---|
| committer | Karim Pinter <karim.pinter@qt.io> | 2025-10-21 11:13:15 +0300 |
| commit | 3192915698fa5f383f37055df854a39161852506 (patch) | |
| tree | 7cd3103a258c2adaa0cf9be9f901930a6767346d /src/qml/jsruntime/qv4engine.cpp | |
| parent | b483fc5aaaf208ec8a55580f48a68be76d9dfd8f (diff) | |
Set default stack size safety margin for VxWorks
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>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index fa03df55d4..9bb103225a 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -119,6 +119,7 @@ int ExecutionEngine::s_maxCallDepth = -1; int ExecutionEngine::s_jitCallCountThreshold = 3; int ExecutionEngine::s_maxJSStackSize = 4 * 1024 * 1024; int ExecutionEngine::s_maxGCStackSize = 2 * 1024 * 1024; +int ExecutionEngine::s_stackSizeSoftLimit = -1; ReturnedValue throwTypeError(const FunctionObject *b, const QV4::Value *, const QV4::Value *, int) { @@ -309,6 +310,12 @@ void ExecutionEngine::initializeStaticMembers() if (ok && envMaxGCStackSize > 0) s_maxGCStackSize = envMaxGCStackSize; + const int envStackSizeSoftLimit = qEnvironmentVariableIntValue("QV4_STACK_SOFT_LIMIT", &ok); + if (ok && envStackSizeSoftLimit > -1) + s_stackSizeSoftLimit = envStackSizeSoftLimit; + else + s_stackSizeSoftLimit = -1; + if (qEnvironmentVariableIsSet("QV4_CRASH_ON_STACKOVERFLOW")) { s_maxCallDepth = std::numeric_limits<qint32>::max(); } else { @@ -362,13 +369,10 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) } } - if (s_maxCallDepth < 0) { - const StackProperties stack = stackProperties(); - cppStackBase = stack.base; - cppStackLimit = stack.softLimit; - } else { + if (s_maxCallDepth < 0) + setCppStackProperties(); + else callDepth = 0; - } // We allocate guard pages around our stacks. const size_t guardPages = 2 * WTF::pageSize(); |
