diff options
author | Petr Nejedly <pnejedly@blackberry.com> | 2013-06-27 12:51:22 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-03 07:40:55 +0200 |
commit | b30657647a7f816a2945302b3569b882d7ac6b72 (patch) | |
tree | f9516404a82c34d90ad71e900ddb003c6dd98469 /src/qml/qml/v4 | |
parent | adc66d86f17b1c781b90ab30ad7382f0f3879c18 (diff) |
QNX-specific implementation of the stack base retrieval.
The garbage collector needs the top of the stack.
On QNX, every thread has the TLS structure at the top
of the stack, then the stack extends below this TLS structure
This is the easiest and fastest way resolve the stack base
of the current thread.
Change-Id: I9cc9592928298d06aeaee0f6110d61bf3cf68e49
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/v4')
-rw-r--r-- | src/qml/qml/v4/qv4mm.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qml/qml/v4/qv4mm.cpp b/src/qml/qml/v4/qv4mm.cpp index 34f47280a2..0e53a2088f 100644 --- a/src/qml/qml/v4/qv4mm.cpp +++ b/src/qml/qml/v4/qv4mm.cpp @@ -62,6 +62,10 @@ #include <valgrind/memcheck.h> #endif +#if OS(QNX) +#include <sys/storage.h> // __tls() +#endif + QT_BEGIN_NAMESPACE using namespace QV4; @@ -142,7 +146,12 @@ MemoryManager::MemoryManager() VALGRIND_CREATE_MEMPOOL(this, 0, true); #endif -#if USE(PTHREADS) +#if OS(QNX) + // TLS is at the top of each thread's stack, + // so the stack base for thread is the result of __tls() + m_d->stackTop = reinterpret_cast<quintptr *>( + (((uintptr_t)__tls() + __PAGESIZE - 1) & ~(__PAGESIZE - 1))); +#elif USE(PTHREADS) # if OS(DARWIN) void *st = pthread_get_stackaddr_np(pthread_self()); m_d->stackTop = static_cast<quintptr *>(st); |