1 $NetBSD: patch-src_3rdparty_webkit_Source_JavaScriptCore_heap_MachineStackMarker.cpp,v 1.2 2012/04/09 09:12:49 adam Exp $
3 --- a/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp.orig 2012-03-14 14:01:26.000000000 +0000
4 +++ b/src/3rdparty/webkit/Source/JavaScriptCore/heap/MachineStackMarker.cpp
10 +#undef _FILE_OFFSET_BITS
12 #include "MachineStackMarker.h"
14 #include "ConservativeRoots.h"
19 +#include <sys/types.h>
20 +#include <sys/stat.h>
26 @@ -341,6 +348,7 @@ typedef pthread_attr_t PlatformThreadReg
27 #error Need a thread register struct for this platform
31 static size_t getPlatformThreadRegisters(const PlatformThread& platformThread, PlatformThreadRegisters& regs)
34 @@ -391,6 +399,7 @@ static size_t getPlatformThreadRegisters
35 #error Need a way to get thread registers on this platform
40 static inline void* otherThreadStackPointer(const PlatformThreadRegisters& regs)
42 @@ -441,6 +450,7 @@ static inline void* otherThreadStackPoin
47 static void freePlatformThreadRegisters(PlatformThreadRegisters& regs)
49 #if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
50 @@ -449,24 +459,40 @@ static void freePlatformThreadRegisters(
56 void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots, Thread* thread)
58 suspendThread(thread->platformThread);
61 + struct lwpstatus lwp;
64 + snprintf(procfile, 64, "/proc/self/lwp/%u/lwpstatus", thread->platformThread);
65 + fd = open(procfile, O_RDONLY, 0);
67 + fprintf(stderr, "%s: %s\n", procfile, strerror(errno));
70 + pread(fd, &lwp, sizeof(lwp), 0);
72 + void* stackPointer = (void*)lwp.pr_reg[REG_SP];
74 PlatformThreadRegisters regs;
75 size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
77 conservativeRoots.add(static_cast<void*>(®s), static_cast<void*>(reinterpret_cast<char*>(®s) + regSize));
79 void* stackPointer = otherThreadStackPointer(regs);
81 + freePlatformThreadRegisters(regs);
83 void* stackBase = thread->stackBase;
84 swapIfBackwards(stackPointer, stackBase);
85 conservativeRoots.add(stackPointer, stackBase);
87 resumeThread(thread->platformThread);
89 - freePlatformThreadRegisters(regs);