aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp10
-rw-r--r--src/qml/compiler/qv4compileddata_p.h9
-rw-r--r--src/qml/qml/qqmlpropertycachecreator_p.h7
3 files changed, 15 insertions, 11 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
{
diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h
index e2dbea94e7..3871703ebb 100644
--- a/src/qml/qml/qqmlpropertycachecreator_p.h
+++ b/src/qml/qml/qqmlpropertycachecreator_p.h
@@ -429,13 +429,12 @@ inline QQmlJS::DiagnosticMessage QQmlPropertyCacheCreator<ObjectContainer>::crea
auto end = s->parametersEnd();
for ( ; param != end; ++param, ++i) {
names.append(stringAt(param->nameIndex).toUtf8());
- if (param->type < builtinTypeCount) {
+ if (param->indexIsBuiltinType) {
// built-in type
- paramTypes[i + 1] = builtinTypes[param->type].metaType;
+ paramTypes[i + 1] = builtinTypes[param->typeNameIndexOrBuiltinType].metaType;
} else {
// lazily resolved type
- Q_ASSERT(param->type == QV4::CompiledData::Property::Custom);
- const QString customTypeName = stringAt(param->customTypeNameIndex);
+ const QString customTypeName = stringAt(param->typeNameIndexOrBuiltinType);
QQmlType qmltype;
if (!imports->resolveType(customTypeName, &qmltype, nullptr, nullptr, nullptr))
return qQmlCompileError(s->location, QQmlPropertyCacheCreatorBase::tr("Invalid signal parameter type: %1").arg(customTypeName));