Skip to content
  1. Apr 22, 2016
  2. Apr 21, 2016
  3. Apr 20, 2016
    • Eric Fiselier's avatar
      [libcxx] Fix PR15638 - Only allocate in parent when starting a thread to prevent calling terminate. · e08afaf8
      Eric Fiselier authored
      Summary:
      Hi,
      
      When creating a new thread libc++ performs at least 2 allocations. The first allocates a tuple of args and the functor that will be passed to the new thread. The second allocation is for the thread local storage needed internally by libc++. Currently the second allocation happens in the child thread, meaning that if it throws the program will terminate with an uncaught bad alloc.
      
      The solution to this is to allocate ALL memory in the parent thread and then pass it to the child.
      
      See https://llvm.org/bugs/show_bug.cgi?id=15638
      
      Reviewers: mclow.lists, danalbert, jroelofs, EricWF
      
      Subscribers: cfe-commits
      
      Differential Revision: http://reviews.llvm.org/D13748
      
      llvm-svn: 266851
      e08afaf8
    • Eric Fiselier's avatar
      Add 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE. · 840fa745
      Eric Fiselier authored
      The primary purpose of this patch is to add the 'is_callable' traits.
      Since 'is_nothrow_callable' required making 'INVOKE' conditionally noexcept
      I also took this oppertunity to implement a constexpr version of INVOKE.
      This fixes 'std::experimental::apply' which required constexpr 'INVOKE support'.
      
      This patch will be followed up with some cleanup. Primarly removing most
      of "__member_function_traits" since it's no longer used by INVOKE (in C++11 at least).
      
      llvm-svn: 266836
      840fa745
  4. Apr 19, 2016
  5. Apr 18, 2016
  6. Apr 16, 2016
  7. Apr 15, 2016
  8. Apr 13, 2016
  9. Apr 11, 2016
  10. Apr 07, 2016
  11. Apr 05, 2016
  12. Apr 04, 2016
  13. Mar 31, 2016
    • Eric Fiselier's avatar
      Fix LWG issue 2469 - Use piecewise construction in map::operator[]. · 54f0cda6
      Eric Fiselier authored
      map's allocator may only be used to construct objects of 'value_type',
      or in this case 'pair<const Key, Value>'. In order to respect this requirement
      in operator[], which requires default constructing the 'mapped_type', we have
      to use pair's piecewise constructor with '(tuple<Kep>, tuple<>)'.
      
      Unfortunately we still need to provide a fallback implementation for C++03
      since we don't have <tuple>. Even worse this fallback is the last remaining
      user of '__hash_map_node_destructor' and '__construct_node_with_key'.
      
      This patch also switches try_emplace over to __tree.__emplace_unique_key_args.
      
      llvm-svn: 264989
      54f0cda6
    • Eric Fiselier's avatar
      Teach __tree how to handle map's __value_type · 5e3ea4dd
      Eric Fiselier authored
      This patch is fairly large and contains a number of changes. The changes all work towards
      allowing __tree to properly handle __value_type esspecially when inserting into the __tree.
      I chose not to break this change into smaller patches because it wouldn't be possible to
      write meaningful standard-compliant tests for each patch.
      
      It is very similar to r260513 "[libcxx] Teach __hash_table how to handle unordered_map's __hash_value_type".
      
      Changes in <map>
       * Remove __value_type's constructors because it should never be constructed directly.
      
       * Make map::emplace and multimap::emplace forward to __tree and remove the old definitions
      
       * Remove "__construct_node" map and multimap member functions. Almost all of the construction is done within __tree.
      
       * Fix map's move constructor to access "__value_type.__nc" directly and pass this object to __tree::insert.
      
      Changes in <__tree>
       * Add traits to detect, handle, and unwrap, map's "__value_type".
      
       * Convert methods taking "value_type" to take "__container_value_type" instead. Previously these methods caused
        unwanted implicit conversions from "std::pair<Key, Value>" to "__value_type<Key, Value>".
      
       * Delete __tree_node and __tree_node_base's constructors and assignment operators. The node types should never be constructed
         because the "__value_" member of __tree_node must be constructed directly by the allocator.
      
       * Make the __tree_node_destructor class and "__construct_node" methods unwrap "__node_value_type" into "__container_value_type" before invoking the allocator. The user's allocator can only be used to construct and destroy the container's value_type. Passing it map's "__value_type" was incorrect.
      
       * Cleanup the "__insert" and "__emplace" methods. Have __insert forward to an __emplace function wherever possible to reduce
         code duplication. __insert_unique(value_type const&) and __insert_unique(value_type&&) forward to __emplace_unique_key_args.
         These functions will not allocate a new node if the value is already in the tree.
      
       * Change the __find* functions to take the "key_type" directly instead of passing in "value_type" and unwrapping the key later.
         This change allows the find functions to be used without having to construct a "value_type" first. This allows for a number
         of optimizations.
      
       * Teach __move_assign and __assign_multi methods to unwrap map's __value_type.
      
      llvm-svn: 264986
      5e3ea4dd
  14. Mar 25, 2016
  15. Mar 17, 2016
    • Duncan P. N. Exon Smith's avatar
      unord: Extract key to avoid preemptive mallocs in insert/emplace · fde79b40
      Duncan P. N. Exon Smith authored
      unordered_set::emplace and unordered_map::emplace construct a node, then
      try to insert it.  If insertion fails, the node gets deleted.
      
      To avoid this unnecessary malloc traffic, check to see if the argument
      to emplace has the appropriate key_type.  If so, we can use that key
      directly and delay the malloc until we're sure we're inserting something
      new.
      
      Test updates by Eric Fiselier, who rewrote the old allocation tests to
      include the new cases.
      
      There are two orthogonal future directions:
      
      1. Apply the same optimization to set and map.
      
      2. Extend the optimization to when the argument is not key_type, but can
         be converted to it without side effects.  Ideally, we could do this
         whenever key_type is trivially destructible and the argument is
         trivially convertible to key_type, but in practise the relevant type
         traits "blow up sometimes".  At least, we should catch a few simple
         cases (such as when both are primitive types).
      
      llvm-svn: 263746
      fde79b40
    • Eric Fiselier's avatar
      Make std::addressof constexpr in C++17 (Clang only). · a58d430c
      Eric Fiselier authored
      llvm-svn: 263688
      a58d430c
  16. Mar 16, 2016
  17. Mar 15, 2016
  18. Mar 14, 2016
  19. Mar 12, 2016
    • Evgeniy Stepanov's avatar
      Disable CFI checks in std::addressof. · 1bc0e399
      Evgeniy Stepanov authored
      std::addressof may be used on a storage of an object before the start
      of its lifetime (see std::allocate_shared for example). CFI flags the
      C-style cast as invalid in that case.
      
      llvm-svn: 263310
      1bc0e399
  20. Mar 11, 2016
  21. Mar 09, 2016
    • Marshall Clow's avatar
      Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment... · ffc888bc
      Marshall Clow authored
      Implement LWG#2579: Inconsistency wrt Allocators in basic_string assignment vs. basic_string::assign
      
      llvm-svn: 263042
      ffc888bc
    • Marshall Clow's avatar
    • Ben Craig's avatar
      Split locale management out of locale_win32. NFCI · 069b432b
      Ben Craig authored
      For the locale refactor, the locale management functions (newlocale,
      freelocale, uselocale) are needed in a separate header from the various _l
      functions. This is because some platforms implement the _l functions in terms
      of a locale switcher RAII helper, and the locale switcher RAII helper needs
      the locale management functions. This patch helps pave the way by getting all
      the functions in the right files, so that later diffs aren't completely
      horrible.
      
      Unfortunately, the Windows, Cygwin, and MinGW builds seemed to have
      bit-rotted, so I wasn't able to test this completely. I don't think I made
      things any worse than they already are though.
      
      http://reviews.llvm.org/D17419
      
      llvm-svn: 263020
      069b432b
    • Ben Craig's avatar
      Reorganize _LIBCPP_LOCALE__L_EXTENSIONS · d2f15ba3
      Ben Craig authored
      Instead of checking _LIBCPP_LOCALE_L_EXTENSIONS all over, instead check it
      once, and define the various *_l symbols once. The private redirector symbol
      names are all prefixed with _libcpp_* so that they won't conflict with user
      symbols, and so they won't conflict with future C library symbols. In
      particular, glibc likes providing private symbols such as __locale_t, so we
      should follow a different naming pattern (like _libcpp_*) to avoid problems
      on that front.
      
      Tested on Linux with glibc. Hoping for the best on OSX and the various BSDs.
      
      http://reviews.llvm.org/D17456
      
      llvm-svn: 263016
      d2f15ba3
  22. Mar 08, 2016
  23. Mar 07, 2016
Loading