From b85c2deccae3006468eaf3023d5b3bf802739747 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 1 Jul 2019 19:38:42 +0200 Subject: Port from implicit to explicit atomic operations The old code used the implicit conversions from QAtomicPointer to T*, and QAtomicInteger to T, and vice versa. The semantics of these differ from the ones std::atomic uses, so we're going to deprecate these, like we did for load() and store(), too. This patch fixes some users of these APIs before we deprecate them. Change-Id: I892d705c22280f1c6fdc62c1777248b44e9c4329 Reviewed-by: Ulf Hermann --- src/qml/jsruntime/qv4identifier.cpp | 2 +- src/qml/jsruntime/qv4vme_moth.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp index 49981ecaed..c3d7165f71 100644 --- a/src/qml/jsruntime/qv4identifier.cpp +++ b/src/qml/jsruntime/qv4identifier.cpp @@ -82,7 +82,7 @@ IdentifierHash::IdentifierHash(ExecutionEngine *engine) void IdentifierHash::detach() { - if (!d || d->refCount == 1) + if (!d || d->refCount.loadAcquire() == 1) return; IdentifierHashData *newData = new IdentifierHashData(d); if (d && !d->refCount.deref()) diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index a28752dc3a..b2bbe985d3 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -349,7 +349,7 @@ static struct InstrCount { #undef CHECK_EXCEPTION #endif #define CHECK_EXCEPTION \ - if (engine->hasException || engine->isInterrupted) \ + if (engine->hasException || engine->isInterrupted.loadAcquire()) \ goto handleUnwind static inline Heap::CallContext *getScope(QV4::Value *stack, int level) @@ -1376,7 +1376,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine, // We do start the exception handler in case of isInterrupted. The exception handler will // immediately abort, due to the same isInterrupted. We don't skip the exception handler // because the current behavior is easier to implement in the JIT. - Q_ASSERT(engine->hasException || engine->isInterrupted || frame->unwindLevel); + Q_ASSERT(engine->hasException || engine->isInterrupted.loadAcquire() || frame->unwindLevel); if (!frame->unwindHandler) { acc = Encode::undefined(); return acc; -- cgit v1.2.3