Cannot compile JavaScriptCore/runtime/VMTraps.cpp on FreeBSD because std::pair has...
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2017 18:25:43 +0000 (18:25 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2017 18:25:43 +0000 (18:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170875

Reviewed by Mark Lam.

WTF::ExpectedDetail::ConstexprBase doesn't have a user-defined
copy constructor, and its implicitly-defined copy constructor is
deleted because the default std::pair implementation on FreeBSD
has a non-trivial copy constructor. /usr/include/c++/v1/__config
says _LIBCPP_TRIVIAL_PAIR_COPY_CTOR is disabled in order to keep
ABI compatibility:
https://svnweb.freebsd.org/changeset/base/261801.

That's a huge bummer, and I'm not a fan of broken stdlibs, but in
this case it's pretty nice to have a custom named type anyways and
costs nothing.

* runtime/VMTraps.cpp:
(JSC::findActiveVMAndStackBounds):
(JSC::handleSigusr1):
(JSC::handleSigtrap):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215522 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/VMTraps.cpp

index ca47c02..b18fb20 100644 (file)
@@ -1,3 +1,27 @@
+2017-04-19  JF Bastien  <jfbastien@apple.com>
+
+        Cannot compile JavaScriptCore/runtime/VMTraps.cpp on FreeBSD because std::pair has a non-trivial copy constructor
+        https://bugs.webkit.org/show_bug.cgi?id=170875
+
+        Reviewed by Mark Lam.
+
+        WTF::ExpectedDetail::ConstexprBase doesn't have a user-defined
+        copy constructor, and its implicitly-defined copy constructor is
+        deleted because the default std::pair implementation on FreeBSD
+        has a non-trivial copy constructor. /usr/include/c++/v1/__config
+        says _LIBCPP_TRIVIAL_PAIR_COPY_CTOR is disabled in order to keep
+        ABI compatibility:
+        https://svnweb.freebsd.org/changeset/base/261801.
+
+        That's a huge bummer, and I'm not a fan of broken stdlibs, but in
+        this case it's pretty nice to have a custom named type anyways and
+        costs nothing.
+
+        * runtime/VMTraps.cpp:
+        (JSC::findActiveVMAndStackBounds):
+        (JSC::handleSigusr1):
+        (JSC::handleSigtrap):
+
 2017-04-19  Andy VanWagoner  <thetalecrafter@gmail.com>
 
         [INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
index 1163ffb..e6285a3 100644 (file)
@@ -88,7 +88,12 @@ inline static bool vmIsInactive(VM& vm)
     return !vm.entryScope && !vm.ownerThread();
 }
 
-static Expected<std::pair<VM*, StackBounds>, VMTraps::Error> findActiveVMAndStackBounds(SignalContext& context)
+struct VMAndStackBounds {
+    VM* vm;
+    StackBounds stackBounds;
+};
+
+static Expected<VMAndStackBounds, VMTraps::Error> findActiveVMAndStackBounds(SignalContext& context)
 {
     VMInspector& inspector = VMInspector::instance();
     auto locker = tryHoldLock(inspector.getLock());
@@ -124,7 +129,7 @@ static Expected<std::pair<VM*, StackBounds>, VMTraps::Error> findActiveVMAndStac
 
     if (!activeVM && unableToAcquireMachineThreadsLock)
         return makeUnexpected(VMTraps::Error::LockUnavailable);
-    return std::make_pair(activeVM, stackBounds);
+    return VMAndStackBounds { activeVM, stackBounds };
 }
 
 static void handleSigusr1(int signalNumber, siginfo_t* info, void* uap)
@@ -132,9 +137,9 @@ static void handleSigusr1(int signalNumber, siginfo_t* info, void* uap)
     SignalContext context(static_cast<ucontext_t*>(uap)->uc_mcontext);
     auto activeVMAndStackBounds = findActiveVMAndStackBounds(context);
     if (activeVMAndStackBounds) {
-        VM* vm = activeVMAndStackBounds.value().first;
+        VM* vm = activeVMAndStackBounds.value().vm;
         if (vm) {
-            StackBounds stackBounds = activeVMAndStackBounds.value().second;
+            StackBounds stackBounds = activeVMAndStackBounds.value().stackBounds;
             VMTraps& traps = vm->traps();
             if (traps.needTrapHandling())
                 traps.tryInstallTrapBreakpoints(context, stackBounds);
@@ -153,7 +158,7 @@ static void handleSigtrap(int signalNumber, siginfo_t* info, void* uap)
     if (!activeVMAndStackBounds)
         return; // Let the SignalSender try again later.
 
-    VM* vm = activeVMAndStackBounds.value().first;
+    VM* vm = activeVMAndStackBounds.value().vm;
     if (vm) {
         VMTraps& traps = vm->traps();
         if (!traps.needTrapHandling())