Title: [197099] releases/WebKitGTK/webkit-2.12/Source/_javascript_Core
Revision
197099
Author
carlo...@webkit.org
Date
2016-02-25 05:05:30 -0800 (Thu, 25 Feb 2016)

Log Message

Merge r196962 - Fix build and implement functions to retrieve registers on FreeBSD
https://bugs.webkit.org/show_bug.cgi?id=152258

Patch by Ting-Wei Lan <lant...@gmail.com> on 2016-02-22
Reviewed by Michael Catanzaro.

* heap/MachineStackMarker.cpp:
(pthreadSignalHandlerSuspendResume):
struct ucontext is not specified in POSIX and it is not available on
FreeBSD. Replacing it with ucontext_t fixes the build problem.
(JSC::MachineThreads::Thread::Registers::stackPointer):
(JSC::MachineThreads::Thread::Registers::framePointer):
(JSC::MachineThreads::Thread::Registers::instructionPointer):
(JSC::MachineThreads::Thread::Registers::llintPC):
* heap/MachineStackMarker.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/ChangeLog (197098 => 197099)


--- releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/ChangeLog	2016-02-25 12:49:14 UTC (rev 197098)
+++ releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/ChangeLog	2016-02-25 13:05:30 UTC (rev 197099)
@@ -1,3 +1,20 @@
+2016-02-22  Ting-Wei Lan  <lant...@gmail.com>
+
+        Fix build and implement functions to retrieve registers on FreeBSD
+        https://bugs.webkit.org/show_bug.cgi?id=152258
+
+        Reviewed by Michael Catanzaro.
+
+        * heap/MachineStackMarker.cpp:
+        (pthreadSignalHandlerSuspendResume):
+        struct ucontext is not specified in POSIX and it is not available on
+        FreeBSD. Replacing it with ucontext_t fixes the build problem.
+        (JSC::MachineThreads::Thread::Registers::stackPointer):
+        (JSC::MachineThreads::Thread::Registers::framePointer):
+        (JSC::MachineThreads::Thread::Registers::instructionPointer):
+        (JSC::MachineThreads::Thread::Registers::llintPC):
+        * heap/MachineStackMarker.h:
+
 2016-02-21  Joseph Pecoraro  <pecor...@apple.com>
 
         CodeBlock always visits its unlinked code twice

Modified: releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/heap/MachineStackMarker.cpp (197098 => 197099)


--- releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/heap/MachineStackMarker.cpp	2016-02-25 12:49:14 UTC (rev 197098)
+++ releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/heap/MachineStackMarker.cpp	2016-02-25 13:05:30 UTC (rev 197099)
@@ -85,7 +85,7 @@
         return;
     }
 
-    struct ucontext* userContext = static_cast<struct ucontext*>(ucontext);
+    ucontext_t* userContext = static_cast<ucontext_t*>(ucontext);
     thread->suspendedMachineContext = userContext->uc_mcontext;
 
     // Allow suspend caller to see that this thread is suspended.
@@ -562,7 +562,23 @@
 #error Unknown Architecture
 #endif
 
+#elif OS(FREEBSD) && ENABLE(JIT)
+
+#if CPU(X86)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_esp);
+#elif CPU(X86_64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_rsp);
+#elif CPU(ARM)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_SP]);
+#elif CPU(ARM64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_sp);
+#elif CPU(MIPS)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_regs[29]);
 #else
+#error Unknown Architecture
+#endif
+
+#else
     void* stackBase = 0;
     size_t stackSize = 0;
 #if OS(OPENBSD)
@@ -646,7 +662,23 @@
 #error Unknown Architecture
 #endif
 
+#elif OS(FREEBSD)
+
+#if CPU(X86)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_ebp);
+#elif CPU(X86_64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_rbp);
+#elif CPU(ARM)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_FP]);
+#elif CPU(ARM64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_x[29]);
+#elif CPU(MIPS)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_regs[30]);
 #else
+#error Unknown Architecture
+#endif
+
+#else
 #error Need a way to get the frame pointer for another thread on this platform
 #endif
 }
@@ -712,7 +744,23 @@
 #error Unknown Architecture
 #endif
 
+#elif OS(FREEBSD)
+
+#if CPU(X86)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_eip);
+#elif CPU(X86_64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_rip);
+#elif CPU(ARM)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_PC]);
+#elif CPU(ARM64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_elr);
+#elif CPU(MIPS)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_pc);
 #else
+#error Unknown Architecture
+#endif
+
+#else
 #error Need a way to get the instruction pointer for another thread on this platform
 #endif
 }
@@ -787,7 +835,23 @@
 #error Unknown Architecture
 #endif
 
+#elif OS(FREEBSD)
+
+#if CPU(X86)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_esi);
+#elif CPU(X86_64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_r8);
+#elif CPU(ARM)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.__gregs[_REG_R8]);
+#elif CPU(ARM64)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_gpregs.gp_x[4]);
+#elif CPU(MIPS)
+    return reinterpret_cast<void*>((uintptr_t) regs.machineContext.mc_regs[12]);
 #else
+#error Unknown Architecture
+#endif
+
+#else
 #error Need a way to get the LLIntPC for another thread on this platform
 #endif
 }

Modified: releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/heap/MachineStackMarker.h (197098 => 197099)


--- releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/heap/MachineStackMarker.h	2016-02-25 12:49:14 UTC (rev 197098)
+++ releases/WebKitGTK/webkit-2.12/Source/_javascript_Core/heap/MachineStackMarker.h	2016-02-25 13:05:30 UTC (rev 197099)
@@ -34,7 +34,14 @@
 #if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
 #include <semaphore.h>
 #include <signal.h>
+// Using signal.h didn't make mcontext_t and ucontext_t available on FreeBSD.
+// This bug has been fixed in FreeBSD 11.0-CURRENT, so this workaround can be
+// removed after FreeBSD 10.x goes EOL.
+// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207079
+#if OS(FREEBSD)
+#include <ucontext.h>
 #endif
+#endif
 
 #if OS(DARWIN)
 typedef mach_port_t PlatformThread;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to