Fix build on SunOS.

The code in Source/JavaScriptCore/heap/MachineStackMarker.cpp is
untested.
This commit is contained in:
hans 2012-02-16 20:47:34 +00:00
parent 8f16206eb4
commit 0c74104664
5 changed files with 121 additions and 4 deletions

View file

@ -1,9 +1,12 @@
$NetBSD: distinfo,v 1.44 2012/02/04 13:24:35 drochner Exp $
$NetBSD: distinfo,v 1.45 2012/02/16 20:47:34 hans Exp $
SHA1 (webkit-1.6.3.tar.xz) = 7df69608ef2ce9dd7328353b4ee34f69271cd43b
RMD160 (webkit-1.6.3.tar.xz) = cc319ffe4c2810663ae05b90e69d9495f5c3f0aa
Size (webkit-1.6.3.tar.xz) = 6794004 bytes
SHA1 (patch-Source_JavaScriptCore_jit_JITStubs.cpp) = 37d860bad704ab6920881c0401f657e49084f833
SHA1 (patch-Source_JavaScriptCore_heap_MachineStackMarker.cpp) = a19c152025d16b32cf6e429483d3885bd8243de8
SHA1 (patch-Source_JavaScriptCore_jit_JITStubs.cpp) = 87ff59a80fb8bc436ee0b7093b4e26dc515de984
SHA1 (patch-Source_JavaScriptCore_wtf_MathExtras.h) = 17295aa1eacf1e5847e460bc99e70118f2f3f13b
SHA1 (patch-Source_JavaScriptCore_wtf_Threading.h) = 575534f48f9ad6fae3049f4d4631a9c27e2fcbca
SHA1 (patch-ag) = 220a9925ba1eb4288d334997fda24f41595de1c8
SHA1 (patch-ah) = de2e719f67534bf64fb5968b457888e9bd824a3d
SHA1 (patch-ai) = 8998dbb783922a866dcd00e14f33086d7edecdef

View file

@ -0,0 +1,92 @@
$NetBSD: patch-Source_JavaScriptCore_heap_MachineStackMarker.cpp,v 1.1 2012/02/16 20:47:34 hans Exp $
--- Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig 2011-09-26 22:54:57.000000000 +0200
+++ Source/JavaScriptCore/heap/MachineStackMarker.cpp 2011-12-08 19:30:49.602746923 +0100
@@ -20,6 +20,9 @@
*/
#include "config.h"
+#if OS(SOLARIS)
+#undef _FILE_OFFSET_BITS
+#endif
#include "MachineStackMarker.h"
#include "ConservativeRoots.h"
@@ -60,6 +63,10 @@
#include <unistd.h>
#if OS(SOLARIS)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <procfs.h>
#include <thread.h>
#else
#include <pthread.h>
@@ -317,6 +324,7 @@ typedef pthread_attr_t PlatformThreadReg
#error Need a thread register struct for this platform
#endif
+#if !OS(SOLARIS)
static size_t getPlatformThreadRegisters(const PlatformThread& platformThread, PlatformThreadRegisters& regs)
{
#if OS(DARWIN)
@@ -377,6 +385,7 @@ static size_t getPlatformThreadRegisters
#error Need a way to get thread registers on this platform
#endif
}
+#endif
static inline void* otherThreadStackPointer(const PlatformThreadRegisters& regs)
{
@@ -440,6 +449,7 @@ static inline void* otherThreadStackPoin
#endif
}
+#if !OS(SOLARIS)
static void freePlatformThreadRegisters(PlatformThreadRegisters& regs)
{
#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN) && !OS(QNX)
@@ -448,24 +458,40 @@ static void freePlatformThreadRegisters(
UNUSED_PARAM(regs);
#endif
}
+#endif
void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread)
{
suspendThread(thread->platformThread);
+#if OS(SOLARIS)
+ struct lwpstatus lwp;
+ char procfile[64];
+ int fd;
+ snprintf(procfile, 64, "/proc/self/lwp/%u/lwpstatus", thread->platformThread);
+ fd = open(procfile, O_RDONLY, 0);
+ if (fd == -1) {
+ fprintf(stderr, "%s: %s\n", procfile, strerror(errno));
+ abort();
+ }
+ pread(fd, &lwp, sizeof(lwp), 0);
+ close(fd);
+ void* stackPointer = (void*)lwp.pr_reg[REG_SP];
+#else
PlatformThreadRegisters regs;
size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
conservativeRoots.add(static_cast<void*>(&regs), static_cast<void*>(reinterpret_cast<char*>(&regs) + regSize));
void* stackPointer = otherThreadStackPointer(regs);
+
+ freePlatformThreadRegisters(regs);
+#endif
void* stackBase = thread->stackBase;
swapIfBackwards(stackPointer, stackBase);
conservativeRoots.add(stackPointer, stackBase);
resumeThread(thread->platformThread);
-
- freePlatformThreadRegisters(regs);
}
void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoots, void* stackCurrent)

View file

@ -1,4 +1,4 @@
$NetBSD: patch-Source_JavaScriptCore_jit_JITStubs.cpp,v 1.2 2011/10/07 12:17:25 drochner Exp $
$NetBSD: patch-Source_JavaScriptCore_jit_JITStubs.cpp,v 1.3 2012/02/16 20:47:34 hans Exp $
Fix build on NetBSD-5.99.53/amd64.
@ -9,7 +9,7 @@ Fix build on NetBSD-5.99.53/amd64.
#endif
-#if (OS(LINUX) || OS(FREEBSD)) && CPU(X86_64)
+#if (OS(LINUX) || OS(FREEBSD) || OS(NETBSD)) && CPU(X86_64)
+#if (OS(LINUX) || OS(FREEBSD) || OS(NETBSD) || OS(SOLARIS)) && CPU(X86_64) || (OS(SOLARIS) && CPU(X86))
#define SYMBOL_STRING_RELOCATION(name) #name "@plt"
#elif OS(DARWIN) || (CPU(X86_64) && COMPILER(MINGW) && !GCC_VERSION_AT_LEAST(4, 5, 0))
#define SYMBOL_STRING_RELOCATION(name) "_" #name

View file

@ -0,0 +1,13 @@
$NetBSD: patch-Source_JavaScriptCore_wtf_MathExtras.h,v 1.1 2012/02/16 20:47:34 hans Exp $
--- Source/JavaScriptCore/wtf/MathExtras.h.orig 2011-09-26 22:54:57.000000000 +0200
+++ Source/JavaScriptCore/wtf/MathExtras.h 2011-12-08 15:00:06.791014713 +0100
@@ -259,7 +259,7 @@ inline bool isWithinIntRange(float x)
return x > static_cast<float>(std::numeric_limits<int>::min()) && x < static_cast<float>(std::numeric_limits<int>::max());
}
-#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !OS(SOLARIS) && !OS(SYMBIAN)
+#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !(OS(SOLARIS) && COMPILER(GCC) && (GCC_VERSION < 40600)) && !OS(SYMBIAN)
using std::isfinite;
using std::isinf;
using std::isnan;

View file

@ -0,0 +1,9 @@
--- Source/JavaScriptCore/wtf/Threading.h.orig 2011-03-21 19:41:47.000000000 +0100
+++ Source/JavaScriptCore/wtf/Threading.h 2011-09-13 17:47:57.423475599 +0200
@@ -113,6 +113,5 @@ using WTF::createThread;
using WTF::currentThread;
using WTF::detachThread;
using WTF::waitForThreadCompletion;
-using WTF::yield;
#endif // Threading_h