aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/common
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-04-09 10:47:32 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-22 06:35:26 +0200
commit505863e7004c60fa2fc9aafc41516e2ee8a8efaa (patch)
tree8a4200b35c8add4c2b5873a71982c7487025bbee /src/qml/common
parent5728f48834b9225a36d3e1dae44ced7579cde358 (diff)
Add a hook that allows for ahead-of-time compiled functions
Use the unused field in the CachedUnit structure provided by qmlcachegen to allow for providing function pointers for functions and bindings that are compiled ahead of time. Provided is the pointer into an array that is terminated with a {index: 0, functionPtr: nullptr} entry. The array index field in each array entry allows for gaps. Change-Id: I7457f5eea5f14e5f94431b9cc6da042cb03517a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/common')
-rw-r--r--src/qml/common/qv4compileddata_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h
index 232ac9c3c3..152c70f107 100644
--- a/src/qml/common/qv4compileddata_p.h
+++ b/src/qml/common/qv4compileddata_p.h
@@ -85,6 +85,10 @@ class QQmlTypeNameCache;
class QQmlType;
class QQmlEngine;
+namespace QQmlPrivate {
+struct AOTCompiledFunction;
+}
+
namespace QmlIR {
struct Document;
}
@@ -1202,6 +1206,7 @@ struct CompilationUnit : public CompilationUnitBase
const Unit *data = nullptr;
const QmlUnit *qmlData = nullptr;
QStringList dynamicStrings;
+ const QQmlPrivate::AOTCompiledFunction *aotCompiledFunctions = nullptr;
public:
using CompiledObject = CompiledData::Object;
@@ -1211,6 +1216,13 @@ public:
setUnitData(unitData, nullptr, fileName, finalUrlString);
}
+ explicit CompilationUnit(const Unit *unitData, const QQmlPrivate::AOTCompiledFunction *aotCompiledFunctions,
+ const QString &fileName = QString(), const QString &finalUrlString = QString())
+ : CompilationUnit(unitData, fileName, finalUrlString)
+ {
+ this->aotCompiledFunctions = aotCompiledFunctions;
+ }
+
~CompilationUnit()
{
if (data) {
@@ -1244,6 +1256,7 @@ public:
qmlData = other.qmlData;
other.qmlData = nullptr;
dynamicStrings = std::move(other.dynamicStrings);
+ aotCompiledFunctions = other.aotCompiledFunctions;
other.dynamicStrings.clear();
m_fileName = std::move(other.m_fileName);
other.m_fileName.clear();