passenger 6.2.1 → 6.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +37 -15
  3. data/build/cxx_tests.rb +2 -0
  4. data/build/support/cxx_dependency_map.rb +3 -63
  5. data/src/agent/Core/Config.h +1 -1
  6. data/src/agent/Core/Controller/Config.h +1 -1
  7. data/src/agent/Shared/ApiServerUtils.h +1 -1
  8. data/src/agent/Watchdog/Config.h +1 -1
  9. data/src/apache2_module/Hooks.cpp +13 -0
  10. data/src/apache2_module/Utils.h +14 -0
  11. data/src/cxx_supportlib/Constants.h +1 -1
  12. data/src/cxx_supportlib/FileTools/FileManip.cpp +27 -3
  13. data/src/cxx_supportlib/InstanceDirectory.h +30 -3
  14. data/src/cxx_supportlib/ServerKit/Errors.h +1 -1
  15. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
  16. data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +1 -1
  17. data/src/cxx_supportlib/ServerKit/HttpRequest.h +1 -1
  18. data/src/cxx_supportlib/ServerKit/llerrors.h +3 -3
  19. data/src/cxx_supportlib/ServerKit/llversion.h +1 -1
  20. data/src/cxx_supportlib/{ServerKit/llhttp_api.c → vendor-copy/llhttp/api.c} +30 -23
  21. data/src/cxx_supportlib/{ServerKit → vendor-copy/llhttp}/llhttp.c +1756 -1645
  22. data/src/cxx_supportlib/{ServerKit → vendor-copy/llhttp}/llhttp.h +35 -13
  23. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/classification.hpp +19 -0
  24. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/formatter.hpp +1 -1
  25. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/trim_all.hpp +0 -2
  26. data/src/cxx_supportlib/vendor-modified/boost/assert.hpp +20 -13
  27. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/core_arch_ops_gcc_x86.hpp +2 -2
  28. data/src/cxx_supportlib/vendor-modified/boost/atomic/thread_pause.hpp +4 -0
  29. data/src/cxx_supportlib/vendor-modified/boost/bind/mem_fn.hpp +1 -1
  30. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/debug.hpp +4 -0
  31. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx03.hpp +1 -1
  32. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx11.hpp +1 -1
  33. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx14.hpp +1 -1
  34. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx17.hpp +1 -1
  35. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx20.hpp +1 -1
  36. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx23.hpp +1 -1
  37. data/src/cxx_supportlib/vendor-modified/boost/config/auto_link.hpp +6 -1
  38. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang_version.hpp +10 -1
  39. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/visualc.hpp +5 -3
  40. data/src/cxx_supportlib/vendor-modified/boost/config/detail/cxx_composite.hpp +1 -1
  41. data/src/cxx_supportlib/vendor-modified/boost/config/workaround.hpp +5 -0
  42. data/src/cxx_supportlib/vendor-modified/boost/container/adaptive_pool.hpp +57 -53
  43. data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +10 -10
  44. data/src/cxx_supportlib/vendor-modified/boost/container/allocator_traits.hpp +34 -2
  45. data/src/cxx_supportlib/vendor-modified/boost/container/container_fwd.hpp +14 -2
  46. data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +176 -2287
  47. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool.hpp +13 -9
  48. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool_impl.hpp +186 -70
  49. data/src/cxx_supportlib/vendor-modified/boost/container/detail/algorithm.hpp +2 -2
  50. data/src/cxx_supportlib/vendor-modified/boost/container/detail/aligned_allocation.hpp +149 -0
  51. data/src/cxx_supportlib/vendor-modified/boost/container/detail/alloc_helpers.hpp +35 -0
  52. data/src/cxx_supportlib/vendor-modified/boost/container/detail/alloc_lib.h +1 -0
  53. data/src/cxx_supportlib/vendor-modified/boost/container/detail/bit_utilities.hpp +133 -0
  54. data/src/cxx_supportlib/vendor-modified/boost/container/detail/compare_functors.hpp +18 -3
  55. data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_begin.hpp +5 -0
  56. data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_end.hpp +4 -0
  57. data/src/cxx_supportlib/vendor-modified/boost/container/detail/container_rebind.hpp +1 -1
  58. data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +20 -10
  59. data/src/cxx_supportlib/vendor-modified/boost/container/detail/deque_impl.hpp +2744 -0
  60. data/src/cxx_supportlib/vendor-modified/boost/container/detail/dispatch_uses_allocator.hpp +202 -104
  61. data/src/cxx_supportlib/vendor-modified/boost/container/detail/dlmalloc.hpp +5 -4
  62. data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +161 -85
  63. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_constructible.hpp +180 -0
  64. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterators.hpp +3 -2
  65. data/src/cxx_supportlib/vendor-modified/boost/container/detail/math_functions.hpp +12 -0
  66. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mpl.hpp +16 -0
  67. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mutex.hpp +1 -1
  68. data/src/cxx_supportlib/vendor-modified/boost/container/detail/next_capacity.hpp +9 -1
  69. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool.hpp +18 -14
  70. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool_impl.hpp +256 -41
  71. data/src/cxx_supportlib/vendor-modified/boost/container/detail/operator_new_helpers.hpp +75 -24
  72. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pair.hpp +1 -56
  73. data/src/cxx_supportlib/vendor-modified/boost/container/detail/placement_new.hpp +16 -3
  74. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_common_alloc.hpp +1 -7
  75. data/src/cxx_supportlib/vendor-modified/boost/container/detail/range_utils.hpp +196 -0
  76. data/src/cxx_supportlib/vendor-modified/boost/container/detail/std_fwd.hpp +33 -1
  77. data/src/cxx_supportlib/vendor-modified/boost/container/detail/tree.hpp +124 -69
  78. data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +109 -7
  79. data/src/cxx_supportlib/vendor-modified/boost/container/devector.hpp +168 -162
  80. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/nest.hpp +2978 -0
  81. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/pmr/nest.hpp +45 -0
  82. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_all_of.hpp +43 -0
  83. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_any_of.hpp +42 -0
  84. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_copy.hpp +229 -0
  85. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_copy_if.hpp +270 -0
  86. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_copy_n.hpp +308 -0
  87. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_count.hpp +101 -0
  88. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_count_if.hpp +100 -0
  89. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_equal.hpp +268 -0
  90. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_fill.hpp +101 -0
  91. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_fill_n.hpp +171 -0
  92. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find.hpp +110 -0
  93. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_if.hpp +110 -0
  94. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_if_not.hpp +43 -0
  95. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_last.hpp +179 -0
  96. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_last_if.hpp +179 -0
  97. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_last_if_not.hpp +43 -0
  98. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_for_each.hpp +92 -0
  99. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_generate.hpp +90 -0
  100. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_generate_n.hpp +162 -0
  101. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_is_partitioned.hpp +46 -0
  102. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_is_sorted.hpp +49 -0
  103. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_is_sorted_until.hpp +169 -0
  104. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_iterator_traits.hpp +382 -0
  105. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_merge.hpp +428 -0
  106. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_mismatch.hpp +350 -0
  107. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_none_of.hpp +98 -0
  108. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_partition.hpp +296 -0
  109. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_partition_copy.hpp +105 -0
  110. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_partition_point.hpp +116 -0
  111. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove.hpp +57 -0
  112. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove_copy.hpp +207 -0
  113. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove_copy_if.hpp +223 -0
  114. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove_if.hpp +57 -0
  115. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_replace.hpp +90 -0
  116. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_replace_if.hpp +90 -0
  117. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_reverse.hpp +245 -0
  118. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_reverse_copy.hpp +229 -0
  119. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_search.hpp +211 -0
  120. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_search_n.hpp +476 -0
  121. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_difference.hpp +300 -0
  122. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_intersection.hpp +287 -0
  123. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_symmetric_difference.hpp +306 -0
  124. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_union.hpp +294 -0
  125. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_stable_partition.hpp +153 -0
  126. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_swap_ranges.hpp +92 -0
  127. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_transform.hpp +93 -0
  128. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/wrapped_iterator.hpp +142 -0
  129. data/src/cxx_supportlib/vendor-modified/boost/container/flat_map.hpp +642 -417
  130. data/src/cxx_supportlib/vendor-modified/boost/container/flat_set.hpp +141 -30
  131. data/src/cxx_supportlib/vendor-modified/boost/container/hub.hpp +2426 -0
  132. data/src/cxx_supportlib/vendor-modified/boost/container/list.hpp +65 -57
  133. data/src/cxx_supportlib/vendor-modified/boost/container/map.hpp +247 -68
  134. data/src/cxx_supportlib/vendor-modified/boost/container/new_allocator.hpp +7 -0
  135. data/src/cxx_supportlib/vendor-modified/boost/container/node_allocator.hpp +39 -33
  136. data/src/cxx_supportlib/vendor-modified/boost/container/options.hpp +156 -23
  137. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/global_resource.hpp +3 -3
  138. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/hub.hpp +43 -0
  139. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/memory_resource.hpp +5 -3
  140. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/monotonic_buffer_resource.hpp +1 -0
  141. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/polymorphic_allocator.hpp +1 -1
  142. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/resource_adaptor.hpp +4 -0
  143. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/segtor.hpp +45 -0
  144. data/src/cxx_supportlib/vendor-modified/boost/container/scoped_allocator.hpp +5 -4
  145. data/src/cxx_supportlib/vendor-modified/boost/container/segtor.hpp +905 -0
  146. data/src/cxx_supportlib/vendor-modified/boost/container/set.hpp +148 -35
  147. data/src/cxx_supportlib/vendor-modified/boost/container/slist.hpp +59 -52
  148. data/src/cxx_supportlib/vendor-modified/boost/container/small_vector.hpp +632 -5
  149. data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +66 -60
  150. data/src/cxx_supportlib/vendor-modified/boost/container/static_vector.hpp +46 -1
  151. data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +612 -317
  152. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator.hpp +54 -111
  153. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator_construction.hpp +100 -0
  154. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator_fwd.hpp +1 -3
  155. data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +233 -116
  156. data/src/cxx_supportlib/vendor-modified/boost/container_hash/hash.hpp +5 -1
  157. data/src/cxx_supportlib/vendor-modified/boost/core/lightweight_test.hpp +17 -10
  158. data/src/cxx_supportlib/vendor-modified/boost/date_time/period.hpp +1 -3
  159. data/src/cxx_supportlib/vendor-modified/boost/describe/detail/config.hpp +16 -0
  160. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/encoder.hpp +114 -0
  161. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/error_info_impl.hpp +4 -0
  162. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/requires_cxx11.hpp +1 -1
  163. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/type_info.hpp +211 -1
  164. data/src/cxx_supportlib/vendor-modified/boost/exception/diagnostic_information.hpp +59 -0
  165. data/src/cxx_supportlib/vendor-modified/boost/exception/exception.hpp +6 -0
  166. data/src/cxx_supportlib/vendor-modified/boost/exception/info.hpp +34 -0
  167. data/src/cxx_supportlib/vendor-modified/boost/intrusive/avltree.hpp +0 -1
  168. data/src/cxx_supportlib/vendor-modified/boost/intrusive/bstree.hpp +12 -3
  169. data/src/cxx_supportlib/vendor-modified/boost/intrusive/derivation_value_traits.hpp +1 -1
  170. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/ebo_functor_holder.hpp +29 -174
  171. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/generic_hook.hpp +18 -2
  172. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/key_nodeptr_comp.hpp +0 -1
  173. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/workaround.hpp +4 -5
  174. data/src/cxx_supportlib/vendor-modified/boost/intrusive/hashtable.hpp +20 -11
  175. data/src/cxx_supportlib/vendor-modified/boost/intrusive/list.hpp +42 -14
  176. data/src/cxx_supportlib/vendor-modified/boost/intrusive/slist.hpp +58 -22
  177. data/src/cxx_supportlib/vendor-modified/boost/intrusive/unordered_set.hpp +3 -1
  178. data/src/cxx_supportlib/vendor-modified/boost/iterator/advance.hpp +5 -1
  179. data/src/cxx_supportlib/vendor-modified/boost/iterator/distance.hpp +8 -2
  180. data/src/cxx_supportlib/vendor-modified/boost/iterator/is_iterator.hpp +9 -0
  181. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/bad_lexical_cast.hpp +11 -1
  182. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/buffer_view.hpp +9 -1
  183. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/config.hpp +22 -0
  184. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical.hpp +15 -7
  185. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +23 -11
  186. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_numeric.hpp +11 -1
  187. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/inf_nan.hpp +9 -1
  188. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/is_character.hpp +11 -2
  189. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp +10 -1
  190. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_char_constants.hpp +8 -1
  191. data/src/cxx_supportlib/vendor-modified/boost/{detail → lexical_cast/detail}/lcast_precision.hpp +13 -1
  192. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +11 -1
  193. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/widest_char.hpp +10 -2
  194. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/try_lexical_convert.hpp +15 -2
  195. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast.hpp +11 -1
  196. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/once_atomic.cpp +1 -1
  197. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/thread.cpp +48 -46
  198. data/src/cxx_supportlib/vendor-modified/boost/move/detail/meta_utils.hpp +23 -0
  199. data/src/cxx_supportlib/vendor-modified/boost/move/detail/move_helpers.hpp +24 -24
  200. data/src/cxx_supportlib/vendor-modified/boost/move/detail/nsec_clock.hpp +12 -4
  201. data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +76 -0
  202. data/src/cxx_supportlib/vendor-modified/boost/move/detail/workaround.hpp +1 -1
  203. data/src/cxx_supportlib/vendor-modified/boost/move/traits.hpp +11 -0
  204. data/src/cxx_supportlib/vendor-modified/boost/mp11/algorithm.hpp +58 -37
  205. data/src/cxx_supportlib/vendor-modified/boost/mp11/detail/mp_copy_if.hpp +1 -2
  206. data/src/cxx_supportlib/vendor-modified/boost/mp11/detail/mp_map_find.hpp +17 -9
  207. data/src/cxx_supportlib/vendor-modified/boost/mp11/detail/mp_remove_if.hpp +1 -2
  208. data/src/cxx_supportlib/vendor-modified/boost/mp11/integer_sequence.hpp +6 -0
  209. data/src/cxx_supportlib/vendor-modified/boost/mp11/version.hpp +1 -1
  210. data/src/cxx_supportlib/vendor-modified/boost/none_t.hpp +6 -1
  211. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_common_defs.hpp +188 -0
  212. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_factory_support.hpp +0 -6
  213. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_hash.hpp +1 -1
  214. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_nonmember_interface.hpp +117 -0
  215. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_reference_spec.hpp +108 -83
  216. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_relops.hpp +39 -39
  217. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_select_implementation.hpp +37 -0
  218. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_swap.hpp +1 -1
  219. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_trivially_copyable_base.hpp +8 -8
  220. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/union_optional.hpp +724 -0
  221. data/src/cxx_supportlib/vendor-modified/boost/optional/optional.hpp +93 -220
  222. data/src/cxx_supportlib/vendor-modified/boost/optional/optional_fwd.hpp +14 -4
  223. data/src/cxx_supportlib/vendor-modified/boost/optional/optional_io.hpp +1 -1
  224. data/src/cxx_supportlib/vendor-modified/boost/random/binomial_distribution.hpp +1 -1
  225. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_int_distribution.hpp +1 -1
  226. data/src/cxx_supportlib/vendor-modified/boost/rational.hpp +1 -1
  227. data/src/cxx_supportlib/vendor-modified/boost/static_assert.hpp +4 -6
  228. data/src/cxx_supportlib/vendor-modified/boost/system/api_config.hpp +1 -1
  229. data/src/cxx_supportlib/vendor-modified/boost/system/detail/config.hpp +16 -0
  230. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category.hpp +13 -13
  231. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category_impl.hpp +5 -5
  232. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/detail/sync_deque_base.hpp +3 -2
  233. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/detail/sync_queue_base.hpp +3 -2
  234. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/thread.hpp +2 -1
  235. data/src/cxx_supportlib/vendor-modified/boost/thread/experimental/parallel/v2/task_region.hpp +1 -1
  236. data/src/cxx_supportlib/vendor-modified/boost/thread/future.hpp +30 -28
  237. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/once.hpp +6 -3
  238. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/once_atomic.hpp +5 -1
  239. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/pthread_helpers.hpp +1 -0
  240. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/shared_mutex.hpp +16 -16
  241. data/src/cxx_supportlib/vendor-modified/boost/thread/v2/shared_mutex.hpp +26 -26
  242. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_map.hpp +196 -6
  243. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_set.hpp +191 -6
  244. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_node_map.hpp +196 -5
  245. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_node_set.hpp +192 -5
  246. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/concurrent_table.hpp +3 -3
  247. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/core.hpp +2 -2
  248. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/table.hpp +3 -3
  249. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/implementation.hpp +52 -16
  250. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/ranges_support.hpp +104 -0
  251. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/type_traits.hpp +1 -14
  252. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/unordered_printers.hpp +10 -4
  253. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map.hpp +121 -3
  254. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set.hpp +118 -3
  255. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map.hpp +338 -1
  256. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_map.hpp +121 -3
  257. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_set.hpp +118 -3
  258. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set.hpp +333 -1
  259. data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
  260. data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +276 -143
  261. data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +1262 -771
  262. data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +1704 -1586
  263. data/src/nginx_module/ContentHandler.c +35 -0
  264. data/src/ruby_supportlib/phusion_passenger/common_library.rb +6 -6
  265. data/src/ruby_supportlib/phusion_passenger/utils/json.rb +25 -2
  266. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +12 -1
  267. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  268. metadata +73 -8
  269. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_utility.hpp +0 -41
  270. /data/src/cxx_supportlib/{ServerKit/llhttp_http.c → vendor-copy/llhttp/http.c} +0 -0
@@ -40,6 +40,149 @@ namespace boost {
40
40
  namespace container {
41
41
  namespace dtl {
42
42
 
43
+
44
+ // Helper to generate masks (avoids shift overflow when N == bits_per_word)
45
+ template <typename SizeType, std::size_t N, std::size_t BitsPerWord>
46
+ struct packed_3n_mask_helper
47
+ {
48
+ BOOST_STATIC_CONSTEXPR SizeType low_mask = (SizeType(1) << N) - 1;
49
+ BOOST_STATIC_CONSTEXPR SizeType high_mask = low_mask << (BitsPerWord - N);
50
+ };
51
+
52
+ template <typename SizeType, std::size_t N>
53
+ struct packed_3n_mask_helper<SizeType, N, N>
54
+ {
55
+ BOOST_STATIC_CONSTEXPR SizeType low_mask = ~SizeType(0);
56
+ BOOST_STATIC_CONSTEXPR SizeType high_mask = ~SizeType(0);
57
+ };
58
+
59
+ // Reference-based packed bits view
60
+ // N = number of bits per segment (total storage = 3*N bits)
61
+ // SizeType must be unsigned
62
+ template <std::size_t N, typename SizeType = std::size_t>
63
+ class packed_3n_bits_ref
64
+ {
65
+ public:
66
+ typedef SizeType size_type;
67
+
68
+
69
+ BOOST_STATIC_CONSTEXPR std::size_t bits_per_word = sizeof(size_type) * CHAR_BIT;
70
+ BOOST_STATIC_CONSTEXPR std::size_t bits_per_segment = N;
71
+ BOOST_STATIC_CONSTEXPR std::size_t total_bits = 3 * N;
72
+ BOOST_STATIC_CONSTEXPR std::size_t top_shift = bits_per_word - N;
73
+
74
+ BOOST_CONTAINER_STATIC_ASSERT(sizeof(size_type)*CHAR_BIT >= total_bits);
75
+
76
+ private:
77
+ typedef packed_3n_mask_helper<size_type, N, bits_per_word> masks;
78
+ BOOST_CONTAINER_STATIC_ASSERT(N <= bits_per_word);
79
+
80
+ size_type& m_low;
81
+ size_type& m_high1;
82
+ size_type& m_high2;
83
+
84
+ public:
85
+ BOOST_STATIC_CONSTEXPR size_type low_mask = masks::low_mask;
86
+ BOOST_STATIC_CONSTEXPR size_type high_mask = masks::high_mask;
87
+
88
+ BOOST_STATIC_CONSTEXPR std::size_t remaining_bits_low = bits_per_word - N;
89
+ BOOST_STATIC_CONSTEXPR std::size_t remaining_bits_high = bits_per_word - N;
90
+
91
+ // Constructor takes references to three existing variables
92
+ packed_3n_bits_ref(size_type& low, size_type& high1, size_type& high2)
93
+ : m_low(low), m_high1(high1), m_high2(high2)
94
+ {}
95
+
96
+ void store(size_type value)
97
+ {
98
+ // Check that no bits are set outside the 3*N range
99
+ BOOST_ASSERT((value & ~size_type((1u << 3*N) - 1u)) == 0);
100
+
101
+ const size_type segment_mask = (size_type(1) << N) - 1;
102
+ const size_type seg0 = static_cast<size_type>(value & segment_mask);
103
+ const size_type seg1 = static_cast<size_type>((value >> N) & segment_mask);
104
+ const size_type seg2 = static_cast<size_type>((value >> (2 * N)) & segment_mask);
105
+
106
+ set_segment0(seg0);
107
+ set_segment1(seg1);
108
+ set_segment2(seg2);
109
+ }
110
+
111
+ size_type load() const
112
+ {
113
+ return static_cast<size_type>
114
+ ( (static_cast<size_type>(get_segment0()) << (0u*N))
115
+ | (static_cast<size_type>(get_segment1()) << (1u*N))
116
+ | (static_cast<size_type>(get_segment2()) << (2u*N))
117
+ );
118
+ }
119
+
120
+ void set_segment0(size_type value)
121
+ { m_low = (m_low & ~low_mask) | (value & low_mask); }
122
+
123
+ void set_segment1(size_type value)
124
+ { m_high1 = (m_high1 & ~high_mask) | ((value & low_mask) << top_shift); }
125
+
126
+ void set_segment2(size_type value)
127
+ { m_high2 = (m_high2 & ~high_mask) | ((value & low_mask) << top_shift); }
128
+
129
+ size_type get_segment0() const
130
+ { return m_low & low_mask; }
131
+
132
+ size_type get_segment1() const
133
+ { return (m_high1 & high_mask) >> top_shift; }
134
+
135
+ size_type get_segment2() const
136
+ { return (m_high2 & high_mask) >> top_shift; }
137
+
138
+ size_type low_unpacked() const
139
+ { return m_low & ~low_mask; }
140
+
141
+ size_type high1_unpacked() const
142
+ { return m_high1 & ~high_mask; }
143
+
144
+ size_type high2_unpacked() const
145
+ { return m_high2 & ~high_mask; }
146
+
147
+ void set_low_unpacked(size_type value)
148
+ {
149
+ BOOST_ASSERT((value & low_mask) == 0);
150
+ m_low = (m_low & low_mask) | value;
151
+ }
152
+
153
+ void set_high1_unpacked(size_type value)
154
+ {
155
+ BOOST_ASSERT((value & high_mask) == 0);
156
+ m_high1 = (m_high1 & high_mask) | value;
157
+ }
158
+
159
+ void set_high2_unpacked(size_type value)
160
+ {
161
+ BOOST_ASSERT((value & high_mask) == 0);
162
+ m_high2 = (m_high2 & high_mask) | value;
163
+ }
164
+
165
+ size_type& raw_low() { return m_low; }
166
+ size_type raw_low() const { return m_low; }
167
+
168
+ size_type& raw_high1() { return m_high1; }
169
+ size_type raw_high1() const { return m_high1; }
170
+
171
+ size_type& raw_high2() { return m_high2; }
172
+ size_type raw_high2() const { return m_high2; }
173
+
174
+ packed_3n_bits_ref(const packed_3n_bits_ref& v)
175
+ : m_low(v.m_low), m_high1(v.m_high1), m_high2(v.m_high2)
176
+ {}
177
+ private:
178
+
179
+ //packed_3n_bits_ref& operator=(const packed_3n_bits_ref&);
180
+ };
181
+
182
+ //This class uses packed_3n_bits_ref to store overalignment
183
+ //values maintatin the ABI, since ABI-sensitive libraries like Interprocess
184
+ //rely on this type and types without overalignment must continue working
185
+ //as before.
43
186
  template<class SegmentManagerBase>
44
187
  class private_node_pool_impl
45
188
  {
@@ -52,17 +195,26 @@ class private_node_pool_impl
52
195
  public:
53
196
  typedef typename SegmentManagerBase::void_pointer void_pointer;
54
197
  typedef typename node_slist<void_pointer>::slist_hook_t slist_hook_t;
55
- typedef typename node_slist<void_pointer>::node_t node_t;
198
+ typedef typename node_slist<void_pointer>::node_t list_node_t;
56
199
  typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t;
57
200
  typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
58
201
  typedef typename SegmentManagerBase::size_type size_type;
59
202
 
60
203
  private:
204
+ BOOST_STATIC_CONSTEXPR size_type list_node_align = alignment_of<list_node_t>::value;
205
+ BOOST_STATIC_CONSTEXPR size_type list_node_align_bits
206
+ = boost::container::dtl::log2_pow2<list_node_align>::value;
207
+
208
+ //Make sure we can use at least the lowest 2 bits for other purposes
209
+ BOOST_CONTAINER_STATIC_ASSERT(list_node_align_bits >= 2u);
210
+
61
211
  typedef typename bi::make_slist
62
- < node_t, bi::base_hook<slist_hook_t>
212
+ < list_node_t, bi::base_hook<slist_hook_t>
63
213
  , bi::linear<true>
64
214
  , bi::constant_time_size<false> >::type blockslist_t;
65
215
 
216
+ typedef packed_3n_bits_ref<list_node_align_bits, size_type> packed_3n_bits_ref_t;
217
+
66
218
  static size_type get_rounded_size(size_type orig_size, size_type round_to)
67
219
  { return ((orig_size-1)/round_to+1)*round_to; }
68
220
 
@@ -72,23 +224,62 @@ class private_node_pool_impl
72
224
  typedef SegmentManagerBase segment_manager_base_type;
73
225
 
74
226
  //!Constructor from a segment manager. Never throws
75
- private_node_pool_impl(segment_manager_base_type *segment_mngr_base, size_type node_size, size_type nodes_per_block)
76
- : m_nodes_per_block(nodes_per_block)
77
- , m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value)))
78
- //General purpose allocator
79
- , mp_segment_mngr_base(segment_mngr_base)
80
- , m_blocklist()
81
- , m_freelist()
82
- //Debug node count
83
- , m_allocated(0)
84
- {}
227
+ private_node_pool_impl(segment_manager_base_type *segment_mngr_base, size_type node_size, size_type nodes_per_block, size_type node_alignment)
228
+ : m_nodes_per_block(0)
229
+ , m_real_node_size(0)
230
+ , mp_segment_mngr_base(segment_mngr_base)
231
+ , m_blocklist()
232
+ , m_freelist()
233
+ , m_allocated()
234
+ {
235
+ BOOST_ASSERT(0 == (node_alignment & (node_alignment - 1u))); //node_alignment must be power of two
236
+ //node_size must be able to hold a list_node_t
237
+ node_size = node_size < sizeof(list_node_t) ? sizeof(list_node_t) : node_size;
238
+
239
+ //node_size must be multiple of list_node_t alignment because each node must be store it in that node address
240
+ node_size = get_rounded_size(node_size, list_node_align);
241
+
242
+ //node_size must be multiple of node_alignment
243
+ if(node_alignment < list_node_align)
244
+ node_alignment = list_node_align;
245
+ else if(node_alignment > list_node_align)
246
+ node_size = get_rounded_size(node_size, node_alignment);
247
+
248
+ //We'll use log2(list_node_align) bits from m_real_node_size, m_nodes_per_block and m_allocated
249
+ //to store the overaligned state
250
+ //Thus, the maximum alignment that we support is list_node_align << 2*(list_node_align - 1)
251
+ // - if list_node_align is 4, we can support up to 4 << 2^(3*2)-1 -> 4 << 63
252
+ // - if list_node_align is 8, we can support up to 8 << 2^(3*3)-1 -> 8 << 255
253
+ const size_type aligned_multiplier = node_alignment / list_node_align;
254
+ const size_type aligned_shift = log2_ceil<size_type>(aligned_multiplier);
255
+ BOOST_CONSTEXPR_OR_CONST size_type max_aligned_shift = std::size_t((1u << 3u*list_node_align_bits) - 1);
256
+ if (aligned_shift > max_aligned_shift) {
257
+ BOOST_ASSERT(aligned_shift <= max_aligned_shift); //Unsupported alignment
258
+ mp_segment_mngr_base = segment_mngr_base_ptr_t(); //Will crash on allocation
259
+ }
260
+
261
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
262
+ packer.store(aligned_shift);
263
+ packer.set_low_unpacked(node_size);
264
+ packer.set_high1_unpacked(nodes_per_block);
265
+ packer.set_high2_unpacked(0);
266
+ }
85
267
 
86
268
  //!Destructor. Deallocates all allocated blocks. Never throws
87
269
  inline ~private_node_pool_impl()
88
270
  { this->purge_blocks(); }
89
271
 
90
272
  inline size_type get_real_num_node() const
91
- { return m_nodes_per_block; }
273
+ {
274
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
275
+ return packer.high1_unpacked();
276
+ }
277
+
278
+ inline size_type get_real_node_size() const
279
+ {
280
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
281
+ return packer.low_unpacked();
282
+ }
92
283
 
93
284
  //!Returns the segment manager. Never throws
94
285
  inline segment_manager_base_type* get_segment_manager_base()const
@@ -104,10 +295,14 @@ class private_node_pool_impl
104
295
  //!Allocates a singly linked list of n nodes ending in null pointer.
105
296
  void allocate_nodes(const size_type n, multiallocation_chain &chain)
106
297
  {
298
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
299
+ size_type allocated = packer.high2_unpacked();
300
+ size_type nodes_per_block = packer.high1_unpacked();
301
+
107
302
  //Preallocate all needed blocks to fulfill the request
108
303
  size_type cur_nodes = m_freelist.size();
109
304
  if(cur_nodes < n){
110
- this->priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
305
+ this->priv_alloc_block(((n - cur_nodes) - 1)/nodes_per_block + 1);
111
306
  }
112
307
 
113
308
  //We just iterate the needed nodes to get the last we'll erase
@@ -129,7 +324,8 @@ class private_node_pool_impl
129
324
  //Now take the last erased node and just splice it in the end
130
325
  //of the intrusive list that will be traversed by the multialloc iterator.
131
326
  chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n);
132
- m_allocated += n;
327
+ allocated += n;
328
+ packer.set_high2_unpacked(allocated);
133
329
  }
134
330
 
135
331
  void deallocate_nodes(multiallocation_chain &chain)
@@ -154,8 +350,11 @@ class private_node_pool_impl
154
350
  nodelist_iterator backup_list_last = backup_list.before_begin();
155
351
 
156
352
  //Execute the algorithm and get an iterator to the last value
157
- size_type blocksize = (get_rounded_size)
158
- (m_real_node_size*m_nodes_per_block, (size_type) alignment_of<node_t>::value);
353
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
354
+ size_type real_node_size = packer.low_unpacked();
355
+ size_type nodes_per_block = packer.high1_unpacked();
356
+
357
+ size_type blocksize = real_node_size*nodes_per_block;
159
358
 
160
359
  while(it != itend){
161
360
  //Collect all the nodes from the block pointed by it
@@ -167,9 +366,9 @@ class private_node_pool_impl
167
366
  m_freelist.remove_and_dispose_if
168
367
  (is_between(addr, blocksize), push_in_list(free_nodes, last_it));
169
368
 
170
- //If the number of nodes is equal to m_nodes_per_block
369
+ //If the number of nodes is equal to nodes_per_block
171
370
  //this means that the block can be deallocated
172
- if(free_nodes.size() == m_nodes_per_block){
371
+ if(free_nodes.size() == nodes_per_block){
173
372
  //Unlink the nodes
174
373
  free_nodes.clear();
175
374
  it = m_blocklist.erase_after(bit);
@@ -212,10 +411,14 @@ class private_node_pool_impl
212
411
  //!already be deallocated. Otherwise, undefined behaviour. Never throws
213
412
  void purge_blocks()
214
413
  {
414
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
415
+ size_type real_node_size = packer.low_unpacked();
416
+ size_type nodes_per_block = packer.high1_unpacked();
417
+ size_type allocated = packer.high2_unpacked();
418
+
215
419
  //check for memory leaks
216
- BOOST_ASSERT(m_allocated==0);
217
- size_type blocksize = (get_rounded_size)
218
- (m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
420
+ BOOST_ASSERT(allocated == 0); (void)allocated;
421
+ const size_type blocksize = real_node_size * nodes_per_block;
219
422
 
220
423
  //We iterate though the NodeBlock list to free the memory
221
424
  while(!m_blocklist.empty()){
@@ -229,8 +432,8 @@ class private_node_pool_impl
229
432
 
230
433
  void swap(private_node_pool_impl &other)
231
434
  {
232
- BOOST_ASSERT(m_nodes_per_block == other.m_nodes_per_block);
233
- BOOST_ASSERT(m_real_node_size == other.m_real_node_size);
435
+ BOOST_ASSERT(this->get_real_node_size() == other.get_real_node_size());
436
+ BOOST_ASSERT(this->get_real_num_node() == other.get_real_num_node());
234
437
  std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
235
438
  m_blocklist.swap(other.m_blocklist);
236
439
  m_freelist.swap(other.m_freelist);
@@ -279,15 +482,19 @@ class private_node_pool_impl
279
482
 
280
483
  //!Allocates one node, using single segregated storage algorithm.
281
484
  //!Never throws
282
- node_t *priv_alloc_node()
485
+ list_node_t *priv_alloc_node()
283
486
  {
284
487
  //If there are no free nodes we allocate a new block
285
488
  if (m_freelist.empty())
286
489
  this->priv_alloc_block(1);
287
490
  //We take the first free node
288
- node_t *n = (node_t*)&m_freelist.front();
491
+ list_node_t *n = (list_node_t*)&m_freelist.front();
289
492
  m_freelist.pop_front();
290
- ++m_allocated;
493
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
494
+ size_type allocated = packer.high2_unpacked();
495
+
496
+ ++allocated;
497
+ packer.set_high2_unpacked(allocated);
291
498
  return n;
292
499
  }
293
500
 
@@ -296,32 +503,40 @@ class private_node_pool_impl
296
503
  void priv_dealloc_node(void *pElem)
297
504
  {
298
505
  //We put the node at the beginning of the free node list
299
- node_t * to_deallocate = static_cast<node_t*>(pElem);
506
+ list_node_t * to_deallocate = static_cast<list_node_t*>(pElem);
300
507
  m_freelist.push_front(*to_deallocate);
301
- BOOST_ASSERT(m_allocated>0);
302
- --m_allocated;
508
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
509
+ size_type allocated = packer.high2_unpacked();
510
+ BOOST_ASSERT(allocated>0);
511
+ --allocated;
512
+ packer.set_high2_unpacked(allocated);
303
513
  }
304
514
 
305
515
  //!Allocates several blocks of nodes. Can throw
306
516
  void priv_alloc_block(size_type num_blocks)
307
517
  {
308
518
  BOOST_ASSERT(num_blocks > 0);
309
- size_type blocksize =
310
- (get_rounded_size)(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
519
+
520
+ packed_3n_bits_ref_t packer(m_real_node_size, m_nodes_per_block, m_allocated);
521
+ size_type real_node_size = packer.low_unpacked();
522
+ size_type nodes_per_block = packer.high1_unpacked();
523
+ size_type mem_alignment = list_node_align << packer.load();
524
+
525
+ const size_type blocksize = real_node_size * nodes_per_block;
311
526
 
312
527
  BOOST_CONTAINER_TRY{
313
528
  for(size_type i = 0; i != num_blocks; ++i){
314
529
  //We allocate a new NodeBlock and put it as first
315
530
  //element in the free Node list
316
531
  char *pNode = reinterpret_cast<char*>
317
- (mp_segment_mngr_base->allocate(blocksize + sizeof(node_t)));
532
+ (mp_segment_mngr_base->allocate_aligned(blocksize + sizeof(list_node_t), mem_alignment));
318
533
  char *pBlock = pNode;
319
534
  m_blocklist.push_front(get_block_hook(pBlock, blocksize));
320
535
 
321
536
  //We initialize all Nodes in Node Block to insert
322
537
  //them in the free Node list
323
- for(size_type j = 0; j < m_nodes_per_block; ++j, pNode += m_real_node_size){
324
- m_freelist.push_front(*new (pNode) node_t);
538
+ for(size_type j = 0; j < nodes_per_block; ++j, pNode += real_node_size){
539
+ m_freelist.push_front(*new (pNode) list_node_t);
325
540
  }
326
541
  }
327
542
  }
@@ -342,13 +557,13 @@ class private_node_pool_impl
342
557
 
343
558
  private:
344
559
  //!Returns a reference to the block hook placed in the end of the block
345
- static node_t & get_block_hook (void *block, size_type blocksize)
560
+ static list_node_t & get_block_hook (void *block, size_type blocksize)
346
561
  {
347
- return *move_detail::force_ptr<node_t*>(reinterpret_cast<char*>(block) + blocksize);
562
+ return *move_detail::force_ptr<list_node_t*>(reinterpret_cast<char*>(block) + blocksize);
348
563
  }
349
564
 
350
565
  //!Returns the starting address of the block reference to the block hook placed in the end of the block
351
- void *get_block_from_hook (node_t *hook, size_type blocksize)
566
+ void *get_block_from_hook (list_node_t *hook, size_type blocksize)
352
567
  {
353
568
  return (reinterpret_cast<char*>(hook) - blocksize);
354
569
  }
@@ -357,12 +572,12 @@ class private_node_pool_impl
357
572
  typedef typename boost::intrusive::pointer_traits
358
573
  <void_pointer>::template rebind_pointer<segment_manager_base_type>::type segment_mngr_base_ptr_t;
359
574
 
360
- const size_type m_nodes_per_block;
361
- const size_type m_real_node_size;
575
+ mutable size_type m_nodes_per_block;
576
+ mutable size_type m_real_node_size;
362
577
  segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
363
578
  blockslist_t m_blocklist; //Intrusive container of blocks
364
579
  free_nodes_t m_freelist; //Intrusive container of free nods
365
- size_type m_allocated; //Used nodes for debugging
580
+ mutable size_type m_allocated; //Used nodes for debugging
366
581
  };
367
582
 
368
583
 
@@ -20,47 +20,98 @@
20
20
 
21
21
  #include <boost/container/detail/std_fwd.hpp>
22
22
  #include <boost/container/throw_exception.hpp>
23
+ #include <boost/container/detail/type_traits.hpp>
24
+
25
+ #if !defined(__cpp_aligned_new)
26
+ #include <boost/container/detail/aligned_allocation.hpp>
27
+ #endif
23
28
 
24
29
  namespace boost {
25
30
  namespace container {
26
31
  namespace dtl {
27
32
 
28
- template <class T>
29
- T* operator_new_allocate(std::size_t count)
33
+ //For GCC and clang there are several cases where __STDCPP_DEFAULT_NEW_ALIGNMENT__
34
+ //is not properly synchronized with the default alignment of malloc. Examples:
35
+ //
36
+ // - On Unix platforms, a programmer uses jemalloc, mimalloc that have historically a lower
37
+ // default alignment (to waste less memory)
38
+ //
39
+ // - On Windows platforms, the allocator is provided by MSVCRT o UCRT that uses HeapAlloc
40
+ // (e.g. 8 byte alignment for x86 and 16 bytes for x64)
41
+ //
42
+ // - On Apple platforms the default malloc implementation has a reduced defaykt alignment
43
+ // even on ARM64 platforms.
44
+ BOOST_CONTAINER_FORCEINLINE bool operator_new_raw_overaligned(std::size_t alignment)
30
45
  {
31
- const std::size_t max_count = std::size_t(-1)/(2*sizeof(T));
32
- if(BOOST_UNLIKELY(count > max_count))
33
- throw_bad_alloc();
34
- #if defined(__cpp_aligned_new)
35
- BOOST_IF_CONSTEXPR(__STDCPP_DEFAULT_NEW_ALIGNMENT__ < alignof(T)) {
36
- return static_cast<T*>(::operator new(count*sizeof(T), std::align_val_t(alignof(T))));
37
- }
46
+ //In MacOs, the default allocator can return data aligned to 8 bytes
47
+ #if defined(__APPLE__)
48
+ return alignment > 8u;
49
+ //GCC-clang on Mingw-w64 has problems with malloc (MSVCRT / UCRT) alignment not matching
50
+ //__STDCPP_DEFAULT_NEW_ALIGNMENT__, since HeapAlloc alignment is 8 for 32 bit targets
51
+ #elif !defined(__cpp_aligned_new) || (defined(_WIN32) && !defined(_WIN64) && !defined(_MSC_VER))
52
+ return alignment > 2*sizeof(void*);
53
+ #else
54
+ return alignment > __STDCPP_DEFAULT_NEW_ALIGNMENT__;
38
55
  #endif
39
- return static_cast<T*>(::operator new(count*sizeof(T)));
40
56
  }
41
57
 
42
- template <class T>
43
- void operator_delete_deallocate(T* ptr, std::size_t n) BOOST_NOEXCEPT_OR_NOTHROW
58
+ BOOST_CONTAINER_FORCEINLINE void* operator_new_raw_allocate(const std::size_t size, const std::size_t alignment)
44
59
  {
45
- (void)n;
46
- #ifdef __cpp_aligned_new
47
- BOOST_IF_CONSTEXPR(__STDCPP_DEFAULT_NEW_ALIGNMENT__ < alignof(T)) {
60
+ (void)alignment;
61
+ if(operator_new_raw_overaligned(alignment)) {
62
+ #if defined(__cpp_aligned_new)
63
+ return ::operator new(size, std::align_val_t(alignment));
64
+ #else
65
+ //C++ requires zero-sized allocations to return a non-null pointer
66
+ return aligned_allocate(alignment, !size ? 1 : size);
67
+ #endif
68
+ }
69
+ else{
70
+ return ::operator new(size);
71
+ }
72
+ }
73
+
74
+ BOOST_CONTAINER_FORCEINLINE void operator_delete_raw_deallocate
75
+ (void* const ptr, const std::size_t size, const std::size_t alignment) BOOST_NOEXCEPT_OR_NOTHROW
76
+ {
77
+ (void)size;
78
+ (void)alignment;
79
+ if(operator_new_raw_overaligned(alignment)) {
80
+ #if defined(__cpp_aligned_new)
81
+ # if defined(__cpp_sized_deallocation)
82
+ ::operator delete(ptr, size, std::align_val_t(alignment));
83
+ #else
84
+ ::operator delete(ptr, std::align_val_t(alignment));
85
+ # endif
86
+ #else
87
+ aligned_deallocate(ptr);
88
+ #endif
89
+ }
90
+ else {
48
91
  # if defined(__cpp_sized_deallocation)
49
- ::operator delete((void*)ptr, n * sizeof(T), std::align_val_t(alignof(T)));
92
+ ::operator delete(ptr, size);
50
93
  #else
51
- ::operator delete((void*)ptr, std::align_val_t(alignof(T)));
94
+ ::operator delete(ptr);
52
95
  # endif
53
- return;
54
96
  }
55
- #endif
97
+ }
56
98
 
57
- # if defined(__cpp_sized_deallocation)
58
- ::operator delete((void*)ptr, n * sizeof(T));
59
- #else
60
- ::operator delete((void*)ptr);
61
- # endif
99
+ template <class T>
100
+ BOOST_CONTAINER_FORCEINLINE T* operator_new_allocate(std::size_t count)
101
+ {
102
+ const std::size_t max_count = std::size_t(-1)/(2*sizeof(T));
103
+ if(BOOST_UNLIKELY(count > max_count))
104
+ throw_bad_alloc();
105
+ return static_cast<T*>(operator_new_raw_allocate(count*sizeof(T), alignment_of<T>::value));
106
+ }
107
+
108
+ template <class T>
109
+ BOOST_CONTAINER_FORCEINLINE void operator_delete_deallocate(T* ptr, std::size_t n) BOOST_NOEXCEPT_OR_NOTHROW
110
+ {
111
+ operator_delete_raw_deallocate((void*)ptr, n * sizeof(T), alignment_of<T>::value);
62
112
  }
63
113
 
114
+
64
115
  } //namespace dtl {
65
116
  } //namespace container {
66
117
  } //namespace boost {
@@ -500,14 +500,6 @@ struct is_class_or_union< ::boost::container::dtl::pair<T1, T2> >
500
500
  BOOST_STATIC_CONSTEXPR bool value = true;
501
501
  };
502
502
 
503
- template <class T1, class T2>
504
- struct is_class_or_union< std::pair<T1, T2> >
505
- //This specialization is needed to avoid instantiation of pair in
506
- //is_class, and allow recursive maps.
507
- {
508
- BOOST_STATIC_CONSTEXPR bool value = true;
509
- };
510
-
511
503
  template<class T>
512
504
  struct is_union;
513
505
 
@@ -519,14 +511,6 @@ struct is_union< ::boost::container::dtl::pair<T1, T2> >
519
511
  BOOST_STATIC_CONSTEXPR bool value = false;
520
512
  };
521
513
 
522
- template <class T1, class T2>
523
- struct is_union< std::pair<T1, T2> >
524
- //This specialization is needed to avoid instantiation of pair in
525
- //is_class, and allow recursive maps.
526
- {
527
- BOOST_STATIC_CONSTEXPR bool value = false;
528
- };
529
-
530
514
  template<class T>
531
515
  struct is_class;
532
516
 
@@ -538,16 +522,8 @@ struct is_class< ::boost::container::dtl::pair<T1, T2> >
538
522
  BOOST_STATIC_CONSTEXPR bool value = true;
539
523
  };
540
524
 
541
- template <class T1, class T2>
542
- struct is_class< std::pair<T1, T2> >
543
- //This specialization is needed to avoid instantiation of pair in
544
- //is_class, and allow recursive maps.
545
- {
546
- BOOST_STATIC_CONSTEXPR bool value = true;
547
- };
548
-
549
-
550
525
  //Triviality of pair
526
+ // std::pair specializations defined in Boost.Move
551
527
 
552
528
  //
553
529
  // is_trivially_copy_assignable
@@ -563,11 +539,6 @@ struct is_trivially_copy_assignable<boost::container::dtl::pair<A,B> >
563
539
  boost::move_detail::is_trivially_copy_assignable<B>::value;
564
540
  };
565
541
 
566
- template<class A, class B>
567
- struct is_trivially_copy_assignable<std::pair<A,B> >
568
- : is_trivially_copy_assignable<boost::container::dtl::pair<A,B> >
569
- {};
570
-
571
542
  //
572
543
  // is_trivially_move_assignable
573
544
  //
@@ -582,12 +553,6 @@ struct is_trivially_move_assignable<boost::container::dtl::pair<A,B> >
582
553
  boost::move_detail::is_trivially_move_assignable<B>::value;
583
554
  };
584
555
 
585
- template<class A, class B>
586
- struct is_trivially_move_assignable<std::pair<A,B> >
587
- : is_trivially_move_assignable<boost::container::dtl::pair<A,B> >
588
- {};
589
-
590
-
591
556
  //
592
557
  // is_trivially_copy_constructible
593
558
  //
@@ -602,11 +567,6 @@ struct is_trivially_copy_constructible<boost::container::dtl::pair<A,B> >
602
567
  boost::move_detail::is_trivially_copy_constructible<B>::value;
603
568
  };
604
569
 
605
- template<class A, class B>
606
- struct is_trivially_copy_constructible<std::pair<A,B> >
607
- : is_trivially_copy_constructible<boost::container::dtl::pair<A,B> >
608
- {};
609
-
610
570
  //
611
571
  // is_trivially_move_constructible
612
572
  //
@@ -621,11 +581,6 @@ struct is_trivially_move_constructible<boost::container::dtl::pair<A,B> >
621
581
  boost::move_detail::is_trivially_move_constructible<B>::value;
622
582
  };
623
583
 
624
- template<class A, class B>
625
- struct is_trivially_move_constructible<std::pair<A,B> >
626
- : is_trivially_move_constructible<boost::container::dtl::pair<A,B> >
627
- {};
628
-
629
584
  template<class T>
630
585
  struct is_trivially_destructible;
631
586
 
@@ -636,11 +591,6 @@ struct is_trivially_destructible<boost::container::dtl::pair<A,B> >
636
591
  boost::move_detail::is_trivially_destructible<B>::value;
637
592
  };
638
593
 
639
- template<class A, class B>
640
- struct is_trivially_destructible<std::pair<A,B> >
641
- : is_trivially_destructible<boost::container::dtl::pair<A,B> >
642
- {};
643
-
644
594
  } //namespace move_detail{
645
595
 
646
596
  template<class T>
@@ -653,11 +603,6 @@ struct has_trivial_destructor_after_move<boost::container::dtl::pair<A,B> >
653
603
  boost::has_trivial_destructor_after_move<B>::value;
654
604
  };
655
605
 
656
- template<class A, class B>
657
- struct has_trivial_destructor_after_move<std::pair<A,B> >
658
- : has_trivial_destructor_after_move<boost::container::dtl::pair<A,B> >
659
- {};
660
-
661
606
  } //namespace boost {
662
607
 
663
608
  #include <boost/container/detail/config_end.hpp>