Title: [95498] trunk/Source/_javascript_Core
Revision
95498
Author
[email protected]
Date
2011-09-19 17:35:41 -0700 (Mon, 19 Sep 2011)

Log Message

Enable JSC_MULTIPLE_THREADS for OS(QNX).
https://bugs.webkit.org/show_bug.cgi?id=68047

Patch by Eli Fidler <[email protected]> on 2011-09-19
Reviewed by Daniel Bates.

SA_RESTART was required for SIGUSR2-based debugging, but is not
present on QNX. This debugging doesn't seem critical to
JSC_MULTIPLE_THREADS, so allow it to proceed.

* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::Thread::Thread):
(JSC::getPlatformThreadRegisters):
(JSC::otherThreadStackPointer):
(JSC::freePlatformThreadRegisters):
* wtf/Platform.h: enable PTHREADS for OS(QNX)

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (95497 => 95498)


--- trunk/Source/_javascript_Core/ChangeLog	2011-09-20 00:19:02 UTC (rev 95497)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-09-20 00:35:41 UTC (rev 95498)
@@ -1,3 +1,21 @@
+2011-09-19  Eli Fidler  <[email protected]>
+
+        Enable JSC_MULTIPLE_THREADS for OS(QNX).
+        https://bugs.webkit.org/show_bug.cgi?id=68047
+
+        Reviewed by Daniel Bates.
+
+        SA_RESTART was required for SIGUSR2-based debugging, but is not
+        present on QNX. This debugging doesn't seem critical to
+        JSC_MULTIPLE_THREADS, so allow it to proceed.
+
+        * heap/MachineStackMarker.cpp:
+        (JSC::MachineThreads::Thread::Thread):
+        (JSC::getPlatformThreadRegisters):
+        (JSC::otherThreadStackPointer):
+        (JSC::freePlatformThreadRegisters):
+        * wtf/Platform.h: enable PTHREADS for OS(QNX)
+
 2011-09-19  Oliver Hunt  <[email protected]>
 
         Windows build fix.

Modified: trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp (95497 => 95498)


--- trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp	2011-09-20 00:19:02 UTC (rev 95497)
+++ trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp	2011-09-20 00:35:41 UTC (rev 95498)
@@ -78,10 +78,7 @@
 
 #if ENABLE(JSC_MULTIPLE_THREADS) && USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
 #include <signal.h>
-#ifndef SA_RESTART
-#error MachineThreads requires SA_RESTART
 #endif
-#endif
 
 #endif
 
@@ -127,7 +124,8 @@
         , platformThread(platThread)
         , stackBase(base)
     {
-#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
+#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN) && defined(SA_RESTART)
+        // if we have SA_RESTART, enable SIGUSR2 debugging mechanism
         struct sigaction action;
         action.sa_handler = pthreadSignalHandlerSuspendResume;
         sigemptyset(&action.sa_mask);
@@ -325,6 +323,8 @@
 
 #elif OS(WINDOWS)
 typedef CONTEXT PlatformThreadRegisters;
+#elif OS(QNX)
+typedef struct _debug_thread_info PlatformThreadRegisters;
 #elif USE(PTHREADS)
 typedef pthread_attr_t PlatformThreadRegisters;
 #else
@@ -367,6 +367,16 @@
     regs.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
     GetThreadContext(platformThread, &regs);
     return sizeof(CONTEXT);
+#elif OS(QNX)
+    memset(&regs, 0, sizeof(regs));
+    regs.tid = pthread_self();
+    int fd = open("/proc/self", O_RDONLY);
+    if (fd == -1) {
+        LOG_ERROR("Unable to open /proc/self (errno: %d)", errno);
+        CRASH();
+    }
+    devctl(fd, DCMD_PROC_TIDSTATUS, &regs, sizeof(regs), 0);
+    close(fd);
 #elif USE(PTHREADS)
     pthread_attr_init(&regs);
 #if HAVE(PTHREAD_NP_H) || OS(NETBSD)
@@ -429,6 +439,9 @@
 #error Unknown Architecture
 #endif
 
+#elif OS(QNX)
+    return reinterpret_cast<void*>((uintptr_t) regs.sp);
+
 #elif USE(PTHREADS)
     void* stackBase = 0;
     size_t stackSize = 0;
@@ -443,7 +456,7 @@
 
 static void freePlatformThreadRegisters(PlatformThreadRegisters& regs)
 {
-#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
+#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN) && !OS(QNX)
     pthread_attr_destroy(&regs);
 #else
     UNUSED_PARAM(regs);

Modified: trunk/Source/_javascript_Core/wtf/Platform.h (95497 => 95498)


--- trunk/Source/_javascript_Core/wtf/Platform.h	2011-09-20 00:19:02 UTC (rev 95497)
+++ trunk/Source/_javascript_Core/wtf/Platform.h	2011-09-20 00:35:41 UTC (rev 95498)
@@ -762,6 +762,7 @@
 #define HAVE_STRINGS_H 1
 #define HAVE_SYS_PARAM_H 1
 #define HAVE_SYS_TIME_H 1
+#define WTF_USE_PTHREADS 1
 
 #elif OS(ANDROID)
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to