Files
haikuports/kde-frameworks/kjs/patches/kjs-5.39.0.patchset
2017-11-20 18:06:34 +10:00

65 lines
1.7 KiB
Plaintext

From 0ecb5b82b048e6651d99a103c23ca32f372b61ed Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 20 Nov 2017 11:09:28 +1000
Subject: Add Haiku support
diff --git a/src/kjs/collector.cpp b/src/kjs/collector.cpp
index 1127280..835bd0a 100644
--- a/src/kjs/collector.cpp
+++ b/src/kjs/collector.cpp
@@ -64,6 +64,15 @@ using std::memset;
#include <pthread_np.h>
#endif
+#if PLATFORM(HAIKU_OS)
+#include <OS.h>
+static const ptrdiff_t estimateStackSize = 128 * sizeof(void*) *1024;
+static void* estimateStackBound(void *origin)
+{
+ return static_cast<char*>(origin) - estimateStackSize;
+}
+#endif
+
#endif
#define DEBUG_COLLECTOR 0
@@ -508,6 +517,10 @@ static inline void *currentThreadStackBase()
return s.ss_sp;
// NOTREACHED
void *stackBase = 0;
+#elif PLATFORM(HAIKU_OS)
+ thread_info threadInfo;
+ get_thread_info(find_thread(NULL), &threadInfo);
+ void *stackBase = estimateStackBound(threadInfo.stack_end);
#elif PLATFORM(UNIX)
static void *stackBase = nullptr;
static pthread_t stackThread;
diff --git a/src/wtf/Platform.h b/src/wtf/Platform.h
index aaf0673..3070490 100644
--- a/src/wtf/Platform.h
+++ b/src/wtf/Platform.h
@@ -72,6 +72,7 @@
|| defined(unix) \
|| defined(__unix) \
|| defined(__unix__) \
+ || defined(__HAIKU__) \
|| defined (__NetBSD__) \
|| defined(_AIX)
#define WTF_PLATFORM_UNIX 1
@@ -85,6 +86,11 @@
#define WTF_PLATFORM_SOLARIS_OS 1
#endif
+/* PLATFORM(HAIKU_OS) */
+#if defined(__HAIKU__)
+#define WTF_PLATFORM_HAIKU_OS 1
+#endif
+
/* Operating environments */
/* I made the BUILDING_KDE__ macro up for the KDE build system to define */
--
2.15.0