From 5a699e1416efe6a304d52df61b1a9247b7c4b3ed Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 4 Jul 2019 11:29:56 +0200 Subject: 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 --- src/qml/compiler/qqmlirbuilder.cpp | 10 ++++++---- src/qml/compiler/qv4compileddata_p.h | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/qml/compiler') 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 { -- cgit v1.2.3