diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-02-09 21:29:26 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-03-05 14:06:28 +0100 |
commit | e19750538268c4d45fc6c60d2c90b17dd25c81e8 (patch) | |
tree | 03326ac7eab1f453e318f9f93b3447d26724eb7e /src/qml/qml/qqmlvaluetypewrapper.cpp | |
parent | 688c98a12da19a88becc152f832beb5c5a01ec47 (diff) |
Prepare for white allocations during gc (1/9): Write barrier for Lookups
Lookups can (and do) reference HeapItems. This was safe in a
non-incremental gc world, as Lookups are always reachable via their
containing CompilationUnits, which are part of the root set. However,
when using an incremental gc, an already marked Lookup might reference a
new heap item, which then becomes otherwise unreachable.
This is alleviated by the fact that Lookups generally either refer to
something already existing or a freshly allocated string. The latter
however is only safe when we can rely on black allocations during gc,
and the former is somewhat reckless.
Remedy this by employing the WriteBarrier for Lookups. We wrap all
HeapItems in a helper class, which -while trivial itself- can't be used
for direct assignments. Intead, it employs a set method which ensures
that the WriteBarrier is used.
Task-number: QTBUG-121910
Change-Id: I6a0ede66ad044076d2e87f134bc95686cb586aee
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlvaluetypewrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index e0d684e377..7075d0f5f6 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -644,7 +644,7 @@ ReturnedValue QQmlValueTypeWrapper::virtualResolveLookupGetter(const Object *obj if (!result.isValid()) return QV4::Object::virtualResolveLookupGetter(object, engine, lookup); - lookup->qgadgetLookup.ic = r->internalClass(); + lookup->qgadgetLookup.ic.set(engine, r->internalClass()); // & 1 to tell the gc that this is not heap allocated; see markObjects in qv4lookup_p.h lookup->qgadgetLookup.metaObject = quintptr(r->d()->metaObject()) + 1; lookup->qgadgetLookup.metaType = result.propType().iface(); |