diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-04 11:29:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-05 16:30:29 +0200 |
commit | 5a699e1416efe6a304d52df61b1a9247b7c4b3ed (patch) | |
tree | ef186631f85e19cd990b4b70451b7b8eb925b22b /src/qml/compiler | |
parent | 5cab256d3df331ee0795a3f5f9bb70eb48f12795 (diff) |
Reduce the size of signal parameters in qml cache data
We can reduce the distinction between a built-in type or a custom type
down to a single bit.
Change-Id: Ibe15d35357aa8c3948809f981221df29a40c400b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 10 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 7dc21152a4..1f3e0cdaca 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -833,8 +833,9 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node) if (memberType.at(0).isUpper()) { // Must be a QML object type. // Lazily determine type during compilation. - param->type = QV4::CompiledData::Property::Custom; - param->customTypeNameIndex = registerString(memberType); + param->indexIsBuiltinType = false; + param->typeNameIndexOrBuiltinType = registerString(memberType); + Q_ASSERT(quint32(jsGenerator->getStringId(memberType)) < (1u << 31)); } else { QString errStr = QCoreApplication::translate("QQmlParser","Invalid signal parameter type: "); errStr.append(memberType); @@ -843,8 +844,9 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node) } } else { // the parameter is a known basic type - param->type = type->type; - param->customTypeNameIndex = emptyStringIndex; + param->indexIsBuiltinType = true; + param->typeNameIndexOrBuiltinType = type->type; + Q_ASSERT(quint32(type->type) < (1u << 31)); } param->nameIndex = registerString(p->name.toString()); diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 8f427e0a7f..1656fd84aa 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -605,10 +605,13 @@ static_assert(sizeof(Enum) == 12, "Enum structure needs to have the expected siz struct Parameter { quint32_le nameIndex; - quint32_le type; - quint32_le customTypeNameIndex; + union { + quint32 _dummy; + quint32_le_bitfield<0, 1> indexIsBuiltinType; + quint32_le_bitfield<1, 31> typeNameIndexOrBuiltinType; + }; }; -static_assert(sizeof(Parameter) == 12, "Parameter structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); +static_assert(sizeof(Parameter) == 8, "Parameter structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct Signal { |