1. 20 Oct, 2016 3 commits
    • Jim Meyering's avatar
      folly/Synchronized.h: avoid shadowing warnings · d2e50930
      Jim Meyering authored
      Summary:
      Nested uses of SYNCHRONIZED (and related) macros leads
      inevitably to shadowed variable declarations.
      There is already a use of FOLLY_GCC_DISABLE_WARNING(shadow)
      to disable -Wshadow in that code, but obviously, that cannot
      help with the new options, so do similar for them via
      the new FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS.
      
      Depends on D4041696
      
      Reviewed By: markisaa
      
      Differential Revision: D4041728
      
      fbshipit-source-id: b85fb3452f6855d359f9b910abbd02cf8433f3f7
      d2e50930
    • Jim Meyering's avatar
      configure.ac: check for -Wshadow-local and -Wshadow-compatible-local · 9047707e
      Jim Meyering authored
      Summary:
      Add a configure-time check for whether -Wshadow-local and
      -Wshadow-compatible-local are supported.  If so, arrange to
      define HAVE_SHADOW_LOCAL_WARNINGS.
      
      In Portability.h, use that new symbol to choose whether
      to define FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS, which
      used pragmas to disable those new warnings.
      
      Differential Revision: D4041696
      
      fbshipit-source-id: 520ee88ae55147a13d0a045aca7d86567a8da99d
      9047707e
    • Shubhanshu Agrawal's avatar
      add missing includes · 8b4722fa
      Shubhanshu Agrawal authored
      Summary: add missing includes in folly fibers.q
      
      Reviewed By: A5he
      
      Differential Revision: D4036830
      
      fbshipit-source-id: 4dcb87377979f2875ba31b4869c2637a82298957
      8b4722fa
  2. 19 Oct, 2016 16 commits
  3. 18 Oct, 2016 3 commits
    • Andrew Gallagher's avatar
      folly: fixes for use with `-fvisibility-inlines-hidden` · 1a48bcd9
      Andrew Gallagher authored
      Summary:
      - Annotate non-`const` static locals in inline functions which don't require
        a single copy be used globally at runtime.
      - Move implmentation from header file to source file (to avoid multiple
        copies at runtime).
      - Mark a non-stateful static local as `const` to it easy to ignore when
        searching for problematic static locals.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4010101
      
      fbshipit-source-id: 3be94a5dc5b7029a26e11b2145c0d41968979a5c
      1a48bcd9
    • Phil Willoughby's avatar
      Fix for ExceptionWrapperTest · b74eb888
      Phil Willoughby authored
      Summary:
      Some platforms do not output anything when `std::terminate` is called; this
      fixes the test on those platforms.
      
      Reviewed By: yfeldblum, jsedgwick
      
      Differential Revision: D4001052
      
      fbshipit-source-id: 671fbca9d6d22e372189b6554440c268c0cff60b
      b74eb888
    • Marcelo Juchem's avatar
      Getting fibers to build with boost 1.61 · 0b894c40
      Marcelo Juchem authored
      Summary: This diff adapts the fibers code to the modified `fcontext` API from Boost 1.61
      
      Reviewed By: Orvid
      
      Differential Revision: D4035769
      
      fbshipit-source-id: 54a97294d33c2901af78b8dec95baaefa085c4f5
      0b894c40
  4. 15 Oct, 2016 1 commit
    • Philip Pronin's avatar
      fall back to .debug_info scan in fatal signal handler · cb3a7e45
      Philip Pronin authored
      Summary:
      We've found clang might be generating incomplete `.debug_aranges`,
      while falling back to linear `.debug_info` scan is too expensive and shouldn't
      be used by default, we can afford doing that in fatal signal handler.
      
      Also optimize `exception_tracer::printExceptionInfo()` to avoid `LocationInfo`
      resolution if `NO_FILE_AND_LINE` is used.
      
      Reviewed By: luciang, ot
      
      Differential Revision: D4020989
      
      fbshipit-source-id: 84172208736b224c19206da48bcb3b5c0b2c67d0
      cb3a7e45
  5. 14 Oct, 2016 3 commits
    • Nicholas Ormrod's avatar
      Backed out changeset 09c1712854b3 · fc838f2b
      Nicholas Ormrod authored
      Summary: Removing COW from fbstring had adverse memory consequences when sync'd with libgcc. Revert this diff to keep folly and libgcc in sync.
      
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D4019604
      
      fbshipit-source-id: 80bd31c220098bfab37f0effc90f67876432369d
      fc838f2b
    • Shubhanshu Agrawal's avatar
      BatchDispatcher exception handling · 2c0ece4a
      Shubhanshu Agrawal authored
      Summary: error handling for batch dispatcher, for the case where dispatch function throws.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4016246
      
      fbshipit-source-id: ac61b873a425128be7839a119591fca10608210a
      2c0ece4a
    • Matthieu Martin's avatar
      noexcept CollectVariadicContext destructor · 954899b8
      Matthieu Martin authored
      Summary: To be explicit about our assumption from D4013691
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D4015816
      
      fbshipit-source-id: 24f984ac9959d0c4c0aeac34b3dce8dfcf2c1354
      954899b8
  6. 13 Oct, 2016 5 commits
  7. 12 Oct, 2016 7 commits
    • Zonr Chang's avatar
      Access SSL cipher info with a const reference. · cef27cd0
      Zonr Chang authored
      Summary:
      BoringSSL returns `const SSL_CIPHER*` from sk_SSL_CIPHER_value().
      Closes https://github.com/facebook/folly/pull/492
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4009712
      
      Pulled By: Orvid
      
      fbshipit-source-id: cca2e8cb6aab0a459dca55b8f23ef57fa5c8251f
      cef27cd0
    • Zonr Chang's avatar
      Fix call to SSL_SESSION_up_ref(). · b6dfac67
      Zonr Chang authored
      Summary:
      `SSL_SESSION_up_ref()` in both BoringSSL and OpenSSL 1.1.0 takes a
      `SSL_SESSION*`.
      Closes https://github.com/facebook/folly/pull/493
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4009706
      
      Pulled By: Orvid
      
      fbshipit-source-id: 68ea201821e7a6d5835a79b34187344ba251e239
      b6dfac67
    • Philip Pronin's avatar
      ZSTDCodec should properly handle non-shortcut levels · 339ce0bf
      Philip Pronin authored
      Summary:
      Currently only shortcut levels are properly handled, others result in
      using level 1.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4008123
      
      fbshipit-source-id: 37845eeec139007738f99e72ecfb969c6a2e5652
      339ce0bf
    • Phil Willoughby's avatar
      Print why we called std::terminate · fec7b1bc
      Phil Willoughby authored
      Summary:
      When terminating because we were told to rethrow a nonexistent exception, we
      now print that to `std::cerr` for the benefit of users on platforms which do not dump a stack trace on
      `std::terminate`
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4001087
      
      fbshipit-source-id: 5b834cfc75bf42bec06a49ac9db55789a83df180
      fec7b1bc
    • Giuseppe Ottaviano's avatar
      Add support in enumerate() for iterators with exotic pointers · 1d2f2dcf
      Giuseppe Ottaviano authored
      Summary: I thought we wouldn't need this but it turns out Thrift Frozen2 iterators return proxies (it's proxies all the way down). Thanks to ericniebler for trick.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4005700
      
      fbshipit-source-id: 1911996afa075c1d819a3aaea2ee924bc2ae2f20
      1d2f2dcf
    • Christopher Dykes's avatar
      Fix build on Mac OSX Sierra · a34e06a1
      Christopher Dykes authored
      Summary:
      There are two changes here.
      The first is to eliminate `detail::DEFAULT_CLOCK_ID` from `Benchmark.[cpp|h]` as Sierra defines `clockid_t` as an enum type, which means that calling `clock_gettime(detail::DEFAULT_CLOCK_ID` would fail, because the enums are incompatible. As this was being used as a default, but is not actually changable anywhere, I just got rid of `detail::DEFAULT_CLOCK_ID` entirely.
      The second is to move `portability/BitsFunctexcept.cpp` into `libfollybase_la_SOURCES`, because it's needed for generating the fingerprint tables.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4004843
      
      fbshipit-source-id: b2a9c33f8e516d8eb3cdc5ab093f4946ac9ed37e
      a34e06a1
    • Lucian Grijincu's avatar
      folly: signal-handler: dynamic cache size, based on number of dynamic-loaded ELF files · 74ea0a31
      Lucian Grijincu authored
      Summary:
      I added kFatalSignalHandlerCacheSize in {D3984649}, and chose a big
      number to satisfy most use-cases. But the size increase is non-trivial.
      
      Memory usage:
      
      - before: 5.1 MB in folly::symbolizer::SignalSafeElfCache::SignalSafeElfCache
      - after: 80.0 MB in folly::symbolizer::SignalSafeElfCache::SignalSafeElfCache
      
      Switch to a dynamic approach and everyone pays for what they use.
      
      https://github.com/bminor/glibc/blob/ee19f1de0d0da24114be554fdf94243c0ec6b86c/elf/rtld-debugger-interface.txt#L10-L20
      ```
      The r_debug structure contains (amongst others) the following fields:
      
        struct link_map *r_map:
          A linked list of loaded objects.
      
        enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state:
          The current state of the r_map list.  RT_CONSISTENT means that r_map
          is not currently being modified and may safely be inspected.  RT_ADD
          means that an object is being added to r_map, and that the list is
          not guaranteed to be consistent.  Likewise RT_DELETE means that an
          object is being removed from the list.
      ```
      
      https://github.com/bminor/glibc/blob/ee19f1de0d0da24114be554fdf94243c0ec6b86c/elf/rtld.c#L303-L307
      ```
        /* Call the OS-dependent function to set up life so we can do things like
           file access.  It will call `dl_main' (below) to do all the real work
           of the dynamic linker, and then unwind our frame and run the user
           entry point on the same stack we entered on.  */
        start_addr = _dl_sysdep_start (arg, &dl_main);
      ```
      
      dl_main: https://github.com/bminor/glibc/blob/ee19f1de0d0da24114be554fdf94243c0ec6b86c/elf/rtld.c#L1192-L1199
      ```
        /* Initialize the data structures for the search paths for shared
           objects.  */
        _dl_init_paths (library_path);
      
        /* Initialize _r_debug.  */
        struct r_debug *r = _dl_debug_initialize (GL(dl_rtld_map).l_addr,
      					    LM_ID_BASE);
        r->r_state = RT_CONSISTENT;
      ...
      
        /* We start adding objects.  */
        r->r_state = RT_ADD;
        _dl_debug_state ();
        LIBC_PROBE (init_start, 2, LM_ID_BASE, r);
      
      ...
      
        /* Notify the debugger all new objects are now ready to go.  We must re-get
           the address since by now the variable might be in another object.  */
        r = _dl_debug_initialize (0, LM_ID_BASE);
        r->r_state = RT_CONSISTENT;
        _dl_debug_state ();
        LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
      
      ```
      
      Reviewed By: bixue2010
      
      Differential Revision: D3996974
      
      fbshipit-source-id: e24d72e3cc0339e4cf1acdd2f4c9a7ebfcfdf739
      74ea0a31
  8. 11 Oct, 2016 2 commits
    • Jim Meyering's avatar
      folly/ConcurrentSkipList.h: avoid shadowing warnings (trivial) · 70b158bb
      Jim Meyering authored
      Summary:
      Compiling with gcc's proposed -Wshadow-compatible-local option
      exposed some fix-worthy warnings. Rename to avoid the shadowing.
      
      Reviewed By: evilmucedin
      
      Differential Revision: D3999026
      
      fbshipit-source-id: 26cb3033ba8c5538cc9217993f2fda6aef954a8f
      70b158bb
    • Shubhanshu Agrawal's avatar
      BatchDispatcher add() interface · fb77b407
      Shubhanshu Agrawal authored
      Summary: converting add(value&&) to add(value) to make it easier for callsites to use.
      
      Reviewed By: A5he
      
      Differential Revision: D4000416
      
      fbshipit-source-id: c66f4d93d1223286bbc786d17f65ed02a63cc794
      fb77b407