diff options
author | Fabian Kosmale <[email protected]> | 2024-02-09 21:29:26 +0100 |
---|---|---|
committer | Fabian Kosmale <[email protected]> | 2024-03-05 14:06:28 +0100 |
commit | e19750538268c4d45fc6c60d2c90b17dd25c81e8 (patch) | |
tree | 03326ac7eab1f453e318f9f93b3447d26724eb7e /src/qml/jsruntime/qv4qobjectwrapper.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 <[email protected]>
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index c37031068c..354b3ad874 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1115,7 +1115,8 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E && !property->isVarProperty() && !property->isVMEFunction() // Handled by QObjectLookup && !property->isSignalHandler()) { // TODO: Optimize SignalHandler, too - setupQObjectMethodLookup(lookup, ddata, property, This, nullptr); + QV4::Heap::QObjectMethod *method = nullptr; + setupQObjectMethodLookup(lookup, ddata, property, This, method); lookup->getter = Lookup::getterQObjectMethod; return lookup->getter(lookup, engine, *object); } |