Ignore:
Timestamp:
Apr 19, 2017, 11:25:43 AM (8 years ago)
Author:
[email protected]
Message:

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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/VMTraps.cpp

    r215265 r215522  
    8989}
    9090
    91 static Expected<std::pair<VM*, StackBounds>, VMTraps::Error> findActiveVMAndStackBounds(SignalContext& context)
     91struct VMAndStackBounds {
     92    VM* vm;
     93    StackBounds stackBounds;
     94};
     95
     96static Expected<VMAndStackBounds, VMTraps::Error> findActiveVMAndStackBounds(SignalContext& context)
    9297{
    9398    VMInspector& inspector = VMInspector::instance();
     
    125130    if (!activeVM && unableToAcquireMachineThreadsLock)
    126131        return makeUnexpected(VMTraps::Error::LockUnavailable);
    127     return std::make_pair(activeVM, stackBounds);
     132    return VMAndStackBounds { activeVM, stackBounds };
    128133}
    129134
     
    133138    auto activeVMAndStackBounds = findActiveVMAndStackBounds(context);
    134139    if (activeVMAndStackBounds) {
    135         VM* vm = activeVMAndStackBounds.value().first;
     140        VM* vm = activeVMAndStackBounds.value().vm;
    136141        if (vm) {
    137             StackBounds stackBounds = activeVMAndStackBounds.value().second;
     142            StackBounds stackBounds = activeVMAndStackBounds.value().stackBounds;
    138143            VMTraps& traps = vm->traps();
    139144            if (traps.needTrapHandling())
     
    154159        return; // Let the SignalSender try again later.
    155160
    156     VM* vm = activeVMAndStackBounds.value().first;
     161    VM* vm = activeVMAndStackBounds.value().vm;
    157162    if (vm) {
    158163        VMTraps& traps = vm->traps();
Note: See TracChangeset for help on using the changeset viewer.