summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-06-13 11:49:20 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-28 23:57:43 (GMT)
commitc7ce63313d06454966a777bf84bf3f4b4a48ab61 (patch)
tree1b225e77eca07967d853f0f0eabe5d136b902fbb
parent2873e0ef459228d324de88bb62836fd85fdafa52 (diff)
downloadQt-c7ce63313d06454966a777bf84bf3f4b4a48ab61.zip
Qt-c7ce63313d06454966a777bf84bf3f4b4a48ab61.tar.gz
Qt-c7ce63313d06454966a777bf84bf3f4b4a48ab61.tar.bz2
QNX: Changing the way JSC retrieves the current stack base pointer
What Qt is calling the stackbase is the top of the stack. The thread local storage [__tls()] area is at the top of the stack and the stack pointer is initialized below this on thread creation. With this patch, the stack base pointer can be retrieved faster then in the current implementation. This patch is from Sean Boudreau. Change-Id: I3d1ac58d5c43997cbf462424c66be0c7caafcf1b Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
index 711949b..2c859a2 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
@@ -83,10 +83,7 @@
#endif
#if OS(QNX)
-#include <fcntl.h>
-#include <sys/procfs.h>
-#include <stdio.h>
-#include <errno.h>
+#include <sys/storage.h>
#endif
#endif
@@ -548,33 +545,6 @@ static void *hpux_get_stack_base()
}
#endif
-#if OS(QNX)
-static inline void *currentThreadStackBaseQNX()
-{
- static void* stackBase = 0;
- static size_t stackSize = 0;
- static pthread_t stackThread;
- pthread_t thread = pthread_self();
- if (stackBase == 0 || thread != stackThread) {
- struct _debug_thread_info threadInfo;
- memset(&threadInfo, 0, sizeof(threadInfo));
- threadInfo.tid = pthread_self();
- int fd = open("/proc/self", O_RDONLY);
- if (fd == -1) {
- LOG_ERROR("Unable to open /proc/self (errno: %d)", errno);
- return 0;
- }
- devctl(fd, DCMD_PROC_TIDSTATUS, &threadInfo, sizeof(threadInfo), 0);
- close(fd);
- stackBase = reinterpret_cast<void*>(threadInfo.stkbase);
- stackSize = threadInfo.stksize;
- ASSERT(stackBase);
- stackThread = thread;
- }
- return static_cast<char*>(stackBase) + stackSize;
-}
-#endif
-
static inline void* currentThreadStackBase()
{
#if OS(DARWIN)
@@ -613,9 +583,7 @@ static inline void* currentThreadStackBase()
#elif OS(HPUX)
return hpux_get_stack_base();
#elif OS(QNX)
- AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
- MutexLocker locker(mutex);
- return currentThreadStackBaseQNX();
+ return (void *) (((uintptr_t)__tls() + __PAGESIZE - 1) & ~(__PAGESIZE - 1));
#elif OS(SOLARIS)
stack_t s;
thr_stksegment(&s);