summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
index b8c91d1..1268d3d 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
@@ -506,6 +506,49 @@ static void* getStackBase(void* previousFrame)
}
}
#endif
+#if PLATFORM(HPUX)
+struct hpux_get_stack_base_data
+{
+ pthread_t thread;
+ _pthread_stack_info info;
+};
+
+static void *hpux_get_stack_base_internal(void *d)
+{
+ hpux_get_stack_base_data *data = static_cast<hpux_get_stack_base_data *>(d);
+
+ // _pthread_stack_info_np requires the target thread to be suspended
+ // in order to get information about it
+ pthread_suspend(data->thread);
+
+ // _pthread_stack_info_np returns an errno code in case of failure
+ // or zero on success
+ if (_pthread_stack_info_np(data->thread, &data->info)) {
+ // failed
+ return 0;
+ }
+
+ pthread_continue(data->thread);
+ return data;
+}
+
+static void *hpux_get_stack_base()
+{
+ hpux_get_stack_base_data data;
+ data.thread = pthread_self();
+
+ // We cannot get the stack information for the current thread
+ // So we start a new thread to get that information and return it to us
+ pthread_t other;
+ pthread_create(&other, 0, hpux_get_stack_base_internal, &data);
+
+ void *result;
+ pthread_join(other, &result);
+ if (result)
+ return data.info.stk_stack_base;
+ return 0;
+}
+#endif
static inline void* currentThreadStackBase()
{
@@ -532,6 +575,8 @@ static inline void* currentThreadStackBase()
: "=r" (pTib)
);
return static_cast<void*>(pTib->StackBase);
+#elif PLATFORM(HPUX)
+ return hpux_get_stack_base();
#elif PLATFORM(SOLARIS)
stack_t s;
thr_stksegment(&s);