2007-04-20 Mark Rowe <mrowe@apple.com>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2007 08:47:42 +0000 (08:47 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2007 08:47:42 +0000 (08:47 +0000)
        Reviewed by Maciej.

        Fix bogus optimisation in the generic pthread code path.

        * kjs/collector.cpp:
        (KJS::currentThreadStackBase):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20971 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/collector.cpp

index ec5bb51a494f81fdbc975e4a1144861903e1932a..a2870511d1eb65db4ba79a9a808dd18109f3465f 100644 (file)
@@ -1,3 +1,12 @@
+2007-04-20  Mark Rowe  <mrowe@apple.com>
+
+        Reviewed by Maciej.
+
+        Fix bogus optimisation in the generic pthread code path.
+
+        * kjs/collector.cpp:
+        (KJS::currentThreadStackBase):
+
 2007-04-20  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Anders.
index 92289da91d24f285ebb0abf3fdbc9de83140037b..0b402088240305a4f8dca8c90dd61e2e8bdacaee 100644 (file)
@@ -236,6 +236,7 @@ static inline void* currentThreadStackBase()
     return (void*)pTib->StackBase;
 #elif PLATFORM(UNIX)
     static void *stackBase = 0;
+    static size_t stackSize = 0;
     static pthread_t stackThread;
     pthread_t thread = pthread_self();
     if (stackBase == 0 || thread != stackThread) {
@@ -248,14 +249,13 @@ static inline void* currentThreadStackBase()
         // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
         pthread_getattr_np(thread, &sattr);
 #endif
-        size_t stackSize;
         int rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);
         (void)rc; // FIXME: deal with error code somehow?  seems fatal...
         ASSERT(stackBase);
         pthread_attr_destroy(&sattr);
-        return (void*)(size_t(stackBase) + stackSize);
         stackThread = thread;
     }
+    return (void*)(size_t(stackBase) + stackSize);
 #else
 #error Need a way to get the stack base on this platform
 #endif