diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-03-12 23:25:30 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-03-23 06:53:10 +0100 |
commit | a5e1a7d70b5eb23af4a5f819dc08b6c15aa723f1 (patch) | |
tree | 40ec05f88f96fd085c0add8eb702304dcce8fa61 /src/plugins | |
parent | 4333dded89ce2e49f9ef3ef50ff474ec04e284dd (diff) |
Optimize stack frame setup for AOT compiled functions
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>
Diffstat (limited to 'src/plugins')
4 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index d3134e0727..d6be7eb5db 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -61,7 +61,7 @@ QV4::CppStackFrame *QV4DataCollector::findFrame(int frame) QV4::CppStackFrame *f = engine()->currentStackFrame; while (f && frame) { --frame; - f = f->parent; + f = f->parentFrame(); } return f; } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index f47b9e09ac..bdba780147 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -230,7 +230,7 @@ void QV4Debugger::leavingFunction(const QV4::ReturnedValue &retVal) QMutexLocker locker(&m_lock); if (m_stepping != NotStepping && m_currentFrame == m_engine->currentStackFrame) { - m_currentFrame = m_currentFrame->parent; + m_currentFrame = m_currentFrame->parentFrame(); m_stepping = StepOver; m_returnedValue.set(m_engine, retVal); } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index c4faeea7c9..e0c24979a9 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -70,7 +70,7 @@ void JavaScriptJob::run() QV4::CppStackFrame *frame = engine->currentStackFrame; for (int i = 0; frame && i < frameNr; ++i) - frame = frame->parent; + frame = frame->parentFrame(); if (frameNr > 0 && frame) ctx = static_cast<QV4::ExecutionContext *>(&frame->jsFrame->context); diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index 473546aba5..85b6bac203 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -360,7 +360,7 @@ void NativeDebugger::handleBacktrace(QJsonObject *response, const QJsonObject &a frameArray.push_back(frame); - f = f->parent; + f = f->parentFrame(); } response->insert(QStringLiteral("frames"), frameArray); @@ -639,7 +639,7 @@ void NativeDebugger::leavingFunction(const QV4::ReturnedValue &retVal) return; if (m_stepping != NotStepping && m_currentFrame == m_engine->currentStackFrame) { - m_currentFrame = m_currentFrame->parent; + m_currentFrame = m_currentFrame->parentFrame(); m_stepping = StepOver; m_returnedValue.set(m_engine, retVal); } |