From 3b14e2ffdd8eb4b7f7f4508768b75f2acc399370 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 9 Sep 2016 15:37:57 +0200 Subject: QML: Make Heap::Object and all subclasses trivial GCC6 might dead-store-eliminate out our secret write to Base::mmdata, because it expects all memory content to be "undefined" before constructor calls. Clang might take the same approach if the constructor of Heap::Object is removed. By making these structs trivial, it also makes them memcpy-able. Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlvaluetypewrapper_p.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/qml/qml/qqmlvaluetypewrapper_p.h') diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h index 94eeba366a..b8ca5a16f4 100644 --- a/src/qml/qml/qqmlvaluetypewrapper_p.h +++ b/src/qml/qml/qqmlvaluetypewrapper_p.h @@ -66,14 +66,24 @@ namespace QV4 { namespace Heap { struct QQmlValueTypeWrapper : Object { - QQmlValueTypeWrapper() {} - ~QQmlValueTypeWrapper(); - QQmlRefPointer propertyCache; + void init() { Object::init(); } + void destroy(); + QQmlPropertyCache *propertyCache() const { return _propertyCache; } + void setPropertyCache(QQmlPropertyCache *c) { + if (c) + c->addref(); + if (_propertyCache) + _propertyCache->release(); + _propertyCache = c; + } mutable void *gadgetPtr; QQmlValueType *valueType; void setValue(const QVariant &value) const; QVariant toVariant() const; + +private: + QQmlPropertyCache *_propertyCache; }; } @@ -82,7 +92,7 @@ struct Q_QML_EXPORT QQmlValueTypeWrapper : Object { V4_OBJECT2(QQmlValueTypeWrapper, Object) V4_PROTOTYPE(valueTypeWrapperPrototype) - static void destroy(Heap::Base *b); + V4_NEEDS_DESTROY public: -- cgit v1.2.3