grpc 1.71.0 → 1.74.0

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 (1726) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +129 -88
  3. data/include/grpc/create_channel_from_endpoint.h +54 -0
  4. data/include/grpc/credentials.h +11 -5
  5. data/include/grpc/event_engine/event_engine.h +182 -8
  6. data/include/grpc/event_engine/internal/write_event.h +34 -0
  7. data/include/grpc/event_engine/memory_request.h +3 -3
  8. data/include/grpc/grpc_posix.h +20 -1
  9. data/include/grpc/impl/channel_arg_names.h +81 -55
  10. data/include/grpc/impl/compression_types.h +3 -2
  11. data/include/grpc/impl/slice_type.h +1 -1
  12. data/include/grpc/module.modulemap +1 -0
  13. data/include/grpc/support/json.h +27 -21
  14. data/include/grpc/support/port_platform.h +8 -5
  15. data/include/grpc/support/workaround_list.h +1 -4
  16. data/src/core/{lib/transport → call}/call_arena_allocator.cc +1 -1
  17. data/src/core/{lib/transport → call}/call_arena_allocator.h +3 -3
  18. data/src/core/{lib/transport → call}/call_destination.h +4 -4
  19. data/src/core/{lib/transport → call}/call_filters.cc +2 -2
  20. data/src/core/{lib/transport → call}/call_filters.h +53 -25
  21. data/src/core/{lib/channel → call}/call_finalization.h +3 -3
  22. data/src/core/{lib/transport → call}/call_spine.cc +1 -1
  23. data/src/core/{lib/transport → call}/call_spine.h +70 -26
  24. data/src/core/{lib/transport → call}/call_state.cc +1 -1
  25. data/src/core/{lib/transport → call}/call_state.h +3 -3
  26. data/src/core/{lib/surface → call}/client_call.cc +9 -7
  27. data/src/core/{lib/surface → call}/client_call.h +4 -4
  28. data/src/core/{lib/transport → call}/custom_metadata.h +3 -3
  29. data/src/core/{lib/transport → call}/interception_chain.cc +5 -5
  30. data/src/core/{lib/transport → call}/interception_chain.h +14 -18
  31. data/src/core/{lib/transport → call}/message.cc +1 -1
  32. data/src/core/{lib/transport → call}/message.h +7 -3
  33. data/src/core/{lib/transport → call}/metadata.cc +2 -2
  34. data/src/core/{lib/transport → call}/metadata.h +21 -4
  35. data/src/core/{lib/transport → call}/metadata_batch.cc +1 -1
  36. data/src/core/{lib/transport → call}/metadata_batch.h +7 -7
  37. data/src/core/{lib/transport → call}/metadata_compression_traits.h +3 -3
  38. data/src/core/{lib/transport → call}/metadata_info.cc +27 -9
  39. data/src/core/{lib/transport → call}/metadata_info.h +4 -4
  40. data/src/core/{lib/transport → call}/parsed_metadata.cc +1 -1
  41. data/src/core/{lib/transport → call}/parsed_metadata.h +3 -3
  42. data/src/core/call/request_buffer.h +3 -3
  43. data/src/core/call/security_context.cc +125 -0
  44. data/src/core/call/security_context.h +114 -0
  45. data/src/core/{lib/surface → call}/server_call.cc +3 -3
  46. data/src/core/{lib/surface → call}/server_call.h +5 -5
  47. data/src/core/{lib/transport → call}/simple_slice_based_metadata.h +4 -4
  48. data/src/core/{lib/channel → call}/status_util.cc +1 -1
  49. data/src/core/{lib/channel → call}/status_util.h +3 -3
  50. data/src/core/channelz/channel_trace.cc +217 -111
  51. data/src/core/channelz/channel_trace.h +389 -64
  52. data/src/core/channelz/channelz.cc +480 -178
  53. data/src/core/channelz/channelz.h +426 -71
  54. data/src/core/channelz/channelz_registry.cc +323 -117
  55. data/src/core/channelz/channelz_registry.h +203 -21
  56. data/src/core/channelz/property_list.cc +357 -0
  57. data/src/core/channelz/property_list.h +202 -0
  58. data/src/core/channelz/ztrace_collector.h +316 -0
  59. data/src/core/client_channel/backup_poller.cc +17 -2
  60. data/src/core/client_channel/client_channel.cc +66 -68
  61. data/src/core/client_channel/client_channel.h +4 -3
  62. data/src/core/client_channel/client_channel_filter.cc +45 -64
  63. data/src/core/client_channel/client_channel_filter.h +1 -3
  64. data/src/core/client_channel/client_channel_internal.h +1 -1
  65. data/src/core/client_channel/config_selector.h +10 -4
  66. data/src/core/client_channel/connector.h +0 -3
  67. data/src/core/client_channel/direct_channel.cc +2 -2
  68. data/src/core/client_channel/dynamic_filters.cc +5 -7
  69. data/src/core/client_channel/dynamic_filters.h +1 -2
  70. data/src/core/client_channel/global_subchannel_pool.cc +71 -7
  71. data/src/core/client_channel/global_subchannel_pool.h +37 -4
  72. data/src/core/client_channel/lb_metadata.h +1 -1
  73. data/src/core/client_channel/load_balanced_call_destination.cc +1 -1
  74. data/src/core/client_channel/load_balanced_call_destination.h +1 -1
  75. data/src/core/client_channel/retry_filter.cc +21 -27
  76. data/src/core/client_channel/retry_filter.h +10 -7
  77. data/src/core/client_channel/retry_filter_legacy_call_data.cc +48 -46
  78. data/src/core/client_channel/retry_filter_legacy_call_data.h +7 -7
  79. data/src/core/client_channel/retry_interceptor.cc +30 -44
  80. data/src/core/client_channel/retry_interceptor.h +19 -18
  81. data/src/core/client_channel/retry_service_config.cc +1 -1
  82. data/src/core/client_channel/retry_service_config.h +1 -1
  83. data/src/core/client_channel/retry_throttle.cc +42 -61
  84. data/src/core/client_channel/retry_throttle.h +21 -35
  85. data/src/core/client_channel/subchannel.cc +57 -36
  86. data/src/core/client_channel/subchannel.h +11 -10
  87. data/src/core/client_channel/subchannel_pool_interface.cc +5 -6
  88. data/src/core/client_channel/subchannel_pool_interface.h +11 -1
  89. data/src/core/client_channel/subchannel_stream_client.cc +14 -11
  90. data/src/core/client_channel/subchannel_stream_client.h +2 -2
  91. data/src/core/config/config_vars.cc +13 -1
  92. data/src/core/config/config_vars.h +8 -0
  93. data/src/core/config/core_configuration.cc +51 -11
  94. data/src/core/config/core_configuration.h +102 -9
  95. data/src/core/credentials/call/call_credentials.h +157 -0
  96. data/src/core/credentials/call/call_creds_registry.h +125 -0
  97. data/src/core/credentials/call/call_creds_registry_init.cc +91 -0
  98. data/src/core/{lib/security/credentials → credentials/call}/call_creds_util.cc +4 -4
  99. data/src/core/{lib/security/credentials → credentials/call}/call_creds_util.h +4 -4
  100. data/src/core/{lib/security/credentials/composite/composite_credentials.cc → credentials/call/composite/composite_call_credentials.cc} +4 -57
  101. data/src/core/credentials/call/composite/composite_call_credentials.h +82 -0
  102. data/src/core/{lib/security/credentials → credentials/call}/external/aws_external_account_credentials.cc +2 -2
  103. data/src/core/{lib/security/credentials → credentials/call}/external/aws_external_account_credentials.h +5 -5
  104. data/src/core/{lib/security/credentials → credentials/call}/external/aws_request_signer.cc +4 -3
  105. data/src/core/{lib/security/credentials → credentials/call}/external/aws_request_signer.h +3 -3
  106. data/src/core/{lib/security/credentials → credentials/call}/external/external_account_credentials.cc +6 -6
  107. data/src/core/{lib/security/credentials → credentials/call}/external/external_account_credentials.h +5 -5
  108. data/src/core/{lib/security/credentials → credentials/call}/external/file_external_account_credentials.cc +1 -1
  109. data/src/core/{lib/security/credentials → credentials/call}/external/file_external_account_credentials.h +4 -4
  110. data/src/core/{lib/security/credentials → credentials/call}/external/url_external_account_credentials.cc +5 -4
  111. data/src/core/{lib/security/credentials → credentials/call}/external/url_external_account_credentials.h +4 -4
  112. data/src/core/{lib/security/credentials → credentials/call}/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +10 -51
  113. data/src/core/{lib/security/credentials → credentials/call}/gcp_service_account_identity/gcp_service_account_identity_credentials.h +6 -6
  114. data/src/core/{lib/security/credentials → credentials/call}/iam/iam_credentials.cc +2 -2
  115. data/src/core/{lib/security/credentials → credentials/call}/iam/iam_credentials.h +4 -4
  116. data/src/core/{lib/security/util → credentials/call}/json_util.cc +1 -1
  117. data/src/core/{lib/security/util → credentials/call}/json_util.h +3 -3
  118. data/src/core/{lib/security/credentials → credentials/call}/jwt/json_token.cc +2 -2
  119. data/src/core/{lib/security/credentials → credentials/call}/jwt/json_token.h +3 -3
  120. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_credentials.cc +3 -3
  121. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_credentials.h +5 -5
  122. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_verifier.cc +7 -6
  123. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_verifier.h +3 -3
  124. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +86 -0
  125. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.h +74 -0
  126. data/src/core/credentials/call/jwt_util.cc +70 -0
  127. data/src/core/credentials/call/jwt_util.h +32 -0
  128. data/src/core/{lib/security/credentials → credentials/call}/oauth2/oauth2_credentials.cc +8 -5
  129. data/src/core/{lib/security/credentials → credentials/call}/oauth2/oauth2_credentials.h +5 -5
  130. data/src/core/{lib/security/credentials → credentials/call}/plugin/plugin_credentials.cc +2 -2
  131. data/src/core/{lib/security/credentials → credentials/call}/plugin/plugin_credentials.h +5 -5
  132. data/src/core/{lib/security/credentials → credentials/call}/token_fetcher/token_fetcher_credentials.cc +1 -1
  133. data/src/core/{lib/security/credentials → credentials/call}/token_fetcher/token_fetcher_credentials.h +5 -5
  134. data/src/core/{lib/security/credentials → credentials/transport}/alts/alts_credentials.cc +4 -4
  135. data/src/core/{lib/security/credentials → credentials/transport}/alts/alts_credentials.h +5 -5
  136. data/src/core/{lib/security/security_connector → credentials/transport}/alts/alts_security_connector.cc +13 -12
  137. data/src/core/{lib/security/security_connector → credentials/transport}/alts/alts_security_connector.h +4 -4
  138. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment.cc +1 -1
  139. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment.h +3 -3
  140. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment_linux.cc +1 -1
  141. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment_no_op.cc +1 -1
  142. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment_windows.cc +1 -1
  143. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_client_options.cc +1 -1
  144. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_options.cc +1 -1
  145. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_options.h +3 -3
  146. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_server_options.cc +1 -1
  147. data/src/core/{lib/security/credentials → credentials/transport}/channel_creds_registry.h +4 -4
  148. data/src/core/{lib/security/credentials → credentials/transport}/channel_creds_registry_init.cc +22 -18
  149. data/src/core/credentials/transport/composite/composite_channel_credentials.cc +68 -0
  150. data/src/core/{lib/security/credentials/composite/composite_credentials.h → credentials/transport/composite/composite_channel_credentials.h} +6 -51
  151. data/src/core/{lib/security/credentials → credentials/transport}/fake/fake_credentials.cc +4 -26
  152. data/src/core/{lib/security/credentials → credentials/transport}/fake/fake_credentials.h +5 -37
  153. data/src/core/{lib/security/security_connector → credentials/transport}/fake/fake_security_connector.cc +4 -4
  154. data/src/core/{lib/security/security_connector → credentials/transport}/fake/fake_security_connector.h +4 -4
  155. data/src/core/{lib/security/credentials → credentials/transport}/google_default/credentials_generic.cc +2 -2
  156. data/src/core/{lib/security/credentials → credentials/transport}/google_default/google_default_credentials.cc +106 -26
  157. data/src/core/{lib/security/credentials → credentials/transport}/google_default/google_default_credentials.h +5 -5
  158. data/src/core/{lib/security/credentials → credentials/transport}/insecure/insecure_credentials.cc +2 -2
  159. data/src/core/{lib/security/credentials → credentials/transport}/insecure/insecure_credentials.h +5 -5
  160. data/src/core/{lib/security/security_connector → credentials/transport}/insecure/insecure_security_connector.cc +2 -2
  161. data/src/core/{lib/security/security_connector → credentials/transport}/insecure/insecure_security_connector.h +5 -5
  162. data/src/core/{lib/security/credentials → credentials/transport}/local/local_credentials.cc +2 -2
  163. data/src/core/{lib/security/credentials → credentials/transport}/local/local_credentials.h +5 -5
  164. data/src/core/{lib/security/security_connector → credentials/transport}/local/local_security_connector.cc +4 -4
  165. data/src/core/{lib/security/security_connector → credentials/transport}/local/local_security_connector.h +4 -4
  166. data/src/core/{lib/security/security_connector → credentials/transport}/security_connector.cc +2 -2
  167. data/src/core/{lib/security/security_connector → credentials/transport}/security_connector.h +3 -3
  168. data/src/core/{lib/security/credentials → credentials/transport}/ssl/ssl_credentials.cc +4 -5
  169. data/src/core/{lib/security/credentials → credentials/transport}/ssl/ssl_credentials.h +6 -6
  170. data/src/core/{lib/security/security_connector → credentials/transport}/ssl/ssl_security_connector.cc +46 -16
  171. data/src/core/{lib/security/security_connector → credentials/transport}/ssl/ssl_security_connector.h +6 -5
  172. data/src/core/{lib/security/certificate_provider → credentials/transport/tls}/certificate_provider_factory.h +3 -3
  173. data/src/core/{lib/security/certificate_provider → credentials/transport/tls}/certificate_provider_registry.cc +1 -1
  174. data/src/core/{lib/security/certificate_provider → credentials/transport/tls}/certificate_provider_registry.h +4 -4
  175. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_distributor.cc +1 -1
  176. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_distributor.h +4 -4
  177. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_match.cc +1 -1
  178. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_provider.cc +2 -2
  179. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_provider.h +5 -5
  180. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_verifier.cc +2 -2
  181. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_verifier.h +3 -3
  182. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_credentials_options.cc +1 -1
  183. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_credentials_options.h +7 -7
  184. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_crl_provider.cc +1 -1
  185. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_crl_provider.h +3 -3
  186. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots.h +3 -3
  187. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_fallback.cc +1 -1
  188. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_supported.cc +3 -2
  189. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_supported.h +3 -3
  190. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_windows.cc +1 -1
  191. data/src/core/{lib/security/security_connector → credentials/transport/tls}/ssl_utils.cc +21 -3
  192. data/src/core/{lib/security/security_connector → credentials/transport/tls}/ssl_utils.h +9 -4
  193. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_credentials.cc +4 -4
  194. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_credentials.h +5 -5
  195. data/src/core/{lib/security/security_connector → credentials/transport}/tls/tls_security_connector.cc +8 -7
  196. data/src/core/{lib/security/security_connector → credentials/transport}/tls/tls_security_connector.h +6 -6
  197. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_utils.cc +1 -1
  198. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_utils.h +3 -3
  199. data/src/core/{lib/security/credentials/credentials.cc → credentials/transport/transport_credentials.cc} +1 -3
  200. data/src/core/{lib/security/credentials/credentials.h → credentials/transport/transport_credentials.h} +5 -121
  201. data/src/core/{lib/security/credentials → credentials/transport}/xds/xds_credentials.cc +5 -8
  202. data/src/core/{lib/security/credentials → credentials/transport}/xds/xds_credentials.h +6 -6
  203. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -1
  204. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +14 -8
  205. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +2 -2
  206. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +1 -1
  207. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +10 -10
  208. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +17 -17
  209. data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
  210. data/src/core/ext/filters/http/client_authority_filter.cc +4 -6
  211. data/src/core/ext/filters/http/message_compress/compression_filter.cc +1 -1
  212. data/src/core/ext/filters/http/message_compress/compression_filter.h +38 -5
  213. data/src/core/ext/filters/http/server/http_server_filter.cc +2 -2
  214. data/src/core/ext/filters/http/server/http_server_filter.h +18 -6
  215. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
  216. data/src/core/ext/filters/rbac/rbac_filter.cc +2 -2
  217. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +1 -1
  218. data/src/core/ext/transport/chttp2/chttp2_plugin.cc +40 -0
  219. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +133 -149
  220. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +3 -0
  221. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +45 -970
  222. data/src/core/ext/transport/chttp2/server/chttp2_server.h +10 -2
  223. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.cc +2 -2
  224. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +1 -3
  225. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +263 -133
  226. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +0 -6
  227. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +1239 -3514
  228. data/src/core/ext/transport/chttp2/transport/decode_huff.h +1008 -1486
  229. data/src/core/ext/transport/chttp2/transport/flow_control.h +23 -0
  230. data/src/core/ext/transport/chttp2/transport/frame.cc +310 -171
  231. data/src/core/ext/transport/chttp2/transport/frame.h +113 -5
  232. data/src/core/ext/transport/chttp2/transport/frame_data.cc +12 -0
  233. data/src/core/ext/transport/chttp2/transport/frame_data.h +2 -0
  234. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +15 -3
  235. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +5 -3
  236. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -0
  237. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +17 -7
  238. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -1
  239. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +30 -11
  240. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +8 -5
  241. data/src/core/ext/transport/chttp2/transport/header_assembler.h +299 -0
  242. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +7 -0
  243. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
  244. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +1 -1
  245. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +3 -3
  246. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +1 -1
  247. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +11 -5
  248. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +14 -3
  249. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +1017 -0
  250. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +593 -0
  251. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +10 -8
  252. data/src/core/ext/transport/chttp2/transport/http2_settings.h +25 -2
  253. data/{third_party/abseil-cpp/absl/strings/cord_buffer.cc → src/core/ext/transport/chttp2/transport/http2_stats_collector.cc} +14 -14
  254. data/src/core/ext/transport/chttp2/transport/http2_stats_collector.h +33 -0
  255. data/src/core/ext/transport/chttp2/transport/http2_status.h +414 -0
  256. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +43 -0
  257. data/src/core/ext/transport/chttp2/transport/http2_transport.h +65 -0
  258. data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +223 -0
  259. data/src/core/ext/transport/chttp2/transport/internal.h +54 -23
  260. data/src/core/ext/transport/chttp2/transport/internal_channel_arg_names.h +24 -0
  261. data/src/core/ext/transport/chttp2/transport/keepalive.cc +105 -0
  262. data/src/core/ext/transport/chttp2/transport/keepalive.h +138 -0
  263. data/src/core/ext/transport/chttp2/transport/message_assembler.h +185 -0
  264. data/src/core/ext/transport/chttp2/transport/parsing.cc +57 -31
  265. data/src/core/ext/transport/chttp2/transport/ping_callbacks.h +19 -0
  266. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +151 -0
  267. data/src/core/ext/transport/chttp2/transport/ping_promise.h +180 -0
  268. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +15 -18
  269. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +17 -0
  270. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +39 -1
  271. data/src/core/ext/transport/chttp2/transport/transport_common.cc +19 -0
  272. data/src/core/ext/transport/chttp2/transport/transport_common.h +27 -0
  273. data/src/core/ext/transport/chttp2/transport/writing.cc +103 -65
  274. data/src/core/ext/transport/inproc/inproc_transport.cc +8 -3
  275. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +7 -3
  276. data/src/core/ext/upb-gen/envoy/admin/v3/certs.upb.h +4 -0
  277. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +65 -65
  278. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +28 -28
  279. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +14 -14
  280. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb_minitable.c +6 -6
  281. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb.h +6 -6
  282. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb_minitable.c +4 -4
  283. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +133 -133
  284. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +71 -71
  285. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +38 -26
  286. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb_minitable.c +7 -7
  287. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +228 -240
  288. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +66 -66
  289. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +27 -27
  290. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +9 -9
  291. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +338 -350
  292. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +103 -103
  293. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +58 -58
  294. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +14 -14
  295. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +50 -46
  296. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +3 -3
  297. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +41 -29
  298. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +16 -16
  299. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +210 -259
  300. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +54 -54
  301. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb.h +58 -54
  302. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb_minitable.c +21 -21
  303. data/src/core/ext/upb-gen/envoy/config/core/v3/event_service_config.upb.h +4 -0
  304. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +88 -92
  305. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +17 -17
  306. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb.h +112 -100
  307. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb_minitable.c +34 -34
  308. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb.h +16 -12
  309. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb_minitable.c +5 -5
  310. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +126 -118
  311. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +39 -39
  312. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +23 -19
  313. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +9 -9
  314. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb.h +31 -27
  315. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb_minitable.c +10 -10
  316. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb.h +12 -37
  317. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb_minitable.c +2 -2
  318. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +49 -41
  319. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +16 -16
  320. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb.h +24 -24
  321. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb_minitable.c +9 -9
  322. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +147 -139
  323. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +46 -46
  324. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +73 -61
  325. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +20 -20
  326. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +3 -3
  327. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +1 -1
  328. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +6 -6
  329. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -4
  330. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +53 -33
  331. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +14 -14
  332. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +12 -0
  333. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +20 -36
  334. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +2 -2
  335. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +52 -77
  336. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +10 -10
  337. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +684 -692
  338. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +215 -215
  339. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb.h +17 -13
  340. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb_minitable.c +4 -4
  341. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +15 -3
  342. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +2 -2
  343. data/src/core/ext/upb-gen/envoy/config/trace/v3/http_tracer.upb.h +4 -0
  344. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +7 -7
  345. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +3 -3
  346. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb.h +19 -15
  347. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb_minitable.c +7 -7
  348. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb.h +7 -7
  349. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb_minitable.c +3 -3
  350. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +16 -16
  351. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +10 -10
  352. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +310 -407
  353. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb_minitable.c +96 -96
  354. data/src/core/ext/upb-gen/envoy/extensions/filters/common/fault/v3/fault.upb.h +8 -0
  355. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +65 -61
  356. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +27 -27
  357. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +19 -19
  358. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +6 -6
  359. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +25 -25
  360. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +9 -9
  361. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +34 -34
  362. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +9 -9
  363. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +7 -3
  364. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +2 -2
  365. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +322 -294
  366. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +105 -105
  367. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +7 -3
  368. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +1 -1
  369. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +23 -23
  370. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.c +8 -8
  371. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +88 -84
  372. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +28 -28
  373. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +4 -0
  374. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +99 -87
  375. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +31 -31
  376. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +32 -24
  377. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +5 -5
  378. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +138 -168
  379. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +43 -43
  380. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb.h +6 -6
  381. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb_minitable.c +2 -2
  382. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +64 -60
  383. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb_minitable.c +26 -26
  384. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +7 -7
  385. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +3 -3
  386. data/src/core/ext/upb-gen/envoy/type/http/v3/path_transformation.upb.h +4 -0
  387. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb.h +4 -0
  388. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb.h +10 -6
  389. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb_minitable.c +2 -2
  390. data/src/core/ext/upb-gen/envoy/type/matcher/v3/number.upb.h +4 -0
  391. data/src/core/ext/upb-gen/envoy/type/matcher/v3/path.upb.h +4 -0
  392. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb.h +11 -7
  393. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb_minitable.c +3 -3
  394. data/src/core/ext/upb-gen/envoy/type/matcher/v3/string.upb.h +4 -0
  395. data/src/core/ext/upb-gen/envoy/type/matcher/v3/struct.upb.h +4 -0
  396. data/src/core/ext/upb-gen/envoy/type/matcher/v3/value.upb.h +8 -0
  397. data/src/core/ext/upb-gen/envoy/type/metadata/v3/metadata.upb.h +8 -0
  398. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +15 -11
  399. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +4 -4
  400. data/src/core/ext/upb-gen/envoy/type/v3/hash_policy.upb.h +4 -0
  401. data/src/core/ext/upb-gen/envoy/type/v3/ratelimit_strategy.upb.h +4 -0
  402. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb.h +93 -133
  403. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb_minitable.c +20 -20
  404. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb.h +92 -123
  405. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.c +27 -27
  406. data/src/core/ext/upb-gen/google/api/http.upb.h +55 -51
  407. data/src/core/ext/upb-gen/google/api/http.upb_minitable.c +22 -22
  408. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb.h +516 -317
  409. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.c +150 -100
  410. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.h +5 -0
  411. data/src/core/ext/upb-gen/google/protobuf/struct.upb.h +13 -33
  412. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb.h +571 -0
  413. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.c +120 -0
  414. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/channelz.upb_minitable.h +36 -0
  415. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +1272 -0
  416. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +312 -0
  417. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +50 -0
  418. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +984 -0
  419. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +226 -0
  420. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +44 -0
  421. data/src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb.h +9 -28
  422. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +199 -142
  423. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +37 -31
  424. data/src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb.h +154 -0
  425. data/src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.c +40 -2
  426. data/src/core/ext/upb-gen/src/proto/grpc/gcp/transport_security_common.upb_minitable.h +4 -0
  427. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb.h +14 -6
  428. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb_minitable.c +4 -4
  429. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb.h +21 -40
  430. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb_minitable.c +3 -3
  431. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb.h +70 -108
  432. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb_minitable.c +17 -17
  433. data/src/core/ext/upb-gen/validate/validate.upb.h +380 -368
  434. data/src/core/ext/upb-gen/validate/validate.upb_minitable.c +117 -117
  435. data/src/core/ext/upb-gen/xds/core/v3/collection_entry.upb.h +4 -0
  436. data/src/core/ext/upb-gen/xds/core/v3/context_params.upb.h +9 -28
  437. data/src/core/ext/upb-gen/xds/core/v3/resource.upb.h +7 -7
  438. data/src/core/ext/upb-gen/xds/core/v3/resource.upb_minitable.c +3 -3
  439. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb.h +20 -12
  440. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb_minitable.c +2 -2
  441. data/src/core/ext/upb-gen/xds/data/orca/v3/orca_load_report.upb.h +27 -84
  442. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +7 -7
  443. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +3 -3
  444. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb.h +3 -3
  445. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb_minitable.c +1 -1
  446. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +42 -46
  447. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +3 -3
  448. data/src/core/ext/upb-gen/xds/type/matcher/v3/regex.upb.h +4 -0
  449. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +4 -0
  450. data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +4 -0
  451. data/src/core/ext/upbdefs-gen/envoy/admin/v3/certs.upbdefs.c +123 -62
  452. data/src/core/ext/upbdefs-gen/envoy/admin/v3/certs.upbdefs.h +5 -1
  453. data/src/core/ext/upbdefs-gen/envoy/admin/v3/clusters.upbdefs.c +200 -101
  454. data/src/core/ext/upbdefs-gen/envoy/admin/v3/clusters.upbdefs.h +5 -1
  455. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump.upbdefs.c +152 -77
  456. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump.upbdefs.h +5 -1
  457. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.c +524 -255
  458. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.h +5 -1
  459. data/src/core/ext/upbdefs-gen/envoy/admin/v3/init_dump.upbdefs.c +44 -23
  460. data/src/core/ext/upbdefs-gen/envoy/admin/v3/init_dump.upbdefs.h +5 -1
  461. data/src/core/ext/upbdefs-gen/envoy/admin/v3/listeners.upbdefs.c +66 -34
  462. data/src/core/ext/upbdefs-gen/envoy/admin/v3/listeners.upbdefs.h +5 -1
  463. data/src/core/ext/upbdefs-gen/envoy/admin/v3/memory.upbdefs.c +54 -28
  464. data/src/core/ext/upbdefs-gen/envoy/admin/v3/memory.upbdefs.h +5 -1
  465. data/src/core/ext/upbdefs-gen/envoy/admin/v3/metrics.upbdefs.c +46 -25
  466. data/src/core/ext/upbdefs-gen/envoy/admin/v3/metrics.upbdefs.h +5 -1
  467. data/src/core/ext/upbdefs-gen/envoy/admin/v3/mutex_stats.upbdefs.c +47 -25
  468. data/src/core/ext/upbdefs-gen/envoy/admin/v3/mutex_stats.upbdefs.h +5 -1
  469. data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +256 -126
  470. data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.h +5 -1
  471. data/src/core/ext/upbdefs-gen/envoy/admin/v3/tap.upbdefs.c +50 -28
  472. data/src/core/ext/upbdefs-gen/envoy/admin/v3/tap.upbdefs.h +5 -1
  473. data/src/core/ext/upbdefs-gen/envoy/annotations/deprecation.upbdefs.c +55 -28
  474. data/src/core/ext/upbdefs-gen/envoy/annotations/deprecation.upbdefs.h +5 -1
  475. data/src/core/ext/upbdefs-gen/envoy/annotations/resource.upbdefs.c +34 -18
  476. data/src/core/ext/upbdefs-gen/envoy/annotations/resource.upbdefs.h +5 -1
  477. data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.c +414 -206
  478. data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -1
  479. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +831 -413
  480. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +5 -1
  481. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +143 -73
  482. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/circuit_breaker.upbdefs.h +5 -1
  483. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +1132 -557
  484. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.h +5 -1
  485. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/filter.upbdefs.c +63 -34
  486. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/filter.upbdefs.h +5 -1
  487. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/outlier_detection.upbdefs.c +255 -127
  488. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/outlier_detection.upbdefs.h +5 -1
  489. data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.c +363 -178
  490. data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.h +5 -1
  491. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +227 -114
  492. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.h +5 -1
  493. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/backoff.upbdefs.c +57 -31
  494. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/backoff.upbdefs.h +5 -1
  495. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +596 -295
  496. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -1
  497. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/config_source.upbdefs.c +271 -137
  498. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/config_source.upbdefs.h +5 -1
  499. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/event_service_config.upbdefs.c +56 -30
  500. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/event_service_config.upbdefs.h +5 -1
  501. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/extension.upbdefs.c +45 -25
  502. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/extension.upbdefs.h +5 -1
  503. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_method_list.upbdefs.c +59 -31
  504. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_method_list.upbdefs.h +5 -1
  505. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.c +438 -217
  506. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.h +5 -1
  507. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/health_check.upbdefs.c +441 -221
  508. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/health_check.upbdefs.h +5 -1
  509. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_service.upbdefs.c +55 -30
  510. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_service.upbdefs.h +5 -1
  511. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_uri.upbdefs.c +57 -31
  512. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/http_uri.upbdefs.h +5 -1
  513. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +619 -303
  514. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.h +5 -1
  515. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.c +70 -36
  516. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.h +5 -1
  517. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/resolver.upbdefs.c +62 -33
  518. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/resolver.upbdefs.h +5 -1
  519. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.c +47 -25
  520. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.h +5 -1
  521. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +97 -49
  522. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.h +5 -1
  523. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.c +97 -51
  524. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.h +5 -1
  525. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/udp_socket_config.upbdefs.c +51 -27
  526. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/udp_socket_config.upbdefs.h +5 -1
  527. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint.upbdefs.c +147 -76
  528. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint.upbdefs.h +5 -1
  529. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +230 -116
  530. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +5 -1
  531. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/load_report.upbdefs.c +277 -138
  532. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/load_report.upbdefs.h +5 -1
  533. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/api_listener.upbdefs.c +48 -26
  534. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/api_listener.upbdefs.h +5 -1
  535. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +388 -197
  536. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -1
  537. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.c +304 -153
  538. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.h +5 -1
  539. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +173 -90
  540. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.h +5 -1
  541. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/udp_listener_config.upbdefs.c +90 -47
  542. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/udp_listener_config.upbdefs.h +5 -1
  543. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.c +98 -51
  544. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.h +5 -1
  545. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +196 -99
  546. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.h +5 -1
  547. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +237 -118
  548. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.h +5 -1
  549. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +418 -210
  550. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.h +5 -1
  551. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.c +194 -99
  552. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.h +5 -1
  553. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +2003 -973
  554. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +5 -1
  555. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/scoped_route.upbdefs.c +101 -53
  556. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/scoped_route.upbdefs.h +5 -1
  557. data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.c +352 -176
  558. data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.h +5 -1
  559. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/datadog.upbdefs.c +79 -42
  560. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/datadog.upbdefs.h +5 -1
  561. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/dynamic_ot.upbdefs.c +67 -37
  562. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/dynamic_ot.upbdefs.h +5 -1
  563. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/http_tracer.upbdefs.c +63 -34
  564. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/http_tracer.upbdefs.h +5 -1
  565. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/lightstep.upbdefs.c +88 -47
  566. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/lightstep.upbdefs.h +5 -1
  567. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +80 -43
  568. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.h +5 -1
  569. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/service.upbdefs.c +53 -29
  570. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/service.upbdefs.h +5 -1
  571. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/skywalking.upbdefs.c +86 -46
  572. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/skywalking.upbdefs.h +5 -1
  573. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.c +55 -32
  574. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.h +5 -1
  575. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/xray.upbdefs.c +91 -49
  576. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/xray.upbdefs.h +5 -1
  577. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +105 -55
  578. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.h +5 -1
  579. data/src/core/ext/upbdefs-gen/envoy/data/accesslog/v3/accesslog.upbdefs.c +775 -379
  580. data/src/core/ext/upbdefs-gen/envoy/data/accesslog/v3/accesslog.upbdefs.h +5 -1
  581. data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +52 -28
  582. data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +5 -1
  583. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +134 -68
  584. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +5 -1
  585. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +189 -96
  586. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +5 -1
  587. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.c +116 -61
  588. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h +5 -1
  589. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +112 -58
  590. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +5 -1
  591. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/router/v3/router.upbdefs.c +160 -82
  592. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -1
  593. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +75 -39
  594. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.h +5 -1
  595. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +1161 -570
  596. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -1
  597. data/src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.c +52 -28
  598. data/src/core/ext/upbdefs-gen/envoy/extensions/http/stateful_session/cookie/v3/cookie.upbdefs.h +5 -1
  599. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +55 -29
  600. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.h +5 -1
  601. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +48 -26
  602. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h +5 -1
  603. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +390 -194
  604. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +5 -1
  605. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +126 -65
  606. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +5 -1
  607. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +498 -246
  608. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +5 -1
  609. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +74 -38
  610. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.h +5 -1
  611. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +221 -110
  612. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +5 -1
  613. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/ads.upbdefs.c +68 -36
  614. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/ads.upbdefs.h +5 -1
  615. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.c +378 -187
  616. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.h +5 -1
  617. data/src/core/ext/upbdefs-gen/envoy/service/load_stats/v3/lrs.upbdefs.c +100 -52
  618. data/src/core/ext/upbdefs-gen/envoy/service/load_stats/v3/lrs.upbdefs.h +5 -1
  619. data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.c +257 -129
  620. data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.h +5 -1
  621. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.c +44 -24
  622. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.h +5 -1
  623. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/path_transformation.upbdefs.c +68 -35
  624. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/path_transformation.upbdefs.h +5 -1
  625. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +38 -20
  626. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.h +5 -1
  627. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/filter_state.upbdefs.c +59 -32
  628. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/filter_state.upbdefs.h +5 -1
  629. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/http_inputs.upbdefs.c +65 -34
  630. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/http_inputs.upbdefs.h +5 -1
  631. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/metadata.upbdefs.c +72 -38
  632. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/metadata.upbdefs.h +5 -1
  633. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/node.upbdefs.c +57 -31
  634. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/node.upbdefs.h +5 -1
  635. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/number.upbdefs.c +52 -29
  636. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/number.upbdefs.h +5 -1
  637. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/path.upbdefs.c +51 -28
  638. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/path.upbdefs.h +5 -1
  639. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/regex.upbdefs.c +89 -47
  640. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/regex.upbdefs.h +5 -1
  641. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.c +37 -20
  642. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/status_code_input.upbdefs.h +5 -1
  643. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/string.upbdefs.c +89 -47
  644. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/string.upbdefs.h +5 -1
  645. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/struct.upbdefs.c +67 -35
  646. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/struct.upbdefs.h +5 -1
  647. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/value.upbdefs.c +112 -58
  648. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/value.upbdefs.h +5 -1
  649. data/src/core/ext/upbdefs-gen/envoy/type/metadata/v3/metadata.upbdefs.c +110 -56
  650. data/src/core/ext/upbdefs-gen/envoy/type/metadata/v3/metadata.upbdefs.h +5 -1
  651. data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.c +123 -62
  652. data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.h +5 -1
  653. data/src/core/ext/upbdefs-gen/envoy/type/v3/hash_policy.upbdefs.c +59 -31
  654. data/src/core/ext/upbdefs-gen/envoy/type/v3/hash_policy.upbdefs.h +5 -1
  655. data/src/core/ext/upbdefs-gen/envoy/type/v3/http.upbdefs.c +30 -16
  656. data/src/core/ext/upbdefs-gen/envoy/type/v3/http.upbdefs.h +5 -1
  657. data/src/core/ext/upbdefs-gen/envoy/type/v3/http_status.upbdefs.c +143 -72
  658. data/src/core/ext/upbdefs-gen/envoy/type/v3/http_status.upbdefs.h +5 -1
  659. data/src/core/ext/upbdefs-gen/envoy/type/v3/percent.upbdefs.c +61 -32
  660. data/src/core/ext/upbdefs-gen/envoy/type/v3/percent.upbdefs.h +5 -1
  661. data/src/core/ext/upbdefs-gen/envoy/type/v3/range.upbdefs.c +51 -27
  662. data/src/core/ext/upbdefs-gen/envoy/type/v3/range.upbdefs.h +5 -1
  663. data/src/core/ext/upbdefs-gen/envoy/type/v3/ratelimit_strategy.upbdefs.c +85 -45
  664. data/src/core/ext/upbdefs-gen/envoy/type/v3/ratelimit_strategy.upbdefs.h +5 -1
  665. data/src/core/ext/upbdefs-gen/envoy/type/v3/ratelimit_unit.upbdefs.c +35 -19
  666. data/src/core/ext/upbdefs-gen/envoy/type/v3/ratelimit_unit.upbdefs.h +5 -1
  667. data/src/core/ext/upbdefs-gen/envoy/type/v3/semantic_version.upbdefs.c +44 -23
  668. data/src/core/ext/upbdefs-gen/envoy/type/v3/semantic_version.upbdefs.h +5 -1
  669. data/src/core/ext/upbdefs-gen/envoy/type/v3/token_bucket.upbdefs.c +61 -33
  670. data/src/core/ext/upbdefs-gen/envoy/type/v3/token_bucket.upbdefs.h +5 -1
  671. data/src/core/ext/upbdefs-gen/google/api/annotations.upbdefs.c +35 -19
  672. data/src/core/ext/upbdefs-gen/google/api/annotations.upbdefs.h +5 -1
  673. data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/checked.upbdefs.c +272 -133
  674. data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/checked.upbdefs.h +5 -1
  675. data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/syntax.upbdefs.c +315 -154
  676. data/src/core/ext/upbdefs-gen/google/api/expr/v1alpha1/syntax.upbdefs.h +5 -1
  677. data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.c +64 -33
  678. data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.h +5 -1
  679. data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.c +35 -19
  680. data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.h +5 -1
  681. data/src/core/ext/upbdefs-gen/google/protobuf/any.upbdefs.c +26 -15
  682. data/src/core/ext/upbdefs-gen/google/protobuf/any.upbdefs.h +5 -1
  683. data/src/core/ext/upbdefs-gen/google/protobuf/descriptor.upbdefs.c +1106 -497
  684. data/src/core/ext/upbdefs-gen/google/protobuf/descriptor.upbdefs.h +10 -1
  685. data/src/core/ext/upbdefs-gen/google/protobuf/duration.upbdefs.c +28 -16
  686. data/src/core/ext/upbdefs-gen/google/protobuf/duration.upbdefs.h +5 -1
  687. data/src/core/ext/upbdefs-gen/google/protobuf/empty.upbdefs.c +23 -13
  688. data/src/core/ext/upbdefs-gen/google/protobuf/empty.upbdefs.h +5 -1
  689. data/src/core/ext/upbdefs-gen/google/protobuf/struct.upbdefs.c +69 -35
  690. data/src/core/ext/upbdefs-gen/google/protobuf/struct.upbdefs.h +5 -1
  691. data/src/core/ext/upbdefs-gen/google/protobuf/timestamp.upbdefs.c +29 -16
  692. data/src/core/ext/upbdefs-gen/google/protobuf/timestamp.upbdefs.h +5 -1
  693. data/src/core/ext/upbdefs-gen/google/protobuf/wrappers.upbdefs.c +51 -26
  694. data/src/core/ext/upbdefs-gen/google/protobuf/wrappers.upbdefs.h +5 -1
  695. data/src/core/ext/upbdefs-gen/google/rpc/status.upbdefs.c +32 -17
  696. data/src/core/ext/upbdefs-gen/google/rpc/status.upbdefs.h +5 -1
  697. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +175 -0
  698. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +82 -0
  699. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c +135 -0
  700. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.h +67 -0
  701. data/src/core/ext/upbdefs-gen/src/proto/grpc/lookup/v1/rls_config.upbdefs.c +161 -79
  702. data/src/core/ext/upbdefs-gen/src/proto/grpc/lookup/v1/rls_config.upbdefs.h +5 -1
  703. data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.c +84 -42
  704. data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.h +5 -1
  705. data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.c +48 -26
  706. data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.h +5 -1
  707. data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.c +26 -14
  708. data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.h +5 -1
  709. data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.c +50 -26
  710. data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.h +5 -1
  711. data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.c +36 -19
  712. data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.h +5 -1
  713. data/src/core/ext/upbdefs-gen/validate/validate.upbdefs.c +538 -261
  714. data/src/core/ext/upbdefs-gen/validate/validate.upbdefs.h +5 -1
  715. data/src/core/ext/upbdefs-gen/xds/annotations/v3/migrate.upbdefs.c +86 -43
  716. data/src/core/ext/upbdefs-gen/xds/annotations/v3/migrate.upbdefs.h +5 -1
  717. data/src/core/ext/upbdefs-gen/xds/annotations/v3/security.upbdefs.c +49 -26
  718. data/src/core/ext/upbdefs-gen/xds/annotations/v3/security.upbdefs.h +5 -1
  719. data/src/core/ext/upbdefs-gen/xds/annotations/v3/sensitive.upbdefs.c +27 -15
  720. data/src/core/ext/upbdefs-gen/xds/annotations/v3/sensitive.upbdefs.h +5 -1
  721. data/src/core/ext/upbdefs-gen/xds/annotations/v3/status.upbdefs.c +87 -44
  722. data/src/core/ext/upbdefs-gen/xds/annotations/v3/status.upbdefs.h +5 -1
  723. data/src/core/ext/upbdefs-gen/xds/annotations/v3/versioning.upbdefs.c +37 -20
  724. data/src/core/ext/upbdefs-gen/xds/annotations/v3/versioning.upbdefs.h +5 -1
  725. data/src/core/ext/upbdefs-gen/xds/core/v3/authority.upbdefs.c +30 -17
  726. data/src/core/ext/upbdefs-gen/xds/core/v3/authority.upbdefs.h +5 -1
  727. data/src/core/ext/upbdefs-gen/xds/core/v3/cidr.upbdefs.c +41 -23
  728. data/src/core/ext/upbdefs-gen/xds/core/v3/cidr.upbdefs.h +5 -1
  729. data/src/core/ext/upbdefs-gen/xds/core/v3/collection_entry.upbdefs.c +62 -33
  730. data/src/core/ext/upbdefs-gen/xds/core/v3/collection_entry.upbdefs.h +5 -1
  731. data/src/core/ext/upbdefs-gen/xds/core/v3/context_params.upbdefs.c +36 -19
  732. data/src/core/ext/upbdefs-gen/xds/core/v3/context_params.upbdefs.h +5 -1
  733. data/src/core/ext/upbdefs-gen/xds/core/v3/extension.upbdefs.c +36 -20
  734. data/src/core/ext/upbdefs-gen/xds/core/v3/extension.upbdefs.h +5 -1
  735. data/src/core/ext/upbdefs-gen/xds/core/v3/resource.upbdefs.c +42 -23
  736. data/src/core/ext/upbdefs-gen/xds/core/v3/resource.upbdefs.h +5 -1
  737. data/src/core/ext/upbdefs-gen/xds/core/v3/resource_locator.upbdefs.c +76 -39
  738. data/src/core/ext/upbdefs-gen/xds/core/v3/resource_locator.upbdefs.h +5 -1
  739. data/src/core/ext/upbdefs-gen/xds/core/v3/resource_name.upbdefs.c +45 -24
  740. data/src/core/ext/upbdefs-gen/xds/core/v3/resource_name.upbdefs.h +5 -1
  741. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.c +41 -23
  742. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.h +5 -1
  743. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/domain.upbdefs.c +53 -29
  744. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/domain.upbdefs.h +5 -1
  745. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.c +29 -16
  746. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.h +5 -1
  747. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/ip.upbdefs.c +58 -32
  748. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/ip.upbdefs.h +5 -1
  749. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.c +207 -103
  750. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.h +5 -1
  751. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/range.upbdefs.c +95 -49
  752. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/range.upbdefs.h +5 -1
  753. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/regex.upbdefs.c +38 -20
  754. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/regex.upbdefs.h +5 -1
  755. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.c +60 -31
  756. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.h +5 -1
  757. data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.c +67 -36
  758. data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.h +5 -1
  759. data/src/core/ext/upbdefs-gen/xds/type/v3/range.upbdefs.c +31 -17
  760. data/src/core/ext/upbdefs-gen/xds/type/v3/range.upbdefs.h +5 -1
  761. data/src/core/ext/upbdefs-gen/xds/type/v3/typed_struct.upbdefs.c +31 -17
  762. data/src/core/ext/upbdefs-gen/xds/type/v3/typed_struct.upbdefs.h +5 -1
  763. data/src/core/{lib/security/transport → filter/auth}/auth_filters.h +8 -32
  764. data/src/core/{lib/security/transport → filter/auth}/client_auth_filter.cc +7 -124
  765. data/src/core/{lib/security/transport → filter/auth}/server_auth_filter.cc +5 -4
  766. data/src/core/filter/filter_args.h +9 -23
  767. data/src/core/handshaker/handshaker.cc +23 -22
  768. data/src/core/handshaker/handshaker.h +3 -0
  769. data/src/core/handshaker/http_connect/http_connect_handshaker.cc +3 -1
  770. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +7 -22
  771. data/src/core/handshaker/security/legacy_secure_endpoint.cc +597 -0
  772. data/src/core/handshaker/security/secure_endpoint.cc +812 -310
  773. data/src/core/handshaker/security/secure_endpoint.h +17 -0
  774. data/src/core/handshaker/security/security_handshaker.cc +8 -5
  775. data/src/core/handshaker/security/security_handshaker.h +1 -1
  776. data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +7 -1
  777. data/src/core/lib/address_utils/sockaddr_utils.cc +5 -5
  778. data/src/core/lib/channel/channel_args.cc +15 -0
  779. data/src/core/lib/channel/channel_args.h +56 -30
  780. data/src/core/lib/channel/channel_stack.cc +32 -4
  781. data/src/core/lib/channel/channel_stack.h +16 -6
  782. data/src/core/lib/channel/channel_stack_builder_impl.cc +2 -2
  783. data/src/core/lib/channel/channel_stack_builder_impl.h +2 -7
  784. data/src/core/lib/channel/connected_channel.cc +2 -2
  785. data/src/core/lib/channel/promise_based_filter.h +715 -307
  786. data/src/core/lib/debug/trace_flags.cc +4 -6
  787. data/src/core/lib/debug/trace_flags.h +2 -3
  788. data/src/core/lib/debug/trace_impl.h +0 -1
  789. data/src/core/lib/event_engine/ares_resolver.cc +165 -46
  790. data/src/core/lib/event_engine/ares_resolver.h +48 -2
  791. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +8 -2
  792. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -4
  793. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +4 -4
  794. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +10 -6
  795. data/src/core/lib/event_engine/default_event_engine_factory.cc +6 -6
  796. data/src/core/lib/event_engine/default_event_engine_factory.h +1 -1
  797. data/src/core/lib/event_engine/endpoint_channel_arg_wrapper.cc +40 -0
  798. data/src/core/lib/event_engine/endpoint_channel_arg_wrapper.h +60 -0
  799. data/src/core/lib/event_engine/event_engine.cc +7 -0
  800. data/src/core/lib/event_engine/extensions/blocking_dns.h +46 -0
  801. data/src/core/lib/event_engine/extensions/channelz.h +66 -0
  802. data/src/core/lib/event_engine/extensions/iomgr_compatible.h +39 -0
  803. data/src/core/lib/event_engine/extensions/supports_win_sockets.h +48 -0
  804. data/src/core/lib/event_engine/extensions/tcp_trace.h +2 -2
  805. data/src/core/lib/event_engine/grpc_polled_fd.h +5 -0
  806. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +130 -162
  807. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +11 -15
  808. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +75 -117
  809. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +7 -9
  810. data/src/core/lib/event_engine/posix_engine/event_poller.h +18 -15
  811. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +0 -18
  812. data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.cc +124 -0
  813. data/src/core/lib/event_engine/posix_engine/file_descriptor_collection.h +243 -0
  814. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +29 -19
  815. data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +6 -2
  816. data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +6 -1
  817. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +4 -7
  818. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +3 -0
  819. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +149 -99
  820. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +29 -33
  821. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +342 -105
  822. data/src/core/lib/event_engine/posix_engine/posix_engine.h +72 -29
  823. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +45 -37
  824. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +6 -4
  825. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +58 -142
  826. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +10 -5
  827. data/src/core/lib/event_engine/posix_engine/posix_interface.h +211 -0
  828. data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +1083 -0
  829. data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +281 -0
  830. data/src/core/lib/event_engine/posix_engine/posix_write_event_sink.cc +154 -0
  831. data/src/core/lib/event_engine/posix_engine/posix_write_event_sink.h +174 -0
  832. data/src/core/lib/event_engine/posix_engine/set_socket_dualstack.cc +64 -0
  833. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -730
  834. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +10 -170
  835. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +33 -22
  836. data/src/core/lib/event_engine/posix_engine/timer_manager.h +13 -11
  837. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +117 -151
  838. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +26 -94
  839. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +26 -25
  840. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +6 -2
  841. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +36 -54
  842. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +6 -2
  843. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +7 -6
  844. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +12 -6
  845. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +3 -1
  846. data/src/core/lib/event_engine/query_extensions.h +10 -21
  847. data/src/core/lib/event_engine/shim.cc +16 -14
  848. data/src/core/lib/event_engine/shim.h +14 -0
  849. data/src/core/lib/event_engine/tcp_socket_utils.cc +10 -9
  850. data/src/core/lib/event_engine/thread_pool/thread_pool.h +7 -3
  851. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +0 -17
  852. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +19 -9
  853. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +5 -3
  854. data/src/core/lib/event_engine/utils.cc +34 -0
  855. data/src/core/lib/event_engine/utils.h +3 -0
  856. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +4 -0
  857. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.h +4 -0
  858. data/src/core/lib/event_engine/windows/win_socket.cc +11 -0
  859. data/src/core/lib/event_engine/windows/win_socket.h +3 -0
  860. data/src/core/lib/event_engine/windows/windows_endpoint.cc +7 -12
  861. data/src/core/lib/event_engine/windows/windows_endpoint.h +5 -2
  862. data/src/core/lib/event_engine/windows/windows_engine.cc +42 -1
  863. data/src/core/lib/event_engine/windows/windows_engine.h +7 -3
  864. data/src/core/lib/event_engine/windows/windows_listener.cc +19 -8
  865. data/src/core/lib/event_engine/windows/windows_listener.h +9 -4
  866. data/src/core/lib/experiments/experiments.cc +393 -141
  867. data/src/core/lib/experiments/experiments.h +149 -79
  868. data/src/core/lib/iomgr/combiner.cc +3 -2
  869. data/src/core/lib/iomgr/endpoint.cc +4 -3
  870. data/src/core/lib/iomgr/endpoint.h +7 -4
  871. data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -2
  872. data/src/core/lib/iomgr/endpoint_pair_posix.cc +43 -16
  873. data/src/core/lib/iomgr/endpoint_pair_windows.cc +43 -8
  874. data/src/core/lib/iomgr/error.cc +27 -43
  875. data/src/core/lib/iomgr/ev_epoll1_linux.cc +18 -1
  876. data/src/core/lib/iomgr/ev_poll_posix.cc +22 -0
  877. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +11 -10
  878. data/src/core/lib/iomgr/fork_posix.cc +0 -7
  879. data/src/core/lib/iomgr/iomgr.cc +0 -3
  880. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +3 -0
  881. data/src/core/lib/iomgr/polling_entity.cc +2 -7
  882. data/src/core/lib/iomgr/resolve_address_posix.cc +37 -47
  883. data/src/core/lib/iomgr/resolve_address_posix.h +15 -0
  884. data/src/core/lib/iomgr/resolve_address_windows.cc +22 -45
  885. data/src/core/lib/iomgr/resolve_address_windows.h +15 -2
  886. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -0
  887. data/src/core/lib/iomgr/socket_utils_posix.cc +22 -11
  888. data/src/core/lib/iomgr/socket_utils_posix.h +12 -2
  889. data/src/core/lib/iomgr/tcp_client_cfstream.cc +8 -9
  890. data/src/core/lib/iomgr/tcp_client_posix.cc +25 -21
  891. data/src/core/lib/iomgr/tcp_client_posix.h +1 -1
  892. data/src/core/lib/iomgr/tcp_posix.cc +82 -47
  893. data/src/core/lib/iomgr/tcp_posix.h +10 -2
  894. data/src/core/lib/iomgr/tcp_server_posix.cc +9 -1
  895. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -4
  896. data/src/core/lib/iomgr/tcp_server_windows.cc +41 -18
  897. data/src/core/lib/iomgr/tcp_windows.cc +3 -2
  898. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +10 -2
  899. data/src/core/lib/promise/activity.h +1 -0
  900. data/src/core/lib/promise/all_ok.h +31 -0
  901. data/src/core/lib/promise/arena_promise.h +23 -7
  902. data/src/core/lib/promise/detail/promise_factory.h +10 -0
  903. data/src/core/lib/promise/detail/promise_like.h +132 -1
  904. data/src/core/lib/promise/detail/promise_variant.h +50 -0
  905. data/src/core/lib/promise/detail/seq_state.h +880 -0
  906. data/src/core/lib/promise/if.h +20 -0
  907. data/src/core/lib/promise/inter_activity_latch.h +147 -0
  908. data/src/core/lib/promise/inter_activity_mutex.h +547 -0
  909. data/src/core/lib/promise/loop.h +73 -8
  910. data/src/core/lib/promise/map.h +106 -2
  911. data/src/core/lib/promise/match_promise.h +103 -0
  912. data/src/core/lib/promise/mpsc.cc +425 -0
  913. data/src/core/lib/promise/mpsc.h +490 -0
  914. data/src/core/lib/promise/party.cc +50 -1
  915. data/src/core/lib/promise/party.h +71 -2
  916. data/src/core/lib/promise/poll.h +22 -20
  917. data/src/core/lib/promise/promise.h +4 -2
  918. data/src/core/lib/promise/race.h +31 -0
  919. data/src/core/lib/promise/seq.h +5 -0
  920. data/src/core/lib/promise/sleep.cc +6 -3
  921. data/src/core/lib/promise/status_flag.h +28 -9
  922. data/src/core/lib/promise/try_seq.h +5 -0
  923. data/src/core/lib/promise/wait_set.cc +28 -0
  924. data/src/core/lib/promise/wait_set.h +86 -0
  925. data/src/core/lib/resource_quota/arena.h +19 -0
  926. data/src/core/lib/resource_quota/memory_quota.cc +9 -0
  927. data/src/core/lib/resource_quota/memory_quota.h +1 -3
  928. data/src/core/lib/security/authorization/evaluate_args.cc +1 -1
  929. data/src/core/lib/security/authorization/evaluate_args.h +1 -1
  930. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -1
  931. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +1 -1
  932. data/src/core/lib/slice/slice.h +11 -0
  933. data/src/core/lib/slice/slice_buffer.h +6 -0
  934. data/src/core/lib/surface/call.cc +24 -18
  935. data/src/core/lib/surface/call_utils.cc +3 -3
  936. data/src/core/lib/surface/call_utils.h +3 -3
  937. data/src/core/lib/surface/channel.h +2 -2
  938. data/src/core/lib/surface/channel_create.cc +139 -4
  939. data/src/core/lib/surface/channel_create.h +4 -0
  940. data/src/core/lib/surface/channel_init.cc +164 -47
  941. data/src/core/lib/surface/channel_init.h +66 -3
  942. data/src/core/lib/surface/completion_queue.cc +77 -17
  943. data/src/core/lib/surface/filter_stack_call.cc +58 -36
  944. data/src/core/lib/surface/filter_stack_call.h +1 -1
  945. data/src/core/lib/surface/init.cc +10 -20
  946. data/src/core/lib/surface/lame_client.cc +1 -1
  947. data/src/core/lib/surface/legacy_channel.cc +30 -28
  948. data/src/core/lib/surface/legacy_channel.h +4 -2
  949. data/src/core/lib/surface/version.cc +2 -2
  950. data/src/core/lib/transport/error_utils.cc +65 -11
  951. data/src/core/lib/transport/error_utils.h +2 -2
  952. data/src/core/lib/transport/promise_endpoint.cc +110 -0
  953. data/src/core/lib/transport/promise_endpoint.h +307 -0
  954. data/src/core/lib/transport/status_conversion.cc +11 -36
  955. data/src/core/lib/transport/status_conversion.h +5 -4
  956. data/src/core/lib/transport/transport.cc +2 -2
  957. data/src/core/lib/transport/transport.h +8 -5
  958. data/src/core/lib/transport/transport_op_string.cc +1 -1
  959. data/src/core/load_balancing/backend_metric_parser.cc +12 -18
  960. data/src/core/load_balancing/child_policy_handler.cc +2 -4
  961. data/src/core/load_balancing/delegating_helper.h +3 -4
  962. data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +1 -1
  963. data/src/core/load_balancing/grpclb/grpclb.cc +3 -4
  964. data/src/core/load_balancing/health_check_client.cc +3 -9
  965. data/src/core/load_balancing/lb_policy.h +1 -3
  966. data/src/core/load_balancing/oob_backend_metric.cc +3 -9
  967. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +4 -3
  968. data/src/core/load_balancing/pick_first/pick_first.cc +6 -958
  969. data/src/core/load_balancing/rls/rls.cc +37 -42
  970. data/src/core/load_balancing/round_robin/round_robin.cc +2 -3
  971. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +4 -4
  972. data/src/core/load_balancing/weighted_target/weighted_target.cc +4 -10
  973. data/src/core/load_balancing/xds/cds.cc +13 -11
  974. data/src/core/load_balancing/xds/xds_cluster_impl.cc +1 -1
  975. data/src/core/load_balancing/xds/xds_override_host.cc +55 -34
  976. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
  977. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -2
  978. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +1 -3
  979. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +4 -0
  980. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +1 -1
  981. data/src/core/resolver/sockaddr/sockaddr_resolver.cc +2 -1
  982. data/src/core/resolver/xds/xds_config.cc +6 -3
  983. data/src/core/resolver/xds/xds_config.h +9 -4
  984. data/src/core/resolver/xds/xds_dependency_manager.cc +29 -9
  985. data/src/core/resolver/xds/xds_dependency_manager.h +2 -1
  986. data/src/core/resolver/xds/xds_resolver.cc +35 -14
  987. data/src/core/server/add_port.cc +87 -0
  988. data/src/core/server/server.cc +135 -66
  989. data/src/core/server/server.h +24 -7
  990. data/src/core/server/server_call_tracer_filter.cc +1 -1
  991. data/src/core/server/server_config_selector.h +1 -1
  992. data/src/core/server/server_config_selector_filter.cc +1 -1
  993. data/src/core/server/xds_server_config_fetcher.cc +68 -30
  994. data/src/core/service_config/service_config.h +1 -1
  995. data/src/core/service_config/service_config_channel_arg_filter.cc +1 -1
  996. data/src/core/service_config/service_config_impl.h +1 -1
  997. data/src/core/telemetry/call_tracer.cc +4 -6
  998. data/src/core/telemetry/call_tracer.h +4 -4
  999. data/src/core/telemetry/context_list_entry.cc +38 -0
  1000. data/src/core/{ext/transport/chttp2/transport → telemetry}/context_list_entry.h +45 -15
  1001. data/src/core/telemetry/default_tcp_tracer.cc +26 -0
  1002. data/src/core/telemetry/default_tcp_tracer.h +44 -0
  1003. data/src/core/telemetry/metrics.cc +30 -12
  1004. data/src/core/telemetry/metrics.h +15 -3
  1005. data/src/core/telemetry/stats.h +0 -5
  1006. data/src/core/telemetry/stats_data.cc +564 -423
  1007. data/src/core/telemetry/stats_data.h +474 -241
  1008. data/src/core/telemetry/tcp_tracer.cc +38 -0
  1009. data/src/core/telemetry/tcp_tracer.h +103 -99
  1010. data/src/core/{lib/security/context/security_context.cc → transport/auth_context.cc} +1 -97
  1011. data/src/core/{lib/security/context/security_context.h → transport/auth_context.h} +5 -76
  1012. data/src/core/transport/endpoint_transport.h +90 -0
  1013. data/src/core/transport/endpoint_transport_client_channel_factory.cc +61 -0
  1014. data/src/core/transport/endpoint_transport_client_channel_factory.h +57 -0
  1015. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +33 -1
  1016. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +3 -1
  1017. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +76 -22
  1018. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -3
  1019. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +11 -3
  1020. data/src/core/tsi/fake_transport_security.cc +17 -0
  1021. data/src/core/tsi/ssl_transport_security.cc +192 -72
  1022. data/src/core/tsi/ssl_transport_security.h +6 -1
  1023. data/src/core/tsi/transport_security.h +3 -0
  1024. data/src/core/tsi/transport_security_grpc.cc +8 -0
  1025. data/src/core/tsi/transport_security_grpc.h +22 -3
  1026. data/src/core/tsi/transport_security_interface.h +30 -25
  1027. data/src/core/util/backoff.cc +5 -16
  1028. data/src/core/util/backoff.h +1 -1
  1029. data/src/core/util/check_class_size.h +48 -0
  1030. data/src/core/util/down_cast.h +1 -1
  1031. data/src/core/util/dual_ref_counted.h +48 -0
  1032. data/src/core/util/function_signature.h +80 -0
  1033. data/src/core/util/gcp_metadata_query.cc +4 -3
  1034. data/src/core/util/http_client/httpcli.cc +15 -8
  1035. data/src/core/util/http_client/httpcli.h +4 -1
  1036. data/src/core/util/http_client/httpcli_security_connector.cc +5 -4
  1037. data/src/core/util/json/json_object_loader.h +3 -3
  1038. data/src/core/util/latent_see.cc +28 -2
  1039. data/src/core/util/latent_see.h +19 -28
  1040. data/src/core/util/linux/env.cc +3 -1
  1041. data/src/core/util/load_file.cc +26 -14
  1042. data/src/core/util/log.cc +4 -0
  1043. data/src/core/util/memory_usage.h +268 -0
  1044. data/src/core/util/per_cpu.cc +2 -0
  1045. data/src/core/util/per_cpu.h +7 -0
  1046. data/src/core/util/ref_counted_ptr.h +26 -0
  1047. data/src/core/util/shared_bit_gen.cc +21 -0
  1048. data/src/core/util/shared_bit_gen.h +64 -0
  1049. data/src/core/util/single_set_ptr.h +35 -4
  1050. data/src/core/util/status_helper.cc +86 -63
  1051. data/src/core/util/status_helper.h +9 -26
  1052. data/src/core/util/upb_utils.h +42 -0
  1053. data/src/core/util/uri.cc +76 -17
  1054. data/src/core/util/uri.h +13 -8
  1055. data/src/core/util/useful.h +53 -2
  1056. data/src/core/util/wait_for_single_owner.cc +31 -0
  1057. data/src/core/util/wait_for_single_owner.h +24 -0
  1058. data/src/core/xds/grpc/certificate_provider_store.cc +1 -1
  1059. data/src/core/xds/grpc/certificate_provider_store.h +3 -3
  1060. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +3 -3
  1061. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +1 -1
  1062. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +12 -7
  1063. data/src/core/xds/grpc/xds_bootstrap_grpc.h +5 -0
  1064. data/src/core/xds/grpc/xds_certificate_provider.cc +1 -1
  1065. data/src/core/xds/grpc/xds_certificate_provider.h +2 -2
  1066. data/src/core/xds/grpc/xds_client_grpc.cc +13 -8
  1067. data/src/core/xds/grpc/xds_client_grpc.h +4 -2
  1068. data/src/core/xds/grpc/xds_cluster.h +3 -3
  1069. data/src/core/xds/grpc/xds_cluster_parser.cc +3 -2
  1070. data/src/core/xds/grpc/xds_common_types_parser.cc +138 -58
  1071. data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
  1072. data/src/core/xds/grpc/xds_http_fault_filter.cc +1 -1
  1073. data/src/core/xds/grpc/xds_http_filter.h +8 -1
  1074. data/src/core/xds/grpc/xds_http_filter_registry.cc +1 -3
  1075. data/src/core/xds/grpc/xds_http_filter_registry.h +1 -1
  1076. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +22 -0
  1077. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -0
  1078. data/src/core/xds/grpc/xds_http_rbac_filter.cc +10 -17
  1079. data/src/core/xds/grpc/xds_metadata_parser.cc +40 -64
  1080. data/src/core/xds/grpc/xds_metadata_parser.h +0 -2
  1081. data/src/core/xds/grpc/xds_route_config.h +1 -1
  1082. data/src/core/xds/grpc/xds_route_config_parser.cc +71 -116
  1083. data/src/core/xds/grpc/xds_route_config_parser.h +1 -1
  1084. data/src/core/xds/grpc/xds_routing.h +1 -1
  1085. data/src/core/xds/grpc/xds_server_grpc.cc +110 -48
  1086. data/src/core/xds/grpc/xds_server_grpc.h +31 -13
  1087. data/src/core/xds/grpc/xds_server_grpc_interface.h +6 -2
  1088. data/src/core/xds/grpc/xds_transport_grpc.cc +23 -5
  1089. data/src/core/xds/grpc/xds_transport_grpc.h +5 -3
  1090. data/src/core/xds/xds_client/lrs_client.cc +6 -5
  1091. data/src/core/xds/xds_client/lrs_client.h +7 -7
  1092. data/src/core/xds/xds_client/xds_bootstrap.h +18 -1
  1093. data/src/core/xds/xds_client/xds_client.cc +52 -29
  1094. data/src/core/xds/xds_client/xds_client.h +3 -1
  1095. data/src/core/xds/xds_client/xds_resource_type.h +1 -2
  1096. data/src/core/xds/xds_client/xds_transport.h +1 -1
  1097. data/src/ruby/ext/grpc/extconf.rb +4 -2
  1098. data/src/ruby/ext/grpc/rb_call.c +1 -8
  1099. data/src/ruby/ext/grpc/rb_channel.c +72 -568
  1100. data/src/ruby/ext/grpc/rb_channel.h +0 -3
  1101. data/src/ruby/ext/grpc/rb_completion_queue.c +26 -14
  1102. data/src/ruby/ext/grpc/rb_completion_queue.h +1 -7
  1103. data/src/ruby/ext/grpc/rb_grpc.c +9 -5
  1104. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
  1105. data/src/ruby/ext/grpc/rb_loader.c +0 -4
  1106. data/src/ruby/ext/grpc/rb_server.c +31 -50
  1107. data/src/ruby/lib/grpc/generic/client_stub.rb +4 -4
  1108. data/src/ruby/lib/grpc/version.rb +1 -1
  1109. data/src/ruby/spec/core_spec.rb +22 -0
  1110. data/src/ruby/spec/generic/active_call_spec.rb +1 -1
  1111. data/src/ruby/spec/generic/client_stub_spec.rb +2 -6
  1112. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
  1113. data/third_party/abseil-cpp/absl/algorithm/algorithm.h +2 -2
  1114. data/third_party/abseil-cpp/absl/algorithm/container.h +81 -67
  1115. data/third_party/abseil-cpp/absl/base/attributes.h +142 -23
  1116. data/third_party/abseil-cpp/absl/base/call_once.h +18 -16
  1117. data/third_party/abseil-cpp/absl/base/config.h +23 -132
  1118. data/third_party/abseil-cpp/absl/base/{internal/fast_type_id.h → fast_type_id.h} +11 -16
  1119. data/third_party/abseil-cpp/absl/base/internal/cycleclock.cc +0 -5
  1120. data/third_party/abseil-cpp/absl/base/internal/cycleclock_config.h +7 -7
  1121. data/third_party/abseil-cpp/absl/base/internal/endian.h +34 -38
  1122. data/third_party/abseil-cpp/absl/base/internal/iterator_traits.h +71 -0
  1123. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +6 -5
  1124. data/third_party/abseil-cpp/absl/base/internal/nullability_deprecated.h +106 -0
  1125. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +1 -1
  1126. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +0 -9
  1127. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +3 -13
  1128. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +14 -0
  1129. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +5 -1
  1130. data/third_party/abseil-cpp/absl/base/internal/tracing.cc +39 -0
  1131. data/third_party/abseil-cpp/absl/base/internal/tracing.h +81 -0
  1132. data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +6 -6
  1133. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +0 -10
  1134. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +17 -0
  1135. data/third_party/abseil-cpp/absl/base/macros.h +35 -4
  1136. data/third_party/abseil-cpp/absl/base/no_destructor.h +11 -32
  1137. data/third_party/abseil-cpp/absl/base/nullability.h +124 -56
  1138. data/third_party/abseil-cpp/absl/base/optimization.h +8 -12
  1139. data/third_party/abseil-cpp/absl/base/options.h +7 -81
  1140. data/third_party/abseil-cpp/absl/base/policy_checks.h +9 -7
  1141. data/third_party/abseil-cpp/absl/cleanup/cleanup.h +1 -3
  1142. data/third_party/abseil-cpp/absl/cleanup/internal/cleanup.h +3 -4
  1143. data/third_party/abseil-cpp/absl/container/btree_map.h +891 -0
  1144. data/third_party/abseil-cpp/absl/container/btree_set.h +826 -0
  1145. data/third_party/abseil-cpp/absl/container/fixed_array.h +9 -15
  1146. data/third_party/abseil-cpp/absl/container/flat_hash_map.h +22 -3
  1147. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +23 -4
  1148. data/third_party/abseil-cpp/absl/container/inlined_vector.h +10 -6
  1149. data/third_party/abseil-cpp/absl/container/internal/btree.h +3149 -0
  1150. data/third_party/abseil-cpp/absl/container/internal/btree_container.h +867 -0
  1151. data/third_party/abseil-cpp/absl/container/internal/common.h +43 -0
  1152. data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +10 -2
  1153. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +10 -10
  1154. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +1 -8
  1155. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +0 -4
  1156. data/third_party/abseil-cpp/absl/container/internal/hashtable_control_bytes.h +527 -0
  1157. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +20 -4
  1158. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +31 -12
  1159. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +6 -9
  1160. data/third_party/abseil-cpp/absl/container/internal/layout.h +27 -43
  1161. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +199 -68
  1162. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +1462 -263
  1163. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1170 -1547
  1164. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set_resize_impl.h +80 -0
  1165. data/third_party/abseil-cpp/absl/crc/crc32c.cc +0 -4
  1166. data/third_party/abseil-cpp/absl/crc/crc32c.h +7 -5
  1167. data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +56 -0
  1168. data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +0 -22
  1169. data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +45 -74
  1170. data/third_party/abseil-cpp/absl/crc/internal/non_temporal_memcpy.h +21 -7
  1171. data/third_party/abseil-cpp/absl/debugging/internal/addresses.h +57 -0
  1172. data/third_party/abseil-cpp/absl/debugging/internal/decode_rust_punycode.cc +1 -1
  1173. data/third_party/abseil-cpp/absl/debugging/internal/decode_rust_punycode.h +5 -5
  1174. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +12 -37
  1175. data/third_party/abseil-cpp/absl/debugging/internal/demangle_rust.cc +16 -16
  1176. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +1 -1
  1177. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +40 -21
  1178. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +16 -7
  1179. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +7 -0
  1180. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +14 -5
  1181. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +10 -4
  1182. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +27 -16
  1183. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +20 -8
  1184. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +4 -3
  1185. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +15 -28
  1186. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +19 -9
  1187. data/third_party/abseil-cpp/absl/debugging/leak_check.cc +73 -0
  1188. data/third_party/abseil-cpp/absl/debugging/leak_check.h +150 -0
  1189. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +144 -27
  1190. data/third_party/abseil-cpp/absl/debugging/stacktrace.h +73 -5
  1191. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +3 -2
  1192. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +67 -18
  1193. data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +3 -2
  1194. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +25 -6
  1195. data/third_party/abseil-cpp/absl/flags/commandlineflag.cc +1 -0
  1196. data/third_party/abseil-cpp/absl/flags/commandlineflag.h +9 -2
  1197. data/third_party/abseil-cpp/absl/flags/flag.h +18 -15
  1198. data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.h +2 -2
  1199. data/third_party/abseil-cpp/absl/flags/internal/flag.cc +14 -5
  1200. data/third_party/abseil-cpp/absl/flags/internal/flag.h +23 -11
  1201. data/third_party/abseil-cpp/absl/flags/internal/private_handle_accessor.cc +4 -0
  1202. data/third_party/abseil-cpp/absl/flags/internal/private_handle_accessor.h +3 -0
  1203. data/third_party/abseil-cpp/absl/flags/internal/program_name.cc +13 -12
  1204. data/third_party/abseil-cpp/absl/flags/internal/registry.h +4 -3
  1205. data/third_party/abseil-cpp/absl/flags/reflection.cc +2 -3
  1206. data/third_party/abseil-cpp/absl/flags/usage_config.cc +9 -4
  1207. data/third_party/abseil-cpp/absl/functional/any_invocable.h +8 -10
  1208. data/third_party/abseil-cpp/absl/functional/function_ref.h +2 -9
  1209. data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +110 -226
  1210. data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +10 -12
  1211. data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +2 -5
  1212. data/third_party/abseil-cpp/absl/hash/hash.h +44 -2
  1213. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +14 -18
  1214. data/third_party/abseil-cpp/absl/hash/internal/hash.h +257 -127
  1215. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +27 -72
  1216. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.h +2 -6
  1217. data/third_party/abseil-cpp/absl/hash/internal/weakly_mixed_integer.h +38 -0
  1218. data/third_party/abseil-cpp/absl/log/absl_vlog_is_on.h +2 -0
  1219. data/third_party/abseil-cpp/absl/log/check.h +2 -1
  1220. data/third_party/abseil-cpp/absl/log/globals.h +4 -5
  1221. data/third_party/abseil-cpp/absl/log/internal/append_truncated.h +28 -0
  1222. data/third_party/abseil-cpp/absl/log/internal/check_op.cc +43 -38
  1223. data/third_party/abseil-cpp/absl/log/internal/check_op.h +124 -99
  1224. data/third_party/abseil-cpp/absl/log/internal/conditions.cc +5 -3
  1225. data/third_party/abseil-cpp/absl/log/internal/conditions.h +7 -2
  1226. data/third_party/abseil-cpp/absl/log/internal/log_message.cc +158 -64
  1227. data/third_party/abseil-cpp/absl/log/internal/log_message.h +140 -83
  1228. data/third_party/abseil-cpp/absl/log/internal/nullstream.h +1 -0
  1229. data/third_party/abseil-cpp/absl/log/internal/proto.cc +3 -5
  1230. data/third_party/abseil-cpp/absl/log/internal/proto.h +28 -18
  1231. data/third_party/abseil-cpp/absl/log/internal/strip.h +4 -12
  1232. data/third_party/abseil-cpp/absl/log/internal/structured_proto.cc +115 -0
  1233. data/third_party/abseil-cpp/absl/log/internal/structured_proto.h +107 -0
  1234. data/third_party/abseil-cpp/absl/log/internal/vlog_config.cc +8 -1
  1235. data/third_party/abseil-cpp/absl/log/internal/vlog_config.h +8 -6
  1236. data/third_party/abseil-cpp/absl/log/internal/voidify.h +10 -4
  1237. data/third_party/abseil-cpp/absl/log/log.h +48 -35
  1238. data/third_party/abseil-cpp/absl/log/log_sink_registry.h +5 -2
  1239. data/third_party/abseil-cpp/absl/log/vlog_is_on.h +2 -0
  1240. data/third_party/abseil-cpp/absl/meta/type_traits.h +62 -181
  1241. data/third_party/abseil-cpp/absl/numeric/bits.h +68 -2
  1242. data/third_party/abseil-cpp/absl/numeric/int128.cc +0 -52
  1243. data/third_party/abseil-cpp/absl/numeric/int128.h +15 -3
  1244. data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +6 -4
  1245. data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +6 -3
  1246. data/third_party/abseil-cpp/absl/numeric/internal/bits.h +7 -3
  1247. data/third_party/abseil-cpp/absl/profiling/internal/exponential_biased.cc +1 -1
  1248. data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +3 -1
  1249. data/third_party/abseil-cpp/absl/random/beta_distribution.h +3 -1
  1250. data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +12 -12
  1251. data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +10 -0
  1252. data/third_party/abseil-cpp/absl/random/discrete_distribution.h +4 -2
  1253. data/third_party/abseil-cpp/absl/random/distributions.h +6 -8
  1254. data/third_party/abseil-cpp/absl/random/exponential_distribution.h +1 -0
  1255. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +3 -2
  1256. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +8 -7
  1257. data/third_party/abseil-cpp/absl/random/internal/{pool_urbg.cc → entropy_pool.cc} +22 -90
  1258. data/third_party/abseil-cpp/absl/random/internal/entropy_pool.h +35 -0
  1259. data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +5 -2
  1260. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +5 -6
  1261. data/third_party/abseil-cpp/absl/random/internal/platform.h +12 -12
  1262. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +57 -6
  1263. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +2 -1
  1264. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +20 -12
  1265. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +5 -5
  1266. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +2 -2
  1267. data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +0 -1
  1268. data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +1 -4
  1269. data/third_party/abseil-cpp/absl/random/poisson_distribution.h +4 -3
  1270. data/third_party/abseil-cpp/absl/random/random.h +88 -53
  1271. data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +2 -3
  1272. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +6 -2
  1273. data/third_party/abseil-cpp/absl/random/seed_sequences.h +1 -2
  1274. data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +2 -1
  1275. data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +2 -0
  1276. data/third_party/abseil-cpp/absl/random/zipf_distribution.h +5 -4
  1277. data/third_party/abseil-cpp/absl/status/internal/status_internal.cc +10 -7
  1278. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +3 -4
  1279. data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +4 -3
  1280. data/third_party/abseil-cpp/absl/status/status.cc +4 -8
  1281. data/third_party/abseil-cpp/absl/status/status.h +8 -8
  1282. data/third_party/abseil-cpp/absl/status/status_payload_printer.h +2 -2
  1283. data/third_party/abseil-cpp/absl/status/statusor.cc +2 -2
  1284. data/third_party/abseil-cpp/absl/status/statusor.h +6 -6
  1285. data/third_party/abseil-cpp/absl/strings/ascii.cc +44 -29
  1286. data/third_party/abseil-cpp/absl/strings/ascii.h +62 -22
  1287. data/third_party/abseil-cpp/absl/strings/charconv.cc +25 -29
  1288. data/third_party/abseil-cpp/absl/strings/charconv.h +5 -5
  1289. data/third_party/abseil-cpp/absl/strings/charset.h +3 -4
  1290. data/third_party/abseil-cpp/absl/strings/cord.cc +54 -58
  1291. data/third_party/abseil-cpp/absl/strings/cord.h +99 -102
  1292. data/third_party/abseil-cpp/absl/strings/cord_analysis.cc +11 -11
  1293. data/third_party/abseil-cpp/absl/strings/cord_analysis.h +3 -3
  1294. data/third_party/abseil-cpp/absl/strings/escaping.cc +186 -197
  1295. data/third_party/abseil-cpp/absl/strings/escaping.h +9 -10
  1296. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +1 -1
  1297. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +1 -1
  1298. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +53 -22
  1299. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +0 -4
  1300. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +0 -4
  1301. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +7 -63
  1302. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +1 -11
  1303. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +0 -22
  1304. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +3 -2
  1305. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +5 -3
  1306. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +4 -2
  1307. data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +3 -3
  1308. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +35 -0
  1309. data/third_party/abseil-cpp/absl/strings/internal/string_constant.h +0 -5
  1310. data/third_party/abseil-cpp/absl/strings/internal/utf8.cc +96 -1
  1311. data/third_party/abseil-cpp/absl/strings/internal/utf8.h +15 -1
  1312. data/third_party/abseil-cpp/absl/strings/match.h +21 -11
  1313. data/third_party/abseil-cpp/absl/strings/numbers.cc +55 -33
  1314. data/third_party/abseil-cpp/absl/strings/numbers.h +87 -58
  1315. data/third_party/abseil-cpp/absl/strings/str_cat.cc +6 -7
  1316. data/third_party/abseil-cpp/absl/strings/str_cat.h +41 -30
  1317. data/third_party/abseil-cpp/absl/strings/str_format.h +18 -18
  1318. data/third_party/abseil-cpp/absl/strings/str_replace.cc +3 -3
  1319. data/third_party/abseil-cpp/absl/strings/str_replace.h +6 -6
  1320. data/third_party/abseil-cpp/absl/strings/str_split.h +18 -1
  1321. data/third_party/abseil-cpp/absl/strings/string_view.cc +4 -9
  1322. data/third_party/abseil-cpp/absl/strings/string_view.h +46 -50
  1323. data/third_party/abseil-cpp/absl/strings/strip.h +11 -8
  1324. data/third_party/abseil-cpp/absl/strings/substitute.cc +5 -4
  1325. data/third_party/abseil-cpp/absl/strings/substitute.h +66 -64
  1326. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +16 -10
  1327. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +6 -0
  1328. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +5 -1
  1329. data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.cc +0 -4
  1330. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.cc +0 -5
  1331. data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.cc +0 -4
  1332. data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.cc +0 -4
  1333. data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.cc +0 -4
  1334. data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.cc +0 -4
  1335. data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.cc +0 -4
  1336. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +39 -13
  1337. data/third_party/abseil-cpp/absl/synchronization/mutex.h +97 -69
  1338. data/third_party/abseil-cpp/absl/synchronization/notification.cc +10 -2
  1339. data/third_party/abseil-cpp/absl/synchronization/notification.h +12 -2
  1340. data/third_party/abseil-cpp/absl/time/civil_time.cc +1 -0
  1341. data/third_party/abseil-cpp/absl/time/duration.cc +18 -58
  1342. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +1 -1
  1343. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
  1344. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +1 -1
  1345. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +3 -3
  1346. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +2 -2
  1347. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +2 -2
  1348. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +3 -3
  1349. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +2 -2
  1350. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +1 -1
  1351. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +1 -1
  1352. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +92 -112
  1353. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +1 -1
  1354. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +6 -4
  1355. data/third_party/abseil-cpp/absl/time/time.h +89 -23
  1356. data/third_party/abseil-cpp/absl/types/internal/span.h +3 -2
  1357. data/third_party/abseil-cpp/absl/types/optional.h +7 -745
  1358. data/third_party/abseil-cpp/absl/types/span.h +98 -54
  1359. data/third_party/abseil-cpp/absl/types/variant.h +5 -784
  1360. data/third_party/abseil-cpp/absl/utility/utility.h +10 -185
  1361. data/third_party/boringssl-with-bazel/src/crypto/aes/aes.cc +41 -0
  1362. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.cc +16 -0
  1363. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.cc +15 -0
  1364. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +19 -3
  1365. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.cc +79 -48
  1366. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.cc +11 -19
  1367. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.cc +3 -7
  1368. data/third_party/boringssl-with-bazel/src/crypto/bcm_support.h +0 -35
  1369. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.cc +0 -2
  1370. data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +3 -5
  1371. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.cc +0 -3
  1372. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.cc +0 -2
  1373. data/third_party/boringssl-with-bazel/src/crypto/bn/convert.cc +31 -47
  1374. data/third_party/boringssl-with-bazel/src/crypto/bn/div.cc +100 -0
  1375. data/third_party/boringssl-with-bazel/src/crypto/bn/exponentiation.cc +166 -0
  1376. data/third_party/boringssl-with-bazel/src/crypto/bn/sqrt.cc +93 -0
  1377. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.cc +14 -8
  1378. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.cc +1 -1
  1379. data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +3 -3
  1380. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +4 -4
  1381. data/third_party/boringssl-with-bazel/src/crypto/cipher/derive_key.cc +13 -15
  1382. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_aeseax.cc +289 -0
  1383. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_aesgcmsiv.cc +179 -102
  1384. data/third_party/boringssl-with-bazel/src/crypto/cipher/internal.h +3 -3
  1385. data/third_party/boringssl-with-bazel/src/crypto/cms/cms.cc +172 -0
  1386. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.cc +0 -2
  1387. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_fuchsia.cc +0 -2
  1388. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_linux.cc +0 -2
  1389. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.cc +0 -2
  1390. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_sysreg.cc +0 -2
  1391. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.cc +0 -2
  1392. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_freebsd.cc +0 -1
  1393. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.cc +28 -6
  1394. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.h +11 -9
  1395. data/third_party/boringssl-with-bazel/src/crypto/cpu_intel.cc +0 -6
  1396. data/third_party/boringssl-with-bazel/src/crypto/crypto.cc +1 -3
  1397. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +3 -3
  1398. data/third_party/boringssl-with-bazel/src/crypto/des/internal.h +3 -3
  1399. data/third_party/boringssl-with-bazel/src/crypto/dh/dh_asn1.cc +13 -14
  1400. data/third_party/boringssl-with-bazel/src/crypto/dh/params.cc +27 -61
  1401. data/third_party/boringssl-with-bazel/src/crypto/digest/digest_extra.cc +16 -8
  1402. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.cc +112 -122
  1403. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.cc +23 -35
  1404. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +3 -3
  1405. data/third_party/boringssl-with-bazel/src/crypto/ec/ec_asn1.cc +47 -63
  1406. data/third_party/boringssl-with-bazel/src/crypto/ec/hash_to_curve.cc +60 -68
  1407. data/third_party/boringssl-with-bazel/src/crypto/ec/internal.h +3 -3
  1408. data/third_party/boringssl-with-bazel/src/crypto/ecdsa/ecdsa_asn1.cc +11 -17
  1409. data/third_party/boringssl-with-bazel/src/crypto/err/err.cc +0 -2
  1410. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.cc +10 -11
  1411. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_ctx.cc +10 -11
  1412. data/third_party/boringssl-with-bazel/src/crypto/evp/internal.h +3 -3
  1413. data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.cc +6 -6
  1414. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.cc +6 -6
  1415. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ed25519_asn1.cc +6 -6
  1416. data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa_asn1.cc +6 -6
  1417. data/third_party/boringssl-with-bazel/src/crypto/evp/p_x25519_asn1.cc +6 -6
  1418. data/third_party/boringssl-with-bazel/src/crypto/evp/sign.cc +23 -42
  1419. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.cc.inc +29 -18
  1420. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/gcm.cc.inc +10 -10
  1421. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +16 -45
  1422. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/key_wrap.cc.inc +5 -4
  1423. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.cc.inc +15 -6
  1424. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.cc +3 -3
  1425. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +101 -5
  1426. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.cc.inc +96 -187
  1427. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.cc.inc +24 -512
  1428. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.cc.inc +58 -80
  1429. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.cc.inc +29 -45
  1430. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +27 -25
  1431. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/jacobi.cc.inc +7 -16
  1432. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.cc.inc +27 -48
  1433. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.cc.inc +34 -34
  1434. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.cc.inc +102 -154
  1435. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.h +3 -3
  1436. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/shift.cc.inc +3 -8
  1437. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.cc.inc +1 -78
  1438. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.cc.inc +10 -17
  1439. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h +3 -3
  1440. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +15 -8
  1441. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/check.cc.inc +40 -53
  1442. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.cc.inc +57 -76
  1443. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.cc.inc +4 -10
  1444. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h +3 -3
  1445. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +3 -3
  1446. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.cc.inc +37 -52
  1447. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.cc.inc +13 -20
  1448. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +3 -3
  1449. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.cc.inc +28 -39
  1450. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.h +3 -3
  1451. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.cc.inc +6 -11
  1452. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/keccak/internal.h +3 -3
  1453. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mldsa/fips_known_values.inc +1345 -0
  1454. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mldsa/mldsa.cc.inc +335 -28
  1455. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mlkem/fips_known_values.inc +411 -0
  1456. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mlkem/mlkem.cc.inc +265 -33
  1457. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +3 -3
  1458. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.cc.inc +1 -1
  1459. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +3 -3
  1460. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.cc.inc +19 -26
  1461. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.cc.inc +7 -7
  1462. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.cc.inc +121 -138
  1463. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.cc.inc +96 -83
  1464. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/internal.h +3 -3
  1465. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +8 -20
  1466. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/fips_known_values.inc +674 -0
  1467. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +235 -60
  1468. data/third_party/boringssl-with-bazel/src/crypto/fuzzer_mode.cc +30 -0
  1469. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +3 -3
  1470. data/third_party/boringssl-with-bazel/src/crypto/internal.h +59 -33
  1471. data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +3 -3
  1472. data/third_party/boringssl-with-bazel/src/crypto/md5/internal.h +3 -3
  1473. data/third_party/boringssl-with-bazel/src/crypto/mem.cc +0 -2
  1474. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.cc +2 -8
  1475. data/third_party/boringssl-with-bazel/src/crypto/pem/internal.h +3 -3
  1476. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.cc +8 -13
  1477. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +22 -8
  1478. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.cc +19 -17
  1479. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.cc +134 -136
  1480. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +14 -8
  1481. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.cc +25 -21
  1482. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.cc +36 -52
  1483. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.cc +97 -79
  1484. data/third_party/boringssl-with-bazel/src/crypto/poly1305/internal.h +3 -3
  1485. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +3 -3
  1486. data/third_party/boringssl-with-bazel/src/crypto/rand/deterministic.cc +1 -1
  1487. data/third_party/boringssl-with-bazel/src/crypto/rand/fork_detect.cc +2 -2
  1488. data/third_party/boringssl-with-bazel/src/crypto/rand/getentropy.cc +1 -1
  1489. data/third_party/boringssl-with-bazel/src/crypto/rand/{sysrand_internal.h → internal.h} +22 -4
  1490. data/third_party/boringssl-with-bazel/src/crypto/rand/ios.cc +1 -1
  1491. data/third_party/boringssl-with-bazel/src/crypto/rand/trusty.cc +1 -1
  1492. data/third_party/boringssl-with-bazel/src/crypto/rand/urandom.cc +1 -1
  1493. data/third_party/boringssl-with-bazel/src/crypto/rand/windows.cc +1 -5
  1494. data/third_party/boringssl-with-bazel/src/crypto/rsa/internal.h +3 -3
  1495. data/third_party/boringssl-with-bazel/src/crypto/rsa/rsa_crypt.cc +14 -22
  1496. data/third_party/boringssl-with-bazel/src/crypto/spake2plus/internal.h +3 -3
  1497. data/third_party/boringssl-with-bazel/src/crypto/thread_win.cc +0 -2
  1498. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +3 -3
  1499. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.cc +3 -5
  1500. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.cc +8 -12
  1501. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +15 -3
  1502. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_conf.cc +16 -24
  1503. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_info.cc +18 -21
  1504. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.cc +10 -3
  1505. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.cc +9 -0
  1506. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.cc +10 -1
  1507. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.cc +64 -85
  1508. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.cc +16 -32
  1509. data/third_party/boringssl-with-bazel/src/gen/crypto/err_data.cc +576 -567
  1510. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +16 -8
  1511. data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +1 -1
  1512. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +3 -25
  1513. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +6 -54
  1514. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +1 -1
  1515. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +8 -4
  1516. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +1 -1
  1517. data/third_party/boringssl-with-bazel/src/include/openssl/bcm_public.h +1 -1
  1518. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +1 -1
  1519. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -1
  1520. data/third_party/boringssl-with-bazel/src/include/openssl/blowfish.h +1 -1
  1521. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +1 -1
  1522. data/third_party/boringssl-with-bazel/src/include/openssl/buf.h +1 -1
  1523. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +7 -1
  1524. data/third_party/boringssl-with-bazel/src/include/openssl/cast.h +1 -1
  1525. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  1526. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +1 -1
  1527. data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +1 -1
  1528. data/third_party/boringssl-with-bazel/src/include/openssl/cms.h +146 -0
  1529. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +1 -1
  1530. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +23 -3
  1531. data/third_party/boringssl-with-bazel/src/include/openssl/ctrdrbg.h +1 -1
  1532. data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +1 -1
  1533. data/third_party/boringssl-with-bazel/src/include/openssl/des.h +1 -1
  1534. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +1 -1
  1535. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +19 -7
  1536. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +1 -1
  1537. data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +1 -1
  1538. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +1 -1
  1539. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +1 -1
  1540. data/third_party/boringssl-with-bazel/src/include/openssl/ecdh.h +1 -1
  1541. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +1 -1
  1542. data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +1 -1
  1543. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -1
  1544. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +1 -1
  1545. data/third_party/boringssl-with-bazel/src/include/openssl/ex_data.h +1 -1
  1546. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/kyber.h +1 -1
  1547. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +1 -1
  1548. data/third_party/boringssl-with-bazel/src/include/openssl/hmac.h +1 -1
  1549. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +4 -4
  1550. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +1 -1
  1551. data/third_party/boringssl-with-bazel/src/include/openssl/kdf.h +1 -1
  1552. data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +1 -1
  1553. data/third_party/boringssl-with-bazel/src/include/openssl/md4.h +1 -1
  1554. data/third_party/boringssl-with-bazel/src/include/openssl/md5.h +1 -1
  1555. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +1 -1
  1556. data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +1 -1
  1557. data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +1 -1
  1558. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +1 -1
  1559. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +1 -1
  1560. data/third_party/boringssl-with-bazel/src/include/openssl/obj_mac.h +1 -1
  1561. data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +10 -4
  1562. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +1 -1
  1563. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +19 -6
  1564. data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +1 -1
  1565. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +1 -1
  1566. data/third_party/boringssl-with-bazel/src/include/openssl/posix_time.h +1 -1
  1567. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +2 -2
  1568. data/third_party/boringssl-with-bazel/src/include/openssl/rc4.h +1 -1
  1569. data/third_party/boringssl-with-bazel/src/include/openssl/ripemd.h +1 -1
  1570. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +2 -2
  1571. data/third_party/boringssl-with-bazel/src/include/openssl/service_indicator.h +1 -1
  1572. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +1 -1
  1573. data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +1 -1
  1574. data/third_party/boringssl-with-bazel/src/include/openssl/slhdsa.h +1 -1
  1575. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +1 -1
  1576. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +291 -40
  1577. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +1 -1
  1578. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +0 -5
  1579. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -1
  1580. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +9 -1
  1581. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -1
  1582. data/third_party/boringssl-with-bazel/src/include/openssl/type_check.h +1 -1
  1583. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +7 -4
  1584. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +2 -0
  1585. data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +32 -26
  1586. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +49 -49
  1587. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +256 -57
  1588. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +12 -12
  1589. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +7 -5
  1590. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +3 -2
  1591. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +25 -33
  1592. data/third_party/boringssl-with-bazel/src/ssl/internal.h +106 -10
  1593. data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +6 -12
  1594. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +18 -4
  1595. data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +85 -8
  1596. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +1 -1
  1597. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +173 -19
  1598. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +5 -18
  1599. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +28 -15
  1600. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +1 -1
  1601. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +31 -7
  1602. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +14 -2
  1603. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +7 -11
  1604. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +14 -12
  1605. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +2 -5
  1606. data/third_party/upb/upb/base/internal/log2.h +3 -1
  1607. data/third_party/upb/upb/base/string_view.h +10 -0
  1608. data/third_party/upb/upb/hash/common.c +312 -187
  1609. data/third_party/upb/upb/hash/common.h +44 -43
  1610. data/third_party/upb/upb/hash/int_table.h +29 -5
  1611. data/third_party/upb/upb/hash/str_table.h +6 -0
  1612. data/third_party/upb/upb/json/decode.c +2 -2
  1613. data/third_party/upb/upb/json/decode.h +0 -1
  1614. data/third_party/upb/upb/mem/alloc.h +5 -0
  1615. data/third_party/upb/upb/mem/arena.c +437 -160
  1616. data/third_party/upb/upb/mem/arena.h +57 -11
  1617. data/third_party/upb/upb/mem/arena.hpp +4 -20
  1618. data/third_party/upb/upb/mem/internal/arena.h +65 -29
  1619. data/third_party/upb/upb/message/accessors.c +1 -5
  1620. data/third_party/upb/upb/message/accessors.h +41 -0
  1621. data/third_party/upb/upb/message/array.c +7 -6
  1622. data/third_party/upb/upb/message/array.h +4 -4
  1623. data/third_party/upb/upb/message/compat.c +11 -14
  1624. data/third_party/upb/upb/message/compat.h +4 -3
  1625. data/third_party/upb/upb/message/copy.c +35 -30
  1626. data/third_party/upb/upb/message/internal/accessors.h +142 -13
  1627. data/third_party/upb/upb/message/internal/extension.c +16 -25
  1628. data/third_party/upb/upb/message/internal/extension.h +17 -5
  1629. data/third_party/upb/upb/message/internal/iterator.c +58 -0
  1630. data/third_party/upb/upb/message/internal/iterator.h +29 -0
  1631. data/third_party/upb/upb/message/internal/map.h +76 -22
  1632. data/third_party/upb/upb/message/internal/map_sorter.h +13 -4
  1633. data/third_party/upb/upb/message/internal/message.c +48 -29
  1634. data/third_party/upb/upb/message/internal/message.h +203 -25
  1635. data/third_party/upb/upb/message/map.c +68 -20
  1636. data/third_party/upb/upb/message/map.h +8 -1
  1637. data/third_party/upb/upb/message/map_gencode_util.h +3 -45
  1638. data/third_party/upb/upb/message/map_sorter.c +52 -16
  1639. data/third_party/upb/upb/message/merge.h +3 -3
  1640. data/third_party/upb/upb/message/message.c +200 -42
  1641. data/third_party/upb/upb/message/message.h +69 -4
  1642. data/third_party/upb/upb/message/value.h +9 -0
  1643. data/third_party/upb/upb/mini_descriptor/build_enum.c +16 -6
  1644. data/third_party/upb/upb/mini_descriptor/decode.c +115 -138
  1645. data/third_party/upb/upb/mini_descriptor/decode.h +4 -3
  1646. data/third_party/upb/upb/mini_descriptor/internal/encode.hpp +1 -1
  1647. data/third_party/upb/upb/mini_descriptor/link.c +4 -0
  1648. data/third_party/upb/upb/mini_table/extension.h +8 -1
  1649. data/third_party/upb/upb/mini_table/extension_registry.c +25 -13
  1650. data/third_party/upb/upb/mini_table/extension_registry.h +13 -6
  1651. data/third_party/upb/upb/mini_table/internal/enum.h +1 -1
  1652. data/third_party/upb/upb/mini_table/internal/extension.h +24 -1
  1653. data/third_party/upb/upb/mini_table/internal/field.h +4 -4
  1654. data/third_party/upb/upb/mini_table/internal/message.h +1 -1
  1655. data/third_party/upb/upb/mini_table/message.c +21 -13
  1656. data/third_party/upb/upb/port/atomic.h +134 -7
  1657. data/third_party/upb/upb/port/def.inc +163 -45
  1658. data/third_party/upb/upb/port/undef.inc +12 -1
  1659. data/third_party/upb/upb/reflection/def.hpp +5 -1
  1660. data/third_party/upb/upb/reflection/def_pool.c +10 -3
  1661. data/third_party/upb/upb/reflection/def_pool.h +2 -2
  1662. data/third_party/upb/upb/reflection/descriptor_bootstrap.h +4 -4
  1663. data/third_party/upb/upb/reflection/enum_def.c +4 -4
  1664. data/third_party/upb/upb/reflection/enum_reserved_range.c +1 -1
  1665. data/third_party/upb/upb/reflection/enum_value_def.c +9 -8
  1666. data/third_party/upb/upb/reflection/extension_range.c +1 -2
  1667. data/third_party/upb/upb/reflection/field_def.c +3 -5
  1668. data/third_party/upb/upb/reflection/field_def.h +1 -1
  1669. data/third_party/upb/upb/reflection/file_def.c +16 -10
  1670. data/third_party/upb/upb/reflection/internal/def_builder.c +1 -1
  1671. data/third_party/upb/upb/reflection/internal/def_builder.h +35 -10
  1672. data/third_party/upb/upb/reflection/internal/enum_value_def.h +1 -1
  1673. data/third_party/upb/upb/reflection/internal/upb_edition_defaults.h +1 -1
  1674. data/third_party/upb/upb/reflection/message.c +19 -16
  1675. data/third_party/upb/upb/reflection/message.h +3 -1
  1676. data/third_party/upb/upb/reflection/message_def.c +4 -7
  1677. data/third_party/upb/upb/reflection/message_reserved_range.c +1 -1
  1678. data/third_party/upb/upb/reflection/method_def.c +1 -1
  1679. data/third_party/upb/upb/reflection/oneof_def.c +3 -3
  1680. data/third_party/upb/upb/reflection/service_def.c +2 -5
  1681. data/third_party/upb/upb/text/encode.c +17 -13
  1682. data/third_party/upb/upb/text/internal/encode.c +25 -6
  1683. data/third_party/upb/upb/text/internal/encode.h +6 -1
  1684. data/third_party/upb/upb/wire/decode.c +154 -107
  1685. data/third_party/upb/upb/wire/decode.h +4 -2
  1686. data/third_party/upb/upb/wire/encode.c +114 -55
  1687. data/third_party/upb/upb/wire/encode.h +2 -0
  1688. data/third_party/upb/upb/wire/eps_copy_input_stream.h +18 -20
  1689. data/third_party/upb/upb/wire/internal/decode_fast.c +2 -2
  1690. data/third_party/upb/upb/wire/internal/decode_fast.h +4 -0
  1691. data/third_party/upb/upb/wire/internal/decoder.h +4 -11
  1692. data/third_party/utf8_range/utf8_range.c +15 -275
  1693. data/third_party/utf8_range/utf8_range_neon.inc +117 -0
  1694. data/third_party/utf8_range/utf8_range_sse.inc +272 -0
  1695. data/third_party/zlib/deflate.c +40 -15
  1696. data/third_party/zlib/deflate.h +33 -2
  1697. data/third_party/zlib/gzguts.h +2 -6
  1698. data/third_party/zlib/inflate.c +1 -1
  1699. data/third_party/zlib/inftrees.c +3 -3
  1700. data/third_party/zlib/inftrees.h +2 -2
  1701. data/third_party/zlib/trees.c +18 -4
  1702. data/third_party/zlib/zconf.h +1 -9
  1703. data/third_party/zlib/zlib.h +12 -12
  1704. data/third_party/zlib/zutil.h +4 -25
  1705. metadata +266 -168
  1706. data/include/grpc/grpc_cronet.h +0 -37
  1707. data/src/core/lib/event_engine/forkable.cc +0 -105
  1708. data/src/core/lib/event_engine/forkable.h +0 -67
  1709. data/src/core/lib/iomgr/executor.cc +0 -441
  1710. data/src/core/lib/iomgr/executor.h +0 -119
  1711. data/src/core/lib/iomgr/python_util.h +0 -46
  1712. data/src/core/lib/transport/http2_errors.h +0 -43
  1713. data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +0 -108
  1714. data/third_party/abseil-cpp/absl/base/internal/invoke.h +0 -241
  1715. data/third_party/abseil-cpp/absl/base/internal/nullability_impl.h +0 -108
  1716. data/third_party/abseil-cpp/absl/log/log_entry.cc +0 -41
  1717. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +0 -131
  1718. data/third_party/abseil-cpp/absl/types/bad_optional_access.cc +0 -66
  1719. data/third_party/abseil-cpp/absl/types/bad_optional_access.h +0 -78
  1720. data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +0 -82
  1721. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +0 -82
  1722. data/third_party/abseil-cpp/absl/types/internal/optional.h +0 -352
  1723. data/third_party/abseil-cpp/absl/types/internal/variant.h +0 -1622
  1724. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/polyval.cc.inc +0 -89
  1725. data/third_party/upb/upb/message/internal/compare_unknown.c +0 -289
  1726. data/third_party/upb/upb/message/internal/compare_unknown.h +0 -49
@@ -24,9 +24,13 @@
24
24
  #include "absl/base/config.h"
25
25
  #include "absl/base/dynamic_annotations.h"
26
26
  #include "absl/base/internal/endian.h"
27
+ #include "absl/base/internal/raw_logging.h"
27
28
  #include "absl/base/optimization.h"
28
29
  #include "absl/container/internal/container_memory.h"
30
+ #include "absl/container/internal/hashtable_control_bytes.h"
29
31
  #include "absl/container/internal/hashtablez_sampler.h"
32
+ #include "absl/container/internal/raw_hash_set_resize_impl.h"
33
+ #include "absl/functional/function_ref.h"
30
34
  #include "absl/hash/hash.h"
31
35
 
32
36
  namespace absl {
@@ -63,21 +67,31 @@ ABSL_CONST_INIT ABSL_DLL const ctrl_t kSooControl[17] = {
63
67
  static_assert(NumControlBytes(SooCapacity()) <= 17,
64
68
  "kSooControl capacity too small");
65
69
 
66
- #ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
67
- constexpr size_t Group::kWidth;
70
+ namespace {
71
+
72
+ #ifdef ABSL_SWISSTABLE_ASSERT
73
+ #error ABSL_SWISSTABLE_ASSERT cannot be directly set
74
+ #else
75
+ // We use this macro for assertions that users may see when the table is in an
76
+ // invalid state that sanitizers may help diagnose.
77
+ #define ABSL_SWISSTABLE_ASSERT(CONDITION) \
78
+ assert((CONDITION) && "Try enabling sanitizers.")
68
79
  #endif
69
80
 
70
- namespace {
81
+ [[noreturn]] ABSL_ATTRIBUTE_NOINLINE void HashTableSizeOverflow() {
82
+ ABSL_RAW_LOG(FATAL, "Hash table size overflow");
83
+ }
84
+
85
+ void ValidateMaxSize(size_t size, size_t slot_size) {
86
+ if (IsAboveValidSize(size, slot_size)) {
87
+ HashTableSizeOverflow();
88
+ }
89
+ }
71
90
 
72
91
  // Returns "random" seed.
73
92
  inline size_t RandomSeed() {
74
93
  #ifdef ABSL_HAVE_THREAD_LOCAL
75
94
  static thread_local size_t counter = 0;
76
- // On Linux kernels >= 5.4 the MSAN runtime has a false-positive when
77
- // accessing thread local storage data from loaded libraries
78
- // (https://github.com/google/sanitizers/issues/1265), for this reason counter
79
- // needs to be annotated as initialized.
80
- ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&counter, sizeof(size_t));
81
95
  size_t value = ++counter;
82
96
  #else // ABSL_HAVE_THREAD_LOCAL
83
97
  static std::atomic<size_t> counter(0);
@@ -86,16 +100,37 @@ inline size_t RandomSeed() {
86
100
  return value ^ static_cast<size_t>(reinterpret_cast<uintptr_t>(&counter));
87
101
  }
88
102
 
89
- bool ShouldRehashForBugDetection(const ctrl_t* ctrl, size_t capacity) {
103
+ bool ShouldRehashForBugDetection(PerTableSeed seed, size_t capacity) {
90
104
  // Note: we can't use the abseil-random library because abseil-random
91
105
  // depends on swisstable. We want to return true with probability
92
106
  // `min(1, RehashProbabilityConstant() / capacity())`. In order to do this,
93
107
  // we probe based on a random hash and see if the offset is less than
94
108
  // RehashProbabilityConstant().
95
- return probe(ctrl, capacity, absl::HashOf(RandomSeed())).offset() <
109
+ return probe(seed, capacity, absl::HashOf(RandomSeed())).offset() <
96
110
  RehashProbabilityConstant();
97
111
  }
98
112
 
113
+ // Find a non-deterministic hash for single group table.
114
+ // Last two bits are used to find a position for a newly inserted element after
115
+ // resize.
116
+ // This function basically using H2 last bits to save on shift operation.
117
+ size_t SingleGroupTableH1(size_t hash, PerTableSeed seed) {
118
+ return hash ^ seed.seed();
119
+ }
120
+
121
+ // Returns the address of the slot `i` iterations after `slot` assuming each
122
+ // slot has the specified size.
123
+ inline void* NextSlot(void* slot, size_t slot_size, size_t i = 1) {
124
+ return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot) +
125
+ slot_size * i);
126
+ }
127
+
128
+ // Returns the address of the slot just before `slot` assuming each slot has the
129
+ // specified size.
130
+ inline void* PrevSlot(void* slot, size_t slot_size) {
131
+ return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot) - slot_size);
132
+ }
133
+
99
134
  } // namespace
100
135
 
101
136
  GenerationType* EmptyGeneration() {
@@ -109,42 +144,104 @@ GenerationType* EmptyGeneration() {
109
144
  }
110
145
 
111
146
  bool CommonFieldsGenerationInfoEnabled::
112
- should_rehash_for_bug_detection_on_insert(const ctrl_t* ctrl,
147
+ should_rehash_for_bug_detection_on_insert(PerTableSeed seed,
113
148
  size_t capacity) const {
114
149
  if (reserved_growth_ == kReservedGrowthJustRanOut) return true;
115
150
  if (reserved_growth_ > 0) return false;
116
- return ShouldRehashForBugDetection(ctrl, capacity);
151
+ return ShouldRehashForBugDetection(seed, capacity);
117
152
  }
118
153
 
119
154
  bool CommonFieldsGenerationInfoEnabled::should_rehash_for_bug_detection_on_move(
120
- const ctrl_t* ctrl, size_t capacity) const {
121
- return ShouldRehashForBugDetection(ctrl, capacity);
155
+ PerTableSeed seed, size_t capacity) const {
156
+ return ShouldRehashForBugDetection(seed, capacity);
157
+ }
158
+
159
+ namespace {
160
+
161
+ FindInfo find_first_non_full_from_h1(const ctrl_t* ctrl, size_t h1,
162
+ size_t capacity) {
163
+ auto seq = probe(h1, capacity);
164
+ if (IsEmptyOrDeleted(ctrl[seq.offset()])) {
165
+ return {seq.offset(), /*probe_length=*/0};
166
+ }
167
+ while (true) {
168
+ GroupFullEmptyOrDeleted g{ctrl + seq.offset()};
169
+ auto mask = g.MaskEmptyOrDeleted();
170
+ if (mask) {
171
+ return {seq.offset(mask.LowestBitSet()), seq.index()};
172
+ }
173
+ seq.next();
174
+ ABSL_SWISSTABLE_ASSERT(seq.index() <= capacity && "full table!");
175
+ }
122
176
  }
123
177
 
124
- bool ShouldInsertBackwardsForDebug(size_t capacity, size_t hash,
125
- const ctrl_t* ctrl) {
126
- // To avoid problems with weak hashes and single bit tests, we use % 13.
127
- // TODO(kfm,sbenza): revisit after we do unconditional mixing
128
- return !is_small(capacity) && (H1(hash, ctrl) ^ RandomSeed()) % 13 > 6;
178
+ // Whether a table is "small". A small table fits entirely into a probing
179
+ // group, i.e., has a capacity < `Group::kWidth`.
180
+ //
181
+ // In small mode we are able to use the whole capacity. The extra control
182
+ // bytes give us at least one "empty" control byte to stop the iteration.
183
+ // This is important to make 1 a valid capacity.
184
+ //
185
+ // In small mode only the first `capacity` control bytes after the sentinel
186
+ // are valid. The rest contain dummy ctrl_t::kEmpty values that do not
187
+ // represent a real slot.
188
+ constexpr bool is_small(size_t capacity) {
189
+ return capacity < Group::kWidth - 1;
129
190
  }
130
191
 
131
- size_t PrepareInsertAfterSoo(size_t hash, size_t slot_size,
132
- CommonFields& common) {
133
- assert(common.capacity() == NextCapacity(SooCapacity()));
134
- // After resize from capacity 1 to 3, we always have exactly the slot with
135
- // index 1 occupied, so we need to insert either at index 0 or index 2.
136
- assert(HashSetResizeHelper::SooSlotIndex() == 1);
137
- PrepareInsertCommon(common);
138
- const size_t offset = H1(hash, common.control()) & 2;
139
- common.growth_info().OverwriteEmptyAsFull();
140
- SetCtrlInSingleGroupTable(common, offset, H2(hash), slot_size);
141
- common.infoz().RecordInsert(hash, /*distance_from_desired=*/0);
142
- return offset;
192
+ template <class Fn>
193
+ void IterateOverFullSlotsImpl(const CommonFields& c, size_t slot_size, Fn cb) {
194
+ const size_t cap = c.capacity();
195
+ const ctrl_t* ctrl = c.control();
196
+ void* slot = c.slot_array();
197
+ if (is_small(cap)) {
198
+ // Mirrored/cloned control bytes in small table are also located in the
199
+ // first group (starting from position 0). We are taking group from position
200
+ // `capacity` in order to avoid duplicates.
201
+
202
+ // Small tables capacity fits into portable group, where
203
+ // GroupPortableImpl::MaskFull is more efficient for the
204
+ // capacity <= GroupPortableImpl::kWidth.
205
+ ABSL_SWISSTABLE_ASSERT(cap <= GroupPortableImpl::kWidth &&
206
+ "unexpectedly large small capacity");
207
+ static_assert(Group::kWidth >= GroupPortableImpl::kWidth,
208
+ "unexpected group width");
209
+ // Group starts from kSentinel slot, so indices in the mask will
210
+ // be increased by 1.
211
+ const auto mask = GroupPortableImpl(ctrl + cap).MaskFull();
212
+ --ctrl;
213
+ slot = PrevSlot(slot, slot_size);
214
+ for (uint32_t i : mask) {
215
+ cb(ctrl + i, SlotAddress(slot, i, slot_size));
216
+ }
217
+ return;
218
+ }
219
+ size_t remaining = c.size();
220
+ ABSL_ATTRIBUTE_UNUSED const size_t original_size_for_assert = remaining;
221
+ while (remaining != 0) {
222
+ for (uint32_t i : GroupFullEmptyOrDeleted(ctrl).MaskFull()) {
223
+ ABSL_SWISSTABLE_ASSERT(IsFull(ctrl[i]) &&
224
+ "hash table was modified unexpectedly");
225
+ cb(ctrl + i, SlotAddress(slot, i, slot_size));
226
+ --remaining;
227
+ }
228
+ ctrl += Group::kWidth;
229
+ slot = NextSlot(slot, slot_size, Group::kWidth);
230
+ ABSL_SWISSTABLE_ASSERT(
231
+ (remaining == 0 || *(ctrl - 1) != ctrl_t::kSentinel) &&
232
+ "hash table was modified unexpectedly");
233
+ }
234
+ // NOTE: erasure of the current element is allowed in callback for
235
+ // absl::erase_if specialization. So we use `>=`.
236
+ ABSL_SWISSTABLE_ASSERT(original_size_for_assert >= c.size() &&
237
+ "hash table was modified unexpectedly");
143
238
  }
144
239
 
240
+ } // namespace
241
+
145
242
  void ConvertDeletedToEmptyAndFullToDeleted(ctrl_t* ctrl, size_t capacity) {
146
- assert(ctrl[capacity] == ctrl_t::kSentinel);
147
- assert(IsValidCapacity(capacity));
243
+ ABSL_SWISSTABLE_ASSERT(ctrl[capacity] == ctrl_t::kSentinel);
244
+ ABSL_SWISSTABLE_ASSERT(IsValidCapacity(capacity));
148
245
  for (ctrl_t* pos = ctrl; pos < ctrl + capacity; pos += Group::kWidth) {
149
246
  Group{pos}.ConvertSpecialToEmptyAndFullToDeleted(pos);
150
247
  }
@@ -152,26 +249,25 @@ void ConvertDeletedToEmptyAndFullToDeleted(ctrl_t* ctrl, size_t capacity) {
152
249
  std::memcpy(ctrl + capacity + 1, ctrl, NumClonedBytes());
153
250
  ctrl[capacity] = ctrl_t::kSentinel;
154
251
  }
155
- // Extern template instantiation for inline function.
156
- template FindInfo find_first_non_full(const CommonFields&, size_t);
157
252
 
158
- FindInfo find_first_non_full_outofline(const CommonFields& common,
159
- size_t hash) {
160
- return find_first_non_full(common, hash);
253
+ FindInfo find_first_non_full(const CommonFields& common, size_t hash) {
254
+ return find_first_non_full_from_h1(common.control(), H1(hash, common.seed()),
255
+ common.capacity());
256
+ }
257
+
258
+ void IterateOverFullSlots(const CommonFields& c, size_t slot_size,
259
+ absl::FunctionRef<void(const ctrl_t*, void*)> cb) {
260
+ IterateOverFullSlotsImpl(c, slot_size, cb);
161
261
  }
162
262
 
163
263
  namespace {
164
264
 
165
- // Returns the address of the slot just after slot assuming each slot has the
166
- // specified size.
167
- static inline void* NextSlot(void* slot, size_t slot_size) {
168
- return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot) + slot_size);
265
+ void ResetGrowthLeft(GrowthInfo& growth_info, size_t capacity, size_t size) {
266
+ growth_info.InitGrowthLeftNoDeleted(CapacityToGrowth(capacity) - size);
169
267
  }
170
268
 
171
- // Returns the address of the slot just before slot assuming each slot has the
172
- // specified size.
173
- static inline void* PrevSlot(void* slot, size_t slot_size) {
174
- return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot) - slot_size);
269
+ void ResetGrowthLeft(CommonFields& common) {
270
+ ResetGrowthLeft(common.growth_info(), common.capacity(), common.size());
175
271
  }
176
272
 
177
273
  // Finds guaranteed to exists empty slot from the given position.
@@ -184,17 +280,34 @@ size_t FindEmptySlot(size_t start, size_t end, const ctrl_t* ctrl) {
184
280
  return i;
185
281
  }
186
282
  }
187
- assert(false && "no empty slot");
188
- return ~size_t{};
283
+ ABSL_UNREACHABLE();
284
+ }
285
+
286
+ // Finds guaranteed to exist full slot starting from the given position.
287
+ // NOTE: this function is only triggered for rehash(0), when we need to
288
+ // go back to SOO state, so we keep it simple.
289
+ size_t FindFirstFullSlot(size_t start, size_t end, const ctrl_t* ctrl) {
290
+ for (size_t i = start; i < end; ++i) {
291
+ if (IsFull(ctrl[i])) {
292
+ return i;
293
+ }
294
+ }
295
+ ABSL_UNREACHABLE();
296
+ }
297
+
298
+ void PrepareInsertCommon(CommonFields& common) {
299
+ common.increment_size();
300
+ common.maybe_increment_generation_on_insert();
189
301
  }
190
302
 
191
- void DropDeletesWithoutResize(CommonFields& common,
192
- const PolicyFunctions& policy) {
303
+ size_t DropDeletesWithoutResizeAndPrepareInsert(
304
+ CommonFields& common, const PolicyFunctions& __restrict policy,
305
+ size_t new_hash) {
193
306
  void* set = &common;
194
307
  void* slot_array = common.slot_array();
195
308
  const size_t capacity = common.capacity();
196
- assert(IsValidCapacity(capacity));
197
- assert(!is_small(capacity));
309
+ ABSL_SWISSTABLE_ASSERT(IsValidCapacity(capacity));
310
+ ABSL_SWISSTABLE_ASSERT(!is_single_group(capacity));
198
311
  // Algorithm:
199
312
  // - mark all DELETED slots as EMPTY
200
313
  // - mark all FULL slots as DELETED
@@ -215,7 +328,7 @@ void DropDeletesWithoutResize(CommonFields& common,
215
328
  ConvertDeletedToEmptyAndFullToDeleted(ctrl, capacity);
216
329
  const void* hash_fn = policy.hash_fn(common);
217
330
  auto hasher = policy.hash_slot;
218
- auto transfer = policy.transfer;
331
+ auto transfer_n = policy.transfer_n;
219
332
  const size_t slot_size = policy.slot_size;
220
333
 
221
334
  size_t total_probe_length = 0;
@@ -228,7 +341,7 @@ void DropDeletesWithoutResize(CommonFields& common,
228
341
 
229
342
  for (size_t i = 0; i != capacity;
230
343
  ++i, slot_ptr = NextSlot(slot_ptr, slot_size)) {
231
- assert(slot_ptr == SlotAddress(slot_array, i, slot_size));
344
+ ABSL_SWISSTABLE_ASSERT(slot_ptr == SlotAddress(slot_array, i, slot_size));
232
345
  if (IsEmpty(ctrl[i])) {
233
346
  tmp_space_id = i;
234
347
  continue;
@@ -243,13 +356,14 @@ void DropDeletesWithoutResize(CommonFields& common,
243
356
  // If they do, we don't need to move the object as it falls already in the
244
357
  // best probe we can.
245
358
  const size_t probe_offset = probe(common, hash).offset();
359
+ const h2_t h2 = H2(hash);
246
360
  const auto probe_index = [probe_offset, capacity](size_t pos) {
247
361
  return ((pos - probe_offset) & capacity) / Group::kWidth;
248
362
  };
249
363
 
250
364
  // Element doesn't move.
251
365
  if (ABSL_PREDICT_TRUE(probe_index(new_i) == probe_index(i))) {
252
- SetCtrl(common, i, H2(hash), slot_size);
366
+ SetCtrlInLargeTable(common, i, h2, slot_size);
253
367
  continue;
254
368
  }
255
369
 
@@ -258,14 +372,14 @@ void DropDeletesWithoutResize(CommonFields& common,
258
372
  // Transfer element to the empty spot.
259
373
  // SetCtrl poisons/unpoisons the slots so we have to call it at the
260
374
  // right time.
261
- SetCtrl(common, new_i, H2(hash), slot_size);
262
- (*transfer)(set, new_slot_ptr, slot_ptr);
263
- SetCtrl(common, i, ctrl_t::kEmpty, slot_size);
375
+ SetCtrlInLargeTable(common, new_i, h2, slot_size);
376
+ (*transfer_n)(set, new_slot_ptr, slot_ptr, 1);
377
+ SetCtrlInLargeTable(common, i, ctrl_t::kEmpty, slot_size);
264
378
  // Initialize or change empty space id.
265
379
  tmp_space_id = i;
266
380
  } else {
267
- assert(IsDeleted(ctrl[new_i]));
268
- SetCtrl(common, new_i, H2(hash), slot_size);
381
+ ABSL_SWISSTABLE_ASSERT(IsDeleted(ctrl[new_i]));
382
+ SetCtrlInLargeTable(common, new_i, h2, slot_size);
269
383
  // Until we are done rehashing, DELETED marks previously FULL slots.
270
384
 
271
385
  if (tmp_space_id == kUnknownId) {
@@ -275,9 +389,9 @@ void DropDeletesWithoutResize(CommonFields& common,
275
389
  SanitizerUnpoisonMemoryRegion(tmp_space, slot_size);
276
390
 
277
391
  // Swap i and new_i elements.
278
- (*transfer)(set, tmp_space, new_slot_ptr);
279
- (*transfer)(set, new_slot_ptr, slot_ptr);
280
- (*transfer)(set, slot_ptr, tmp_space);
392
+ (*transfer_n)(set, tmp_space, new_slot_ptr, 1);
393
+ (*transfer_n)(set, new_slot_ptr, slot_ptr, 1);
394
+ (*transfer_n)(set, slot_ptr, tmp_space, 1);
281
395
 
282
396
  SanitizerPoisonMemoryRegion(tmp_space, slot_size);
283
397
 
@@ -286,8 +400,14 @@ void DropDeletesWithoutResize(CommonFields& common,
286
400
  slot_ptr = PrevSlot(slot_ptr, slot_size);
287
401
  }
288
402
  }
403
+ // Prepare insert for the new element.
404
+ PrepareInsertCommon(common);
289
405
  ResetGrowthLeft(common);
406
+ FindInfo find_info = find_first_non_full(common, new_hash);
407
+ SetCtrlInLargeTable(common, find_info.offset, H2(new_hash), slot_size);
408
+ common.infoz().RecordInsert(new_hash, find_info.probe_length);
290
409
  common.infoz().RecordRehash(total_probe_length);
410
+ return find_info.offset;
291
411
  }
292
412
 
293
413
  static bool WasNeverFull(CommonFields& c, size_t index) {
@@ -307,10 +427,126 @@ static bool WasNeverFull(CommonFields& c, size_t index) {
307
427
  Group::kWidth;
308
428
  }
309
429
 
430
+ // Updates the control bytes to indicate a completely empty table such that all
431
+ // control bytes are kEmpty except for the kSentinel byte.
432
+ void ResetCtrl(CommonFields& common, size_t slot_size) {
433
+ const size_t capacity = common.capacity();
434
+ ctrl_t* ctrl = common.control();
435
+ static constexpr size_t kTwoGroupCapacity = 2 * Group::kWidth - 1;
436
+ if (ABSL_PREDICT_TRUE(capacity <= kTwoGroupCapacity)) {
437
+ std::memset(ctrl, static_cast<int8_t>(ctrl_t::kEmpty), Group::kWidth);
438
+ std::memset(ctrl + capacity, static_cast<int8_t>(ctrl_t::kEmpty),
439
+ Group::kWidth);
440
+ if (capacity == kTwoGroupCapacity) {
441
+ std::memset(ctrl + Group::kWidth, static_cast<int8_t>(ctrl_t::kEmpty),
442
+ Group::kWidth);
443
+ }
444
+ } else {
445
+ std::memset(ctrl, static_cast<int8_t>(ctrl_t::kEmpty),
446
+ capacity + 1 + NumClonedBytes());
447
+ }
448
+ ctrl[capacity] = ctrl_t::kSentinel;
449
+ SanitizerPoisonMemoryRegion(common.slot_array(), slot_size * capacity);
450
+ }
451
+
452
+ // Initializes control bytes for single element table.
453
+ // Capacity of the table must be 1.
454
+ ABSL_ATTRIBUTE_ALWAYS_INLINE inline void InitializeSingleElementControlBytes(
455
+ uint64_t h2, ctrl_t* new_ctrl) {
456
+ static constexpr uint64_t kEmptyXorSentinel =
457
+ static_cast<uint8_t>(ctrl_t::kEmpty) ^
458
+ static_cast<uint8_t>(ctrl_t::kSentinel);
459
+ static constexpr uint64_t kEmpty64 = static_cast<uint8_t>(ctrl_t::kEmpty);
460
+ // The first 8 bytes, where present slot positions are replaced with 0.
461
+ static constexpr uint64_t kFirstCtrlBytesWithZeroes =
462
+ k8EmptyBytes ^ kEmpty64 ^ (kEmptyXorSentinel << 8) ^ (kEmpty64 << 16);
463
+
464
+ // Fill the original 0th and mirrored 2nd bytes with the hash.
465
+ // Result will look like:
466
+ // HSHEEEEE
467
+ // Where H = h2, E = kEmpty, S = kSentinel.
468
+ const uint64_t first_ctrl_bytes =
469
+ (h2 | kFirstCtrlBytesWithZeroes) | (h2 << 16);
470
+ // Fill last bytes with kEmpty.
471
+ std::memset(new_ctrl + 1, static_cast<int8_t>(ctrl_t::kEmpty), Group::kWidth);
472
+ // Overwrite the first 3 bytes with HSH. Other bytes will not be changed.
473
+ absl::little_endian::Store64(new_ctrl, first_ctrl_bytes);
474
+ }
475
+
476
+ // Initializes control bytes for growing after SOO to the next capacity.
477
+ // `soo_ctrl` is placed in the position `SooSlotIndex()`.
478
+ // `new_hash` is placed in the position `new_offset`.
479
+ // The table must be non-empty SOO.
480
+ ABSL_ATTRIBUTE_ALWAYS_INLINE inline void
481
+ InitializeThreeElementsControlBytesAfterSoo(ctrl_t soo_ctrl, size_t new_hash,
482
+ size_t new_offset,
483
+ ctrl_t* new_ctrl) {
484
+ static constexpr size_t kNewCapacity = NextCapacity(SooCapacity());
485
+ static_assert(kNewCapacity == 3);
486
+ static_assert(is_single_group(kNewCapacity));
487
+ static_assert(SooSlotIndex() == 1);
488
+ ABSL_SWISSTABLE_ASSERT(new_offset == 0 || new_offset == 2);
489
+
490
+ static constexpr uint64_t kEmptyXorSentinel =
491
+ static_cast<uint8_t>(ctrl_t::kEmpty) ^
492
+ static_cast<uint8_t>(ctrl_t::kSentinel);
493
+ static constexpr uint64_t kEmpty64 = static_cast<uint8_t>(ctrl_t::kEmpty);
494
+ static constexpr size_t kMirroredSooSlotIndex =
495
+ SooSlotIndex() + kNewCapacity + 1;
496
+ // The first 8 bytes, where SOO slot original and mirrored positions are
497
+ // replaced with 0.
498
+ // Result will look like: E0ESE0EE
499
+ static constexpr uint64_t kFirstCtrlBytesWithZeroes =
500
+ k8EmptyBytes ^ (kEmpty64 << (8 * SooSlotIndex())) ^
501
+ (kEmptyXorSentinel << (8 * kNewCapacity)) ^
502
+ (kEmpty64 << (8 * kMirroredSooSlotIndex));
503
+
504
+ const uint64_t soo_h2 = static_cast<uint64_t>(soo_ctrl);
505
+ const uint64_t new_h2_xor_empty = static_cast<uint64_t>(
506
+ H2(new_hash) ^ static_cast<uint8_t>(ctrl_t::kEmpty));
507
+ // Fill the original and mirrored bytes for SOO slot.
508
+ // Result will look like:
509
+ // EHESEHEE
510
+ // Where H = soo_h2, E = kEmpty, S = kSentinel.
511
+ uint64_t first_ctrl_bytes =
512
+ ((soo_h2 << (8 * SooSlotIndex())) | kFirstCtrlBytesWithZeroes) |
513
+ (soo_h2 << (8 * kMirroredSooSlotIndex));
514
+ // Replace original and mirrored empty bytes for the new position.
515
+ // Result for new_offset 0 will look like:
516
+ // NHESNHEE
517
+ // Where H = soo_h2, N = H2(new_hash), E = kEmpty, S = kSentinel.
518
+ // Result for new_offset 2 will look like:
519
+ // EHNSEHNE
520
+ first_ctrl_bytes ^= (new_h2_xor_empty << (8 * new_offset));
521
+ size_t new_mirrored_offset = new_offset + kNewCapacity + 1;
522
+ first_ctrl_bytes ^= (new_h2_xor_empty << (8 * new_mirrored_offset));
523
+
524
+ // Fill last bytes with kEmpty.
525
+ std::memset(new_ctrl + kNewCapacity, static_cast<int8_t>(ctrl_t::kEmpty),
526
+ Group::kWidth);
527
+ // Overwrite the first 8 bytes with first_ctrl_bytes.
528
+ absl::little_endian::Store64(new_ctrl, first_ctrl_bytes);
529
+
530
+ // Example for group size 16:
531
+ // new_ctrl after 1st memset = ???EEEEEEEEEEEEEEEE
532
+ // new_offset 0:
533
+ // new_ctrl after 2nd store = NHESNHEEEEEEEEEEEEE
534
+ // new_offset 2:
535
+ // new_ctrl after 2nd store = EHNSEHNEEEEEEEEEEEE
536
+
537
+ // Example for group size 8:
538
+ // new_ctrl after 1st memset = ???EEEEEEEE
539
+ // new_offset 0:
540
+ // new_ctrl after 2nd store = NHESNHEEEEE
541
+ // new_offset 2:
542
+ // new_ctrl after 2nd store = EHNSEHNEEEE
543
+ }
544
+
310
545
  } // namespace
311
546
 
312
547
  void EraseMetaOnly(CommonFields& c, size_t index, size_t slot_size) {
313
- assert(IsFull(c.control()[index]) && "erasing a dangling iterator");
548
+ ABSL_SWISSTABLE_ASSERT(IsFull(c.control()[index]) &&
549
+ "erasing a dangling iterator");
314
550
  c.decrement_size();
315
551
  c.infoz().RecordErase();
316
552
 
@@ -321,14 +557,15 @@ void EraseMetaOnly(CommonFields& c, size_t index, size_t slot_size) {
321
557
  }
322
558
 
323
559
  c.growth_info().OverwriteFullAsDeleted();
324
- SetCtrl(c, index, ctrl_t::kDeleted, slot_size);
560
+ SetCtrlInLargeTable(c, index, ctrl_t::kDeleted, slot_size);
325
561
  }
326
562
 
327
- void ClearBackingArray(CommonFields& c, const PolicyFunctions& policy,
563
+ void ClearBackingArray(CommonFields& c,
564
+ const PolicyFunctions& __restrict policy, void* alloc,
328
565
  bool reuse, bool soo_enabled) {
329
- c.set_size(0);
330
566
  if (reuse) {
331
- assert(!soo_enabled || c.capacity() > SooCapacity());
567
+ c.set_size_to_zero();
568
+ ABSL_SWISSTABLE_ASSERT(!soo_enabled || c.capacity() > SooCapacity());
332
569
  ResetCtrl(c, policy.slot_size);
333
570
  ResetGrowthLeft(c);
334
571
  c.infoz().RecordStorageChanged(0, c.capacity());
@@ -337,192 +574,763 @@ void ClearBackingArray(CommonFields& c, const PolicyFunctions& policy,
337
574
  // infoz.
338
575
  c.infoz().RecordClearedReservation();
339
576
  c.infoz().RecordStorageChanged(0, soo_enabled ? SooCapacity() : 0);
340
- (*policy.dealloc)(c, policy);
341
- c = soo_enabled ? CommonFields{soo_tag_t{}} : CommonFields{};
577
+ c.infoz().Unregister();
578
+ (*policy.dealloc)(alloc, c.capacity(), c.control(), policy.slot_size,
579
+ policy.slot_align, c.has_infoz());
580
+ c = soo_enabled ? CommonFields{soo_tag_t{}} : CommonFields{non_soo_tag_t{}};
581
+ }
582
+ }
583
+
584
+ namespace {
585
+
586
+ enum class ResizeNonSooMode {
587
+ kGuaranteedEmpty,
588
+ kGuaranteedAllocated,
589
+ };
590
+
591
+ // Iterates over full slots in old table, finds new positions for them and
592
+ // transfers the slots.
593
+ // This function is used for reserving or rehashing non-empty tables.
594
+ // This use case is rare so the function is type erased.
595
+ // Returns the total probe length.
596
+ size_t FindNewPositionsAndTransferSlots(
597
+ CommonFields& common, const PolicyFunctions& __restrict policy,
598
+ ctrl_t* old_ctrl, void* old_slots, size_t old_capacity) {
599
+ void* new_slots = common.slot_array();
600
+ const void* hash_fn = policy.hash_fn(common);
601
+ const size_t slot_size = policy.slot_size;
602
+
603
+ const auto insert_slot = [&](void* slot) {
604
+ size_t hash = policy.hash_slot(hash_fn, slot);
605
+ auto target = find_first_non_full(common, hash);
606
+ SetCtrl(common, target.offset, H2(hash), slot_size);
607
+ policy.transfer_n(&common, SlotAddress(new_slots, target.offset, slot_size),
608
+ slot, 1);
609
+ return target.probe_length;
610
+ };
611
+ size_t total_probe_length = 0;
612
+ for (size_t i = 0; i < old_capacity; ++i) {
613
+ if (IsFull(old_ctrl[i])) {
614
+ total_probe_length += insert_slot(old_slots);
615
+ }
616
+ old_slots = NextSlot(old_slots, slot_size);
617
+ }
618
+ return total_probe_length;
619
+ }
620
+
621
+ template <ResizeNonSooMode kMode>
622
+ void ResizeNonSooImpl(CommonFields& common,
623
+ const PolicyFunctions& __restrict policy,
624
+ size_t new_capacity, HashtablezInfoHandle infoz) {
625
+ ABSL_SWISSTABLE_ASSERT(IsValidCapacity(new_capacity));
626
+ ABSL_SWISSTABLE_ASSERT(new_capacity > policy.soo_capacity());
627
+
628
+ const size_t old_capacity = common.capacity();
629
+ [[maybe_unused]] ctrl_t* old_ctrl = common.control();
630
+ [[maybe_unused]] void* old_slots = common.slot_array();
631
+
632
+ const size_t slot_size = policy.slot_size;
633
+ const size_t slot_align = policy.slot_align;
634
+ const bool has_infoz = infoz.IsSampled();
635
+
636
+ common.set_capacity(new_capacity);
637
+ RawHashSetLayout layout(new_capacity, slot_size, slot_align, has_infoz);
638
+ void* alloc = policy.get_char_alloc(common);
639
+ char* mem = static_cast<char*>(policy.alloc(alloc, layout.alloc_size()));
640
+ const GenerationType old_generation = common.generation();
641
+ common.set_generation_ptr(
642
+ reinterpret_cast<GenerationType*>(mem + layout.generation_offset()));
643
+ common.set_generation(NextGeneration(old_generation));
644
+
645
+ ctrl_t* new_ctrl = reinterpret_cast<ctrl_t*>(mem + layout.control_offset());
646
+ common.set_control</*kGenerateSeed=*/true>(new_ctrl);
647
+ common.set_slots(mem + layout.slot_offset());
648
+
649
+ size_t total_probe_length = 0;
650
+ ResetCtrl(common, slot_size);
651
+ ABSL_SWISSTABLE_ASSERT(kMode != ResizeNonSooMode::kGuaranteedEmpty ||
652
+ old_capacity == policy.soo_capacity());
653
+ ABSL_SWISSTABLE_ASSERT(kMode != ResizeNonSooMode::kGuaranteedAllocated ||
654
+ old_capacity > 0);
655
+ if constexpr (kMode == ResizeNonSooMode::kGuaranteedAllocated) {
656
+ total_probe_length = FindNewPositionsAndTransferSlots(
657
+ common, policy, old_ctrl, old_slots, old_capacity);
658
+ (*policy.dealloc)(alloc, old_capacity, old_ctrl, slot_size, slot_align,
659
+ has_infoz);
660
+ ResetGrowthLeft(GetGrowthInfoFromControl(new_ctrl), new_capacity,
661
+ common.size());
662
+ } else {
663
+ GetGrowthInfoFromControl(new_ctrl).InitGrowthLeftNoDeleted(
664
+ CapacityToGrowth(new_capacity));
665
+ }
666
+
667
+ if (has_infoz) {
668
+ common.set_has_infoz();
669
+ infoz.RecordStorageChanged(common.size(), new_capacity);
670
+ infoz.RecordRehash(total_probe_length);
671
+ common.set_infoz(infoz);
342
672
  }
343
673
  }
344
674
 
345
- void HashSetResizeHelper::GrowIntoSingleGroupShuffleControlBytes(
346
- ctrl_t* __restrict new_ctrl, size_t new_capacity) const {
347
- assert(is_single_group(new_capacity));
675
+ void ResizeEmptyNonAllocatedTableImpl(CommonFields& common,
676
+ const PolicyFunctions& __restrict policy,
677
+ size_t new_capacity, bool force_infoz) {
678
+ ABSL_SWISSTABLE_ASSERT(IsValidCapacity(new_capacity));
679
+ ABSL_SWISSTABLE_ASSERT(new_capacity > policy.soo_capacity());
680
+ ABSL_SWISSTABLE_ASSERT(!force_infoz || policy.soo_enabled);
681
+ ABSL_SWISSTABLE_ASSERT(common.capacity() <= policy.soo_capacity());
682
+ ABSL_SWISSTABLE_ASSERT(common.empty());
683
+ const size_t slot_size = policy.slot_size;
684
+ HashtablezInfoHandle infoz;
685
+ const bool should_sample =
686
+ policy.is_hashtablez_eligible && (force_infoz || ShouldSampleNextTable());
687
+ if (ABSL_PREDICT_FALSE(should_sample)) {
688
+ infoz = ForcedTrySample(slot_size, policy.key_size, policy.value_size,
689
+ policy.soo_capacity());
690
+ }
691
+ ResizeNonSooImpl<ResizeNonSooMode::kGuaranteedEmpty>(common, policy,
692
+ new_capacity, infoz);
693
+ }
694
+
695
+ // If the table was SOO, initializes new control bytes and transfers slot.
696
+ // After transferring the slot, sets control and slots in CommonFields.
697
+ // It is rare to resize an SOO table with one element to a large size.
698
+ // Requires: `c` contains SOO data.
699
+ void InsertOldSooSlotAndInitializeControlBytes(
700
+ CommonFields& c, const PolicyFunctions& __restrict policy, size_t hash,
701
+ ctrl_t* new_ctrl, void* new_slots) {
702
+ ABSL_SWISSTABLE_ASSERT(c.size() == policy.soo_capacity());
703
+ ABSL_SWISSTABLE_ASSERT(policy.soo_enabled);
704
+ size_t new_capacity = c.capacity();
705
+
706
+ c.generate_new_seed();
707
+ size_t offset = probe(c.seed(), new_capacity, hash).offset();
708
+ offset = offset == new_capacity ? 0 : offset;
709
+ SanitizerPoisonMemoryRegion(new_slots, policy.slot_size * new_capacity);
710
+ void* target_slot = SlotAddress(new_slots, offset, policy.slot_size);
711
+ SanitizerUnpoisonMemoryRegion(target_slot, policy.slot_size);
712
+ policy.transfer_n(&c, target_slot, c.soo_data(), 1);
713
+ c.set_control</*kGenerateSeed=*/false>(new_ctrl);
714
+ c.set_slots(new_slots);
715
+ ResetCtrl(c, policy.slot_size);
716
+ SetCtrl(c, offset, H2(hash), policy.slot_size);
717
+ }
718
+
719
+ enum class ResizeFullSooTableSamplingMode {
720
+ kNoSampling,
721
+ // Force sampling. If the table was still not sampled, do not resize.
722
+ kForceSampleNoResizeIfUnsampled,
723
+ };
724
+
725
+ void AssertSoo([[maybe_unused]] CommonFields& common,
726
+ [[maybe_unused]] const PolicyFunctions& policy) {
727
+ ABSL_SWISSTABLE_ASSERT(policy.soo_enabled);
728
+ ABSL_SWISSTABLE_ASSERT(common.capacity() == policy.soo_capacity());
729
+ }
730
+ void AssertFullSoo([[maybe_unused]] CommonFields& common,
731
+ [[maybe_unused]] const PolicyFunctions& policy) {
732
+ AssertSoo(common, policy);
733
+ ABSL_SWISSTABLE_ASSERT(common.size() == policy.soo_capacity());
734
+ }
735
+
736
+ void ResizeFullSooTable(CommonFields& common,
737
+ const PolicyFunctions& __restrict policy,
738
+ size_t new_capacity,
739
+ ResizeFullSooTableSamplingMode sampling_mode) {
740
+ AssertFullSoo(common, policy);
741
+ const size_t slot_size = policy.slot_size;
742
+ const size_t slot_align = policy.slot_align;
743
+
744
+ HashtablezInfoHandle infoz;
745
+ if (sampling_mode ==
746
+ ResizeFullSooTableSamplingMode::kForceSampleNoResizeIfUnsampled) {
747
+ if (ABSL_PREDICT_FALSE(policy.is_hashtablez_eligible)) {
748
+ infoz = ForcedTrySample(slot_size, policy.key_size, policy.value_size,
749
+ policy.soo_capacity());
750
+ }
751
+
752
+ if (!infoz.IsSampled()) {
753
+ return;
754
+ }
755
+ }
756
+
757
+ const bool has_infoz = infoz.IsSampled();
758
+
759
+ common.set_capacity(new_capacity);
760
+
761
+ RawHashSetLayout layout(new_capacity, slot_size, slot_align, has_infoz);
762
+ void* alloc = policy.get_char_alloc(common);
763
+ char* mem = static_cast<char*>(policy.alloc(alloc, layout.alloc_size()));
764
+ const GenerationType old_generation = common.generation();
765
+ common.set_generation_ptr(
766
+ reinterpret_cast<GenerationType*>(mem + layout.generation_offset()));
767
+ common.set_generation(NextGeneration(old_generation));
768
+
769
+ // We do not set control and slots in CommonFields yet to avoid overriding
770
+ // SOO data.
771
+ ctrl_t* new_ctrl = reinterpret_cast<ctrl_t*>(mem + layout.control_offset());
772
+ void* new_slots = mem + layout.slot_offset();
773
+
774
+ const size_t soo_slot_hash =
775
+ policy.hash_slot(policy.hash_fn(common), common.soo_data());
776
+
777
+ InsertOldSooSlotAndInitializeControlBytes(common, policy, soo_slot_hash,
778
+ new_ctrl, new_slots);
779
+ ResetGrowthLeft(common);
780
+ if (has_infoz) {
781
+ common.set_has_infoz();
782
+ common.set_infoz(infoz);
783
+ infoz.RecordStorageChanged(common.size(), new_capacity);
784
+ }
785
+ }
786
+
787
+ void GrowIntoSingleGroupShuffleControlBytes(ctrl_t* __restrict old_ctrl,
788
+ size_t old_capacity,
789
+ ctrl_t* __restrict new_ctrl,
790
+ size_t new_capacity) {
791
+ ABSL_SWISSTABLE_ASSERT(is_single_group(new_capacity));
348
792
  constexpr size_t kHalfWidth = Group::kWidth / 2;
349
- constexpr size_t kQuarterWidth = Group::kWidth / 4;
350
- assert(old_capacity_ < kHalfWidth);
351
- static_assert(sizeof(uint64_t) >= kHalfWidth,
352
- "Group size is too large. The ctrl bytes for half a group must "
353
- "fit into a uint64_t for this implementation.");
354
- static_assert(sizeof(uint64_t) <= Group::kWidth,
355
- "Group size is too small. The ctrl bytes for a group must "
356
- "cover a uint64_t for this implementation.");
357
-
358
- const size_t half_old_capacity = old_capacity_ / 2;
359
-
360
- // NOTE: operations are done with compile time known size = kHalfWidth.
793
+ ABSL_ASSUME(old_capacity < kHalfWidth);
794
+ ABSL_ASSUME(old_capacity > 0);
795
+ static_assert(Group::kWidth == 8 || Group::kWidth == 16,
796
+ "Group size is not supported.");
797
+
798
+ // NOTE: operations are done with compile time known size = 8.
361
799
  // Compiler optimizes that into single ASM operation.
362
800
 
363
- // Load the bytes from half_old_capacity + 1. This contains the last half of
364
- // old_ctrl bytes, followed by the sentinel byte, and then the first half of
365
- // the cloned bytes. This effectively shuffles the control bytes.
366
- uint64_t copied_bytes = 0;
367
- copied_bytes =
368
- absl::little_endian::Load64(old_ctrl() + half_old_capacity + 1);
801
+ // Load the bytes from old_capacity. This contains
802
+ // - the sentinel byte
803
+ // - all the old control bytes
804
+ // - the rest is filled with kEmpty bytes
805
+ // Example:
806
+ // old_ctrl = 012S012EEEEEEEEE...
807
+ // copied_bytes = S012EEEE
808
+ uint64_t copied_bytes = absl::little_endian::Load64(old_ctrl + old_capacity);
369
809
 
370
810
  // We change the sentinel byte to kEmpty before storing to both the start of
371
811
  // the new_ctrl, and past the end of the new_ctrl later for the new cloned
372
812
  // bytes. Note that this is faster than setting the sentinel byte to kEmpty
373
813
  // after the copy directly in new_ctrl because we are limited on store
374
814
  // bandwidth.
375
- constexpr uint64_t kEmptyXorSentinel =
815
+ static constexpr uint64_t kEmptyXorSentinel =
376
816
  static_cast<uint8_t>(ctrl_t::kEmpty) ^
377
817
  static_cast<uint8_t>(ctrl_t::kSentinel);
378
- const uint64_t mask_convert_old_sentinel_to_empty =
379
- kEmptyXorSentinel << (half_old_capacity * 8);
380
- copied_bytes ^= mask_convert_old_sentinel_to_empty;
381
-
382
- // Copy second half of bytes to the beginning. This correctly sets the bytes
383
- // [0, old_capacity]. We potentially copy more bytes in order to have compile
384
- // time known size. Mirrored bytes from the old_ctrl() will also be copied. In
385
- // case of old_capacity_ == 3, we will copy 1st element twice.
386
- // Examples:
387
- // (old capacity = 1)
388
- // old_ctrl = 0S0EEEEEEE...
389
- // new_ctrl = E0EEEEEE??...
390
- //
391
- // (old capacity = 3)
392
- // old_ctrl = 012S012EEEEE...
393
- // new_ctrl = 12E012EE????...
394
- //
395
- // (old capacity = 7)
396
- // old_ctrl = 0123456S0123456EE...
397
- // new_ctrl = 456E0123?????????...
398
- absl::little_endian::Store64(new_ctrl, copied_bytes);
399
818
 
400
- // Set the space [old_capacity + 1, new_capacity] to empty as these bytes will
401
- // not be written again. This is safe because
402
- // NumControlBytes = new_capacity + kWidth and new_capacity >=
403
- // old_capacity+1.
404
- // Examples:
405
- // (old_capacity = 3, new_capacity = 15)
406
- // new_ctrl = 12E012EE?????????????...??
407
- // *new_ctrl = 12E0EEEEEEEEEEEEEEEE?...??
408
- // position / S
409
- //
410
- // (old_capacity = 7, new_capacity = 15)
411
- // new_ctrl = 456E0123?????????????????...??
412
- // *new_ctrl = 456E0123EEEEEEEEEEEEEEEE?...??
413
- // position / S
414
- std::memset(new_ctrl + old_capacity_ + 1, static_cast<int8_t>(ctrl_t::kEmpty),
415
- Group::kWidth);
819
+ // Replace the first byte kSentinel with kEmpty.
820
+ // Resulting bytes will be shifted by one byte old control blocks.
821
+ // Example:
822
+ // old_ctrl = 012S012EEEEEEEEE...
823
+ // before = S012EEEE
824
+ // after = E012EEEE
825
+ copied_bytes ^= kEmptyXorSentinel;
826
+
827
+ if (Group::kWidth == 8) {
828
+ // With group size 8, we can grow with two write operations.
829
+ ABSL_SWISSTABLE_ASSERT(old_capacity < 8 &&
830
+ "old_capacity is too large for group size 8");
831
+ absl::little_endian::Store64(new_ctrl, copied_bytes);
832
+
833
+ static constexpr uint64_t kSentinal64 =
834
+ static_cast<uint8_t>(ctrl_t::kSentinel);
835
+
836
+ // Prepend kSentinel byte to the beginning of copied_bytes.
837
+ // We have maximum 3 non-empty bytes at the beginning of copied_bytes for
838
+ // group size 8.
839
+ // Example:
840
+ // old_ctrl = 012S012EEEE
841
+ // before = E012EEEE
842
+ // after = SE012EEE
843
+ copied_bytes = (copied_bytes << 8) ^ kSentinal64;
844
+ absl::little_endian::Store64(new_ctrl + new_capacity, copied_bytes);
845
+ // Example for capacity 3:
846
+ // old_ctrl = 012S012EEEE
847
+ // After the first store:
848
+ // >!
849
+ // new_ctrl = E012EEEE???????
850
+ // After the second store:
851
+ // >!
852
+ // new_ctrl = E012EEESE012EEE
853
+ return;
854
+ }
416
855
 
417
- // Set the last kHalfWidth bytes to empty, to ensure the bytes all the way to
418
- // the end are initialized.
419
- // Examples:
420
- // new_ctrl = 12E0EEEEEEEEEEEEEEEE?...???????
421
- // *new_ctrl = 12E0EEEEEEEEEEEEEEEE???EEEEEEEE
422
- // position S /
423
- //
424
- // new_ctrl = 456E0123EEEEEEEEEEEEEEEE???????
425
- // *new_ctrl = 456E0123EEEEEEEEEEEEEEEEEEEEEEE
426
- // position S /
427
- std::memset(new_ctrl + NumControlBytes(new_capacity) - kHalfWidth,
428
- static_cast<int8_t>(ctrl_t::kEmpty), kHalfWidth);
856
+ ABSL_SWISSTABLE_ASSERT(Group::kWidth == 16);
429
857
 
430
- // Copy the first bytes to the end (starting at new_capacity +1) to set the
431
- // cloned bytes. Note that we use the already copied bytes from old_ctrl here
432
- // rather than copying from new_ctrl to avoid a Read-after-Write hazard, since
433
- // new_ctrl was just written to. The first old_capacity-1 bytes are set
434
- // correctly. Then there may be up to old_capacity bytes that need to be
435
- // overwritten, and any remaining bytes will be correctly set to empty. This
436
- // sets [new_capacity + 1, new_capacity +1 + old_capacity] correctly.
437
- // Examples:
438
- // new_ctrl = 12E0EEEEEEEEEEEEEEEE?...???????
439
- // *new_ctrl = 12E0EEEEEEEEEEEE12E012EEEEEEEEE
440
- // position S/
441
- //
442
- // new_ctrl = 456E0123EEEEEEEE?...???EEEEEEEE
443
- // *new_ctrl = 456E0123EEEEEEEE456E0123EEEEEEE
444
- // position S/
858
+ // Fill the second half of the main control bytes with kEmpty.
859
+ // For small capacity that may write into mirrored control bytes.
860
+ // It is fine as we will overwrite all the bytes later.
861
+ std::memset(new_ctrl + kHalfWidth, static_cast<int8_t>(ctrl_t::kEmpty),
862
+ kHalfWidth);
863
+ // Fill the second half of the mirrored control bytes with kEmpty.
864
+ std::memset(new_ctrl + new_capacity + kHalfWidth,
865
+ static_cast<int8_t>(ctrl_t::kEmpty), kHalfWidth);
866
+ // Copy the first half of the non-mirrored control bytes.
867
+ absl::little_endian::Store64(new_ctrl, copied_bytes);
868
+ new_ctrl[new_capacity] = ctrl_t::kSentinel;
869
+ // Copy the first half of the mirrored control bytes.
445
870
  absl::little_endian::Store64(new_ctrl + new_capacity + 1, copied_bytes);
446
871
 
447
- // Set The remaining bytes at the end past the cloned bytes to empty. The
448
- // incorrectly set bytes are [new_capacity + old_capacity + 2,
449
- // min(new_capacity + 1 + kHalfWidth, new_capacity + old_capacity + 2 +
450
- // half_old_capacity)]. Taking the difference, we need to set min(kHalfWidth -
451
- // (old_capacity + 1), half_old_capacity)]. Since old_capacity < kHalfWidth,
452
- // half_old_capacity < kQuarterWidth, so we set kQuarterWidth beginning at
453
- // new_capacity + old_capacity + 2 to kEmpty.
454
- // Examples:
455
- // new_ctrl = 12E0EEEEEEEEEEEE12E012EEEEEEEEE
456
- // *new_ctrl = 12E0EEEEEEEEEEEE12E0EEEEEEEEEEE
457
- // position S /
458
- //
459
- // new_ctrl = 456E0123EEEEEEEE456E0123EEEEEEE
460
- // *new_ctrl = 456E0123EEEEEEEE456E0123EEEEEEE (no change)
461
- // position S /
462
- std::memset(new_ctrl + new_capacity + old_capacity_ + 2,
463
- static_cast<int8_t>(ctrl_t::kEmpty), kQuarterWidth);
872
+ // Example for growth capacity 1->3:
873
+ // old_ctrl = 0S0EEEEEEEEEEEEEE
874
+ // new_ctrl at the end = E0ESE0EEEEEEEEEEEEE
875
+ // >!
876
+ // new_ctrl after 1st memset = ????????EEEEEEEE???
877
+ // >!
878
+ // new_ctrl after 2nd memset = ????????EEEEEEEEEEE
879
+ // >!
880
+ // new_ctrl after 1st store = E0EEEEEEEEEEEEEEEEE
881
+ // new_ctrl after kSentinel = E0ESEEEEEEEEEEEEEEE
882
+ // >!
883
+ // new_ctrl after 2nd store = E0ESE0EEEEEEEEEEEEE
884
+
885
+ // Example for growth capacity 3->7:
886
+ // old_ctrl = 012S012EEEEEEEEEEEE
887
+ // new_ctrl at the end = E012EEESE012EEEEEEEEEEE
888
+ // >!
889
+ // new_ctrl after 1st memset = ????????EEEEEEEE???????
890
+ // >!
891
+ // new_ctrl after 2nd memset = ????????EEEEEEEEEEEEEEE
892
+ // >!
893
+ // new_ctrl after 1st store = E012EEEEEEEEEEEEEEEEEEE
894
+ // new_ctrl after kSentinel = E012EEESEEEEEEEEEEEEEEE
895
+ // >!
896
+ // new_ctrl after 2nd store = E012EEESE012EEEEEEEEEEE
897
+
898
+ // Example for growth capacity 7->15:
899
+ // old_ctrl = 0123456S0123456EEEEEEEE
900
+ // new_ctrl at the end = E0123456EEEEEEESE0123456EEEEEEE
901
+ // >!
902
+ // new_ctrl after 1st memset = ????????EEEEEEEE???????????????
903
+ // >!
904
+ // new_ctrl after 2nd memset = ????????EEEEEEEE???????EEEEEEEE
905
+ // >!
906
+ // new_ctrl after 1st store = E0123456EEEEEEEE???????EEEEEEEE
907
+ // new_ctrl after kSentinel = E0123456EEEEEEES???????EEEEEEEE
908
+ // >!
909
+ // new_ctrl after 2nd store = E0123456EEEEEEESE0123456EEEEEEE
910
+ }
464
911
 
465
- // Finally, we set the new sentinel byte.
466
- new_ctrl[new_capacity] = ctrl_t::kSentinel;
912
+ // Size of the buffer we allocate on stack for storing probed elements in
913
+ // GrowToNextCapacity algorithm.
914
+ constexpr size_t kProbedElementsBufferSize = 512;
915
+
916
+ // Decodes information about probed elements from contiguous memory.
917
+ // Finds new position for each element and transfers it to the new slots.
918
+ // Returns the total probe length.
919
+ template <typename ProbedItem>
920
+ ABSL_ATTRIBUTE_NOINLINE size_t DecodeAndInsertImpl(
921
+ CommonFields& c, const PolicyFunctions& __restrict policy,
922
+ const ProbedItem* start, const ProbedItem* end, void* old_slots) {
923
+ const size_t new_capacity = c.capacity();
924
+
925
+ void* new_slots = c.slot_array();
926
+ ctrl_t* new_ctrl = c.control();
927
+ size_t total_probe_length = 0;
928
+
929
+ const size_t slot_size = policy.slot_size;
930
+ auto transfer_n = policy.transfer_n;
931
+
932
+ for (; start < end; ++start) {
933
+ const FindInfo target = find_first_non_full_from_h1(
934
+ new_ctrl, static_cast<size_t>(start->h1), new_capacity);
935
+ total_probe_length += target.probe_length;
936
+ const size_t old_index = static_cast<size_t>(start->source_offset);
937
+ const size_t new_i = target.offset;
938
+ ABSL_SWISSTABLE_ASSERT(old_index < new_capacity / 2);
939
+ ABSL_SWISSTABLE_ASSERT(new_i < new_capacity);
940
+ ABSL_SWISSTABLE_ASSERT(IsEmpty(new_ctrl[new_i]));
941
+ void* src_slot = SlotAddress(old_slots, old_index, slot_size);
942
+ void* dst_slot = SlotAddress(new_slots, new_i, slot_size);
943
+ SanitizerUnpoisonMemoryRegion(dst_slot, slot_size);
944
+ transfer_n(&c, dst_slot, src_slot, 1);
945
+ SetCtrlInLargeTable(c, new_i, static_cast<h2_t>(start->h2), slot_size);
946
+ }
947
+ return total_probe_length;
467
948
  }
468
949
 
469
- void HashSetResizeHelper::InitControlBytesAfterSoo(ctrl_t* new_ctrl, ctrl_t h2,
470
- size_t new_capacity) {
471
- assert(is_single_group(new_capacity));
472
- std::memset(new_ctrl, static_cast<int8_t>(ctrl_t::kEmpty),
473
- NumControlBytes(new_capacity));
474
- assert(HashSetResizeHelper::SooSlotIndex() == 1);
475
- // This allows us to avoid branching on had_soo_slot_.
476
- assert(had_soo_slot_ || h2 == ctrl_t::kEmpty);
477
- new_ctrl[1] = new_ctrl[new_capacity + 2] = h2;
950
+ // Sentinel value for the start of marked elements.
951
+ // Signals that there are no marked elements.
952
+ constexpr size_t kNoMarkedElementsSentinel = ~size_t{};
953
+
954
+ // Process probed elements that did not fit into available buffers.
955
+ // We marked them in control bytes as kSentinel.
956
+ // Hash recomputation and full probing is done here.
957
+ // This use case should be extremely rare.
958
+ ABSL_ATTRIBUTE_NOINLINE size_t ProcessProbedMarkedElements(
959
+ CommonFields& c, const PolicyFunctions& __restrict policy, ctrl_t* old_ctrl,
960
+ void* old_slots, size_t start) {
961
+ size_t old_capacity = PreviousCapacity(c.capacity());
962
+ const size_t slot_size = policy.slot_size;
963
+ void* new_slots = c.slot_array();
964
+ size_t total_probe_length = 0;
965
+ const void* hash_fn = policy.hash_fn(c);
966
+ auto hash_slot = policy.hash_slot;
967
+ auto transfer_n = policy.transfer_n;
968
+ for (size_t old_index = start; old_index < old_capacity; ++old_index) {
969
+ if (old_ctrl[old_index] != ctrl_t::kSentinel) {
970
+ continue;
971
+ }
972
+ void* src_slot = SlotAddress(old_slots, old_index, slot_size);
973
+ const size_t hash = hash_slot(hash_fn, src_slot);
974
+ const FindInfo target = find_first_non_full(c, hash);
975
+ total_probe_length += target.probe_length;
976
+ const size_t new_i = target.offset;
977
+ void* dst_slot = SlotAddress(new_slots, new_i, slot_size);
978
+ SetCtrlInLargeTable(c, new_i, H2(hash), slot_size);
979
+ transfer_n(&c, dst_slot, src_slot, 1);
980
+ }
981
+ return total_probe_length;
982
+ }
983
+
984
+ // The largest old capacity for which it is guaranteed that all probed elements
985
+ // fit in ProbedItemEncoder's local buffer.
986
+ // For such tables, `encode_probed_element` is trivial.
987
+ constexpr size_t kMaxLocalBufferOldCapacity =
988
+ kProbedElementsBufferSize / sizeof(ProbedItem4Bytes) - 1;
989
+ static_assert(IsValidCapacity(kMaxLocalBufferOldCapacity));
990
+ constexpr size_t kMaxLocalBufferNewCapacity =
991
+ NextCapacity(kMaxLocalBufferOldCapacity);
992
+ static_assert(kMaxLocalBufferNewCapacity <= ProbedItem4Bytes::kMaxNewCapacity);
993
+ static_assert(NextCapacity(kMaxLocalBufferNewCapacity) <=
994
+ ProbedItem4Bytes::kMaxNewCapacity);
995
+
996
+ // Initializes mirrored control bytes after
997
+ // transfer_unprobed_elements_to_next_capacity.
998
+ void InitializeMirroredControlBytes(ctrl_t* new_ctrl, size_t new_capacity) {
999
+ std::memcpy(new_ctrl + new_capacity,
1000
+ // We own GrowthInfo just before control bytes. So it is ok
1001
+ // to read one byte from it.
1002
+ new_ctrl - 1, Group::kWidth);
478
1003
  new_ctrl[new_capacity] = ctrl_t::kSentinel;
479
1004
  }
480
1005
 
481
- void HashSetResizeHelper::GrowIntoSingleGroupShuffleTransferableSlots(
482
- void* new_slots, size_t slot_size) const {
483
- assert(old_capacity_ > 0);
484
- const size_t half_old_capacity = old_capacity_ / 2;
1006
+ // Encodes probed elements into available memory.
1007
+ // At first, a local (on stack) buffer is used. The size of the buffer is
1008
+ // kProbedElementsBufferSize bytes.
1009
+ // When the local buffer is full, we switch to `control_` buffer. We are allowed
1010
+ // to overwrite `control_` buffer till the `source_offset` byte. In case we have
1011
+ // no space in `control_` buffer, we fallback to a naive algorithm for all the
1012
+ // rest of the probed elements. We mark elements as kSentinel in control bytes
1013
+ // and later process them fully. See ProcessMarkedElements for details. It
1014
+ // should be extremely rare.
1015
+ template <typename ProbedItemType,
1016
+ // If true, we only use the local buffer and never switch to the
1017
+ // control buffer.
1018
+ bool kGuaranteedFitToBuffer = false>
1019
+ class ProbedItemEncoder {
1020
+ public:
1021
+ using ProbedItem = ProbedItemType;
1022
+ explicit ProbedItemEncoder(ctrl_t* control) : control_(control) {}
1023
+
1024
+ // Encode item into the best available location.
1025
+ void EncodeItem(ProbedItem item) {
1026
+ if (ABSL_PREDICT_FALSE(!kGuaranteedFitToBuffer && pos_ >= end_)) {
1027
+ return ProcessEncodeWithOverflow(item);
1028
+ }
1029
+ ABSL_SWISSTABLE_ASSERT(pos_ < end_);
1030
+ *pos_ = item;
1031
+ ++pos_;
1032
+ }
1033
+
1034
+ // Decodes information about probed elements from all available sources.
1035
+ // Finds new position for each element and transfers it to the new slots.
1036
+ // Returns the total probe length.
1037
+ size_t DecodeAndInsertToTable(CommonFields& common,
1038
+ const PolicyFunctions& __restrict policy,
1039
+ void* old_slots) const {
1040
+ if (pos_ == buffer_) {
1041
+ return 0;
1042
+ }
1043
+ if constexpr (kGuaranteedFitToBuffer) {
1044
+ return DecodeAndInsertImpl(common, policy, buffer_, pos_, old_slots);
1045
+ }
1046
+ size_t total_probe_length = DecodeAndInsertImpl(
1047
+ common, policy, buffer_,
1048
+ local_buffer_full_ ? buffer_ + kBufferSize : pos_, old_slots);
1049
+ if (!local_buffer_full_) {
1050
+ return total_probe_length;
1051
+ }
1052
+ total_probe_length +=
1053
+ DecodeAndInsertToTableOverflow(common, policy, old_slots);
1054
+ return total_probe_length;
1055
+ }
1056
+
1057
+ private:
1058
+ static ProbedItem* AlignToNextItem(void* ptr) {
1059
+ return reinterpret_cast<ProbedItem*>(AlignUpTo(
1060
+ reinterpret_cast<uintptr_t>(ptr), alignof(ProbedItem)));
1061
+ }
1062
+
1063
+ ProbedItem* OverflowBufferStart() const {
1064
+ // We reuse GrowthInfo memory as well.
1065
+ return AlignToNextItem(control_ - ControlOffset(/*has_infoz=*/false));
1066
+ }
1067
+
1068
+ // Encodes item when previously allocated buffer is full.
1069
+ // At first that happens when local buffer is full.
1070
+ // We switch from the local buffer to the control buffer.
1071
+ // Every time this function is called, the available buffer is extended till
1072
+ // `item.source_offset` byte in the control buffer.
1073
+ // After the buffer is extended, this function wouldn't be called till the
1074
+ // buffer is exhausted.
1075
+ //
1076
+ // If there's no space in the control buffer, we fallback to naive algorithm
1077
+ // and mark probed elements as kSentinel in the control buffer. In this case,
1078
+ // we will call this function for every subsequent probed element.
1079
+ ABSL_ATTRIBUTE_NOINLINE void ProcessEncodeWithOverflow(ProbedItem item) {
1080
+ if (!local_buffer_full_) {
1081
+ local_buffer_full_ = true;
1082
+ pos_ = OverflowBufferStart();
1083
+ }
1084
+ const size_t source_offset = static_cast<size_t>(item.source_offset);
1085
+ // We are in fallback mode so we can't reuse control buffer anymore.
1086
+ // Probed elements are marked as kSentinel in the control buffer.
1087
+ if (ABSL_PREDICT_FALSE(marked_elements_starting_position_ !=
1088
+ kNoMarkedElementsSentinel)) {
1089
+ control_[source_offset] = ctrl_t::kSentinel;
1090
+ return;
1091
+ }
1092
+ // Refresh the end pointer to the new available position.
1093
+ // Invariant: if pos < end, then we have at least sizeof(ProbedItem) bytes
1094
+ // to write.
1095
+ end_ = control_ + source_offset + 1 - sizeof(ProbedItem);
1096
+ if (ABSL_PREDICT_TRUE(pos_ < end_)) {
1097
+ *pos_ = item;
1098
+ ++pos_;
1099
+ return;
1100
+ }
1101
+ control_[source_offset] = ctrl_t::kSentinel;
1102
+ marked_elements_starting_position_ = source_offset;
1103
+ // Now we will always fall down to `ProcessEncodeWithOverflow`.
1104
+ ABSL_SWISSTABLE_ASSERT(pos_ >= end_);
1105
+ }
1106
+
1107
+ // Decodes information about probed elements from control buffer and processes
1108
+ // marked elements.
1109
+ // Finds new position for each element and transfers it to the new slots.
1110
+ // Returns the total probe length.
1111
+ ABSL_ATTRIBUTE_NOINLINE size_t DecodeAndInsertToTableOverflow(
1112
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1113
+ void* old_slots) const {
1114
+ ABSL_SWISSTABLE_ASSERT(local_buffer_full_ &&
1115
+ "must not be called when local buffer is not full");
1116
+ size_t total_probe_length = DecodeAndInsertImpl(
1117
+ common, policy, OverflowBufferStart(), pos_, old_slots);
1118
+ if (ABSL_PREDICT_TRUE(marked_elements_starting_position_ ==
1119
+ kNoMarkedElementsSentinel)) {
1120
+ return total_probe_length;
1121
+ }
1122
+ total_probe_length +=
1123
+ ProcessProbedMarkedElements(common, policy, control_, old_slots,
1124
+ marked_elements_starting_position_);
1125
+ return total_probe_length;
1126
+ }
485
1127
 
486
- SanitizerUnpoisonMemoryRegion(old_slots(), slot_size * old_capacity_);
487
- std::memcpy(new_slots,
488
- SlotAddress(old_slots(), half_old_capacity + 1, slot_size),
489
- slot_size * half_old_capacity);
490
- std::memcpy(SlotAddress(new_slots, half_old_capacity + 1, slot_size),
491
- old_slots(), slot_size * (half_old_capacity + 1));
1128
+ static constexpr size_t kBufferSize =
1129
+ kProbedElementsBufferSize / sizeof(ProbedItem);
1130
+ ProbedItem buffer_[kBufferSize];
1131
+ // If local_buffer_full_ is false, then pos_/end_ are in the local buffer,
1132
+ // otherwise, they're in the overflow buffer.
1133
+ ProbedItem* pos_ = buffer_;
1134
+ const void* end_ = buffer_ + kBufferSize;
1135
+ ctrl_t* const control_;
1136
+ size_t marked_elements_starting_position_ = kNoMarkedElementsSentinel;
1137
+ bool local_buffer_full_ = false;
1138
+ };
1139
+
1140
+ // Grows to next capacity with specified encoder type.
1141
+ // Encoder is used to store probed elements that are processed later.
1142
+ // Different encoder is used depending on the capacity of the table.
1143
+ // Returns total probe length.
1144
+ template <typename Encoder>
1145
+ size_t GrowToNextCapacity(CommonFields& common,
1146
+ const PolicyFunctions& __restrict policy,
1147
+ ctrl_t* old_ctrl, void* old_slots) {
1148
+ using ProbedItem = typename Encoder::ProbedItem;
1149
+ ABSL_SWISSTABLE_ASSERT(common.capacity() <= ProbedItem::kMaxNewCapacity);
1150
+ Encoder encoder(old_ctrl);
1151
+ policy.transfer_unprobed_elements_to_next_capacity(
1152
+ common, old_ctrl, old_slots, &encoder,
1153
+ [](void* probed_storage, h2_t h2, size_t source_offset, size_t h1) {
1154
+ auto encoder_ptr = static_cast<Encoder*>(probed_storage);
1155
+ encoder_ptr->EncodeItem(ProbedItem(h2, source_offset, h1));
1156
+ });
1157
+ InitializeMirroredControlBytes(common.control(), common.capacity());
1158
+ return encoder.DecodeAndInsertToTable(common, policy, old_slots);
492
1159
  }
493
1160
 
494
- void HashSetResizeHelper::GrowSizeIntoSingleGroupTransferable(
495
- CommonFields& c, size_t slot_size) {
496
- assert(old_capacity_ < Group::kWidth / 2);
497
- assert(is_single_group(c.capacity()));
498
- assert(IsGrowingIntoSingleGroupApplicable(old_capacity_, c.capacity()));
1161
+ // Grows to next capacity for relatively small tables so that even if all
1162
+ // elements are probed, we don't need to overflow the local buffer.
1163
+ // Returns total probe length.
1164
+ size_t GrowToNextCapacityThatFitsInLocalBuffer(
1165
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1166
+ ctrl_t* old_ctrl, void* old_slots) {
1167
+ ABSL_SWISSTABLE_ASSERT(common.capacity() <= kMaxLocalBufferNewCapacity);
1168
+ return GrowToNextCapacity<
1169
+ ProbedItemEncoder<ProbedItem4Bytes, /*kGuaranteedFitToBuffer=*/true>>(
1170
+ common, policy, old_ctrl, old_slots);
1171
+ }
499
1172
 
500
- GrowIntoSingleGroupShuffleControlBytes(c.control(), c.capacity());
501
- GrowIntoSingleGroupShuffleTransferableSlots(c.slot_array(), slot_size);
1173
+ // Grows to next capacity with different encodings. Returns total probe length.
1174
+ // These functions are useful to simplify profile analysis.
1175
+ size_t GrowToNextCapacity4BytesEncoder(CommonFields& common,
1176
+ const PolicyFunctions& __restrict policy,
1177
+ ctrl_t* old_ctrl, void* old_slots) {
1178
+ return GrowToNextCapacity<ProbedItemEncoder<ProbedItem4Bytes>>(
1179
+ common, policy, old_ctrl, old_slots);
1180
+ }
1181
+ size_t GrowToNextCapacity8BytesEncoder(CommonFields& common,
1182
+ const PolicyFunctions& __restrict policy,
1183
+ ctrl_t* old_ctrl, void* old_slots) {
1184
+ return GrowToNextCapacity<ProbedItemEncoder<ProbedItem8Bytes>>(
1185
+ common, policy, old_ctrl, old_slots);
1186
+ }
1187
+ size_t GrowToNextCapacity16BytesEncoder(
1188
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1189
+ ctrl_t* old_ctrl, void* old_slots) {
1190
+ return GrowToNextCapacity<ProbedItemEncoder<ProbedItem16Bytes>>(
1191
+ common, policy, old_ctrl, old_slots);
1192
+ }
502
1193
 
503
- // We poison since GrowIntoSingleGroupShuffleTransferableSlots
504
- // may leave empty slots unpoisoned.
505
- PoisonSingleGroupEmptySlots(c, slot_size);
1194
+ // Grows to next capacity for tables with relatively large capacity so that we
1195
+ // can't guarantee that all probed elements fit in the local buffer. Returns
1196
+ // total probe length.
1197
+ size_t GrowToNextCapacityOverflowLocalBuffer(
1198
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1199
+ ctrl_t* old_ctrl, void* old_slots) {
1200
+ const size_t new_capacity = common.capacity();
1201
+ if (ABSL_PREDICT_TRUE(new_capacity <= ProbedItem4Bytes::kMaxNewCapacity)) {
1202
+ return GrowToNextCapacity4BytesEncoder(common, policy, old_ctrl, old_slots);
1203
+ }
1204
+ if (ABSL_PREDICT_TRUE(new_capacity <= ProbedItem8Bytes::kMaxNewCapacity)) {
1205
+ return GrowToNextCapacity8BytesEncoder(common, policy, old_ctrl, old_slots);
1206
+ }
1207
+ // 16 bytes encoding supports the maximum swisstable capacity.
1208
+ return GrowToNextCapacity16BytesEncoder(common, policy, old_ctrl, old_slots);
506
1209
  }
507
1210
 
508
- void HashSetResizeHelper::TransferSlotAfterSoo(CommonFields& c,
509
- size_t slot_size) {
510
- assert(was_soo_);
511
- assert(had_soo_slot_);
512
- assert(is_single_group(c.capacity()));
513
- std::memcpy(SlotAddress(c.slot_array(), SooSlotIndex(), slot_size),
514
- old_soo_data(), slot_size);
515
- PoisonSingleGroupEmptySlots(c, slot_size);
1211
+ // Dispatches to the appropriate `GrowToNextCapacity*` function based on the
1212
+ // capacity of the table. Returns total probe length.
1213
+ ABSL_ATTRIBUTE_NOINLINE
1214
+ size_t GrowToNextCapacityDispatch(CommonFields& common,
1215
+ const PolicyFunctions& __restrict policy,
1216
+ ctrl_t* old_ctrl, void* old_slots) {
1217
+ const size_t new_capacity = common.capacity();
1218
+ if (ABSL_PREDICT_TRUE(new_capacity <= kMaxLocalBufferNewCapacity)) {
1219
+ return GrowToNextCapacityThatFitsInLocalBuffer(common, policy, old_ctrl,
1220
+ old_slots);
1221
+ } else {
1222
+ return GrowToNextCapacityOverflowLocalBuffer(common, policy, old_ctrl,
1223
+ old_slots);
1224
+ }
516
1225
  }
517
1226
 
518
- namespace {
1227
+ // Grows to next capacity and prepares insert for the given new_hash.
1228
+ // Returns the offset of the new element.
1229
+ size_t GrowToNextCapacityAndPrepareInsert(
1230
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1231
+ size_t new_hash) {
1232
+ ABSL_SWISSTABLE_ASSERT(common.growth_left() == 0);
1233
+ const size_t old_capacity = common.capacity();
1234
+ ABSL_SWISSTABLE_ASSERT(old_capacity == 0 ||
1235
+ old_capacity > policy.soo_capacity());
1236
+
1237
+ const size_t new_capacity = NextCapacity(old_capacity);
1238
+ ABSL_SWISSTABLE_ASSERT(IsValidCapacity(new_capacity));
1239
+ ABSL_SWISSTABLE_ASSERT(new_capacity > policy.soo_capacity());
1240
+
1241
+ ctrl_t* old_ctrl = common.control();
1242
+ void* old_slots = common.slot_array();
1243
+
1244
+ common.set_capacity(new_capacity);
1245
+ const size_t slot_size = policy.slot_size;
1246
+ const size_t slot_align = policy.slot_align;
1247
+ HashtablezInfoHandle infoz;
1248
+ if (old_capacity > 0) {
1249
+ infoz = common.infoz();
1250
+ } else {
1251
+ const bool should_sample =
1252
+ policy.is_hashtablez_eligible && ShouldSampleNextTable();
1253
+ if (ABSL_PREDICT_FALSE(should_sample)) {
1254
+ infoz = ForcedTrySample(slot_size, policy.key_size, policy.value_size,
1255
+ policy.soo_capacity());
1256
+ }
1257
+ }
1258
+ const bool has_infoz = infoz.IsSampled();
1259
+
1260
+ RawHashSetLayout layout(new_capacity, slot_size, slot_align, has_infoz);
1261
+ void* alloc = policy.get_char_alloc(common);
1262
+ char* mem = static_cast<char*>(policy.alloc(alloc, layout.alloc_size()));
1263
+ const GenerationType old_generation = common.generation();
1264
+ common.set_generation_ptr(
1265
+ reinterpret_cast<GenerationType*>(mem + layout.generation_offset()));
1266
+ common.set_generation(NextGeneration(old_generation));
1267
+
1268
+ ctrl_t* new_ctrl = reinterpret_cast<ctrl_t*>(mem + layout.control_offset());
1269
+ void* new_slots = mem + layout.slot_offset();
1270
+ common.set_control</*kGenerateSeed=*/false>(new_ctrl);
1271
+ common.set_slots(new_slots);
1272
+ SanitizerPoisonMemoryRegion(new_slots, new_capacity * slot_size);
1273
+
1274
+ h2_t new_h2 = H2(new_hash);
1275
+ size_t total_probe_length = 0;
1276
+ FindInfo find_info;
1277
+ if (old_capacity == 0) {
1278
+ static_assert(NextCapacity(0) == 1);
1279
+ InitializeSingleElementControlBytes(new_h2, new_ctrl);
1280
+ common.generate_new_seed();
1281
+ find_info = FindInfo{0, 0};
1282
+ SanitizerUnpoisonMemoryRegion(new_slots, slot_size);
1283
+ } else {
1284
+ if (ABSL_PREDICT_TRUE(is_single_group(new_capacity))) {
1285
+ GrowIntoSingleGroupShuffleControlBytes(old_ctrl, old_capacity, new_ctrl,
1286
+ new_capacity);
1287
+ // Single group tables have all slots full on resize. So we can transfer
1288
+ // all slots without checking the control bytes.
1289
+ ABSL_SWISSTABLE_ASSERT(common.size() == old_capacity);
1290
+ auto* target = NextSlot(new_slots, slot_size);
1291
+ SanitizerUnpoisonMemoryRegion(target, old_capacity * slot_size);
1292
+ policy.transfer_n(&common, target, old_slots, old_capacity);
1293
+ // We put the new element either at the beginning or at the end of the
1294
+ // table with approximately equal probability.
1295
+ size_t offset = SingleGroupTableH1(new_hash, common.seed()) & 1
1296
+ ? 0
1297
+ : new_capacity - 1;
1298
+
1299
+ ABSL_SWISSTABLE_ASSERT(IsEmpty(new_ctrl[offset]));
1300
+ SetCtrlInSingleGroupTable(common, offset, new_h2, policy.slot_size);
1301
+ find_info = FindInfo{offset, 0};
1302
+ } else {
1303
+ total_probe_length =
1304
+ GrowToNextCapacityDispatch(common, policy, old_ctrl, old_slots);
1305
+ find_info = find_first_non_full(common, new_hash);
1306
+ SetCtrlInLargeTable(common, find_info.offset, new_h2, policy.slot_size);
1307
+ }
1308
+ ABSL_SWISSTABLE_ASSERT(old_capacity > policy.soo_capacity());
1309
+ (*policy.dealloc)(alloc, old_capacity, old_ctrl, slot_size, slot_align,
1310
+ has_infoz);
1311
+ }
1312
+ PrepareInsertCommon(common);
1313
+ ResetGrowthLeft(GetGrowthInfoFromControl(new_ctrl), new_capacity,
1314
+ common.size());
1315
+
1316
+ if (ABSL_PREDICT_FALSE(has_infoz)) {
1317
+ common.set_has_infoz();
1318
+ infoz.RecordStorageChanged(common.size() - 1, new_capacity);
1319
+ infoz.RecordRehash(total_probe_length);
1320
+ infoz.RecordInsert(new_hash, find_info.probe_length);
1321
+ common.set_infoz(infoz);
1322
+ }
1323
+ return find_info.offset;
1324
+ }
519
1325
 
520
1326
  // Called whenever the table needs to vacate empty slots either by removing
521
- // tombstones via rehash or growth.
1327
+ // tombstones via rehash or growth to next capacity.
522
1328
  ABSL_ATTRIBUTE_NOINLINE
523
- FindInfo FindInsertPositionWithGrowthOrRehash(CommonFields& common, size_t hash,
524
- const PolicyFunctions& policy) {
1329
+ size_t RehashOrGrowToNextCapacityAndPrepareInsert(
1330
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1331
+ size_t new_hash) {
525
1332
  const size_t cap = common.capacity();
1333
+ ABSL_ASSUME(cap > 0);
526
1334
  if (cap > Group::kWidth &&
527
1335
  // Do these calculations in 64-bit to avoid overflow.
528
1336
  common.size() * uint64_t{32} <= cap * uint64_t{25}) {
@@ -567,77 +1375,468 @@ FindInfo FindInsertPositionWithGrowthOrRehash(CommonFields& common, size_t hash,
567
1375
  // 762 | 149836 0.37 13 | 148559 0.74 190
568
1376
  // 807 | 149736 0.39 14 | 151107 0.39 14
569
1377
  // 852 | 150204 0.42 15 | 151019 0.42 15
570
- DropDeletesWithoutResize(common, policy);
1378
+ return DropDeletesWithoutResizeAndPrepareInsert(common, policy, new_hash);
571
1379
  } else {
572
1380
  // Otherwise grow the container.
573
- policy.resize(common, NextCapacity(cap), HashtablezInfoHandle{});
1381
+ return GrowToNextCapacityAndPrepareInsert(common, policy, new_hash);
574
1382
  }
575
- // This function is typically called with tables containing deleted slots.
576
- // The table will be big and `FindFirstNonFullAfterResize` will always
577
- // fallback to `find_first_non_full`. So using `find_first_non_full` directly.
578
- return find_first_non_full(common, hash);
1383
+ }
1384
+
1385
+ // Slow path for PrepareInsertNonSoo that is called when the table has deleted
1386
+ // slots or need to be resized or rehashed.
1387
+ size_t PrepareInsertNonSooSlow(CommonFields& common,
1388
+ const PolicyFunctions& __restrict policy,
1389
+ size_t hash) {
1390
+ const GrowthInfo growth_info = common.growth_info();
1391
+ ABSL_SWISSTABLE_ASSERT(!growth_info.HasNoDeletedAndGrowthLeft());
1392
+ if (ABSL_PREDICT_TRUE(growth_info.HasNoGrowthLeftAndNoDeleted())) {
1393
+ // Table without deleted slots (>95% cases) that needs to be resized.
1394
+ ABSL_SWISSTABLE_ASSERT(growth_info.HasNoDeleted() &&
1395
+ growth_info.GetGrowthLeft() == 0);
1396
+ return GrowToNextCapacityAndPrepareInsert(common, policy, hash);
1397
+ }
1398
+ if (ABSL_PREDICT_FALSE(growth_info.HasNoGrowthLeftAssumingMayHaveDeleted())) {
1399
+ // Table with deleted slots that needs to be rehashed or resized.
1400
+ return RehashOrGrowToNextCapacityAndPrepareInsert(common, policy, hash);
1401
+ }
1402
+ // Table with deleted slots that has space for the inserting element.
1403
+ FindInfo target = find_first_non_full(common, hash);
1404
+ PrepareInsertCommon(common);
1405
+ common.growth_info().OverwriteControlAsFull(common.control()[target.offset]);
1406
+ SetCtrlInLargeTable(common, target.offset, H2(hash), policy.slot_size);
1407
+ common.infoz().RecordInsert(hash, target.probe_length);
1408
+ return target.offset;
1409
+ }
1410
+
1411
+ // Resizes empty non-allocated SOO table to NextCapacity(SooCapacity()),
1412
+ // forces the table to be sampled and prepares the insert.
1413
+ // SOO tables need to switch from SOO to heap in order to store the infoz.
1414
+ // Requires:
1415
+ // 1. `c.capacity() == SooCapacity()`.
1416
+ // 2. `c.empty()`.
1417
+ ABSL_ATTRIBUTE_NOINLINE size_t
1418
+ GrowEmptySooTableToNextCapacityForceSamplingAndPrepareInsert(
1419
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1420
+ size_t new_hash) {
1421
+ ResizeEmptyNonAllocatedTableImpl(common, policy, NextCapacity(SooCapacity()),
1422
+ /*force_infoz=*/true);
1423
+ PrepareInsertCommon(common);
1424
+ common.growth_info().OverwriteEmptyAsFull();
1425
+ SetCtrlInSingleGroupTable(common, SooSlotIndex(), H2(new_hash),
1426
+ policy.slot_size);
1427
+ common.infoz().RecordInsert(new_hash, /*distance_from_desired=*/0);
1428
+ return SooSlotIndex();
1429
+ }
1430
+
1431
+ // Resizes empty non-allocated table to the capacity to fit new_size elements.
1432
+ // Requires:
1433
+ // 1. `c.capacity() == policy.soo_capacity()`.
1434
+ // 2. `c.empty()`.
1435
+ // 3. `new_size > policy.soo_capacity()`.
1436
+ // The table will be attempted to be sampled.
1437
+ void ReserveEmptyNonAllocatedTableToFitNewSize(
1438
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1439
+ size_t new_size) {
1440
+ ValidateMaxSize(new_size, policy.slot_size);
1441
+ ABSL_ASSUME(new_size > 0);
1442
+ ResizeEmptyNonAllocatedTableImpl(common, policy, SizeToCapacity(new_size),
1443
+ /*force_infoz=*/false);
1444
+ // This is after resize, to ensure that we have completed the allocation
1445
+ // and have potentially sampled the hashtable.
1446
+ common.infoz().RecordReservation(new_size);
1447
+ }
1448
+
1449
+ // Type erased version of raw_hash_set::reserve for tables that have an
1450
+ // allocated backing array.
1451
+ //
1452
+ // Requires:
1453
+ // 1. `c.capacity() > policy.soo_capacity()` OR `!c.empty()`.
1454
+ // Reserving already allocated tables is considered to be a rare case.
1455
+ ABSL_ATTRIBUTE_NOINLINE void ReserveAllocatedTable(
1456
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1457
+ size_t new_size) {
1458
+ const size_t cap = common.capacity();
1459
+ ValidateMaxSize(new_size, policy.slot_size);
1460
+ ABSL_ASSUME(new_size > 0);
1461
+ const size_t new_capacity = SizeToCapacity(new_size);
1462
+ if (cap == policy.soo_capacity()) {
1463
+ ABSL_SWISSTABLE_ASSERT(!common.empty());
1464
+ ResizeFullSooTable(common, policy, new_capacity,
1465
+ ResizeFullSooTableSamplingMode::kNoSampling);
1466
+ } else {
1467
+ ABSL_SWISSTABLE_ASSERT(cap > policy.soo_capacity());
1468
+ // TODO(b/382423690): consider using GrowToNextCapacity, when applicable.
1469
+ ResizeAllocatedTableWithSeedChange(common, policy, new_capacity);
1470
+ }
1471
+ common.infoz().RecordReservation(new_size);
579
1472
  }
580
1473
 
581
1474
  } // namespace
582
1475
 
583
- const void* GetHashRefForEmptyHasher(const CommonFields& common) {
1476
+ void* GetRefForEmptyClass(CommonFields& common) {
584
1477
  // Empty base optimization typically make the empty base class address to be
585
1478
  // the same as the first address of the derived class object.
586
- // But we generally assume that for empty hasher we can return any valid
1479
+ // But we generally assume that for empty classes we can return any valid
587
1480
  // pointer.
588
1481
  return &common;
589
1482
  }
590
1483
 
591
- size_t PrepareInsertNonSoo(CommonFields& common, size_t hash, FindInfo target,
592
- const PolicyFunctions& policy) {
593
- // When there are no deleted slots in the table
594
- // and growth_left is positive, we can insert at the first
595
- // empty slot in the probe sequence (target).
596
- const bool use_target_hint =
597
- // Optimization is disabled when generations are enabled.
598
- // We have to rehash even sparse tables randomly in such mode.
599
- !SwisstableGenerationsEnabled() &&
600
- common.growth_info().HasNoDeletedAndGrowthLeft();
601
- if (ABSL_PREDICT_FALSE(!use_target_hint)) {
602
- // Notes about optimized mode when generations are disabled:
603
- // We do not enter this branch if table has no deleted slots
604
- // and growth_left is positive.
605
- // We enter this branch in the following cases listed in decreasing
606
- // frequency:
607
- // 1. Table without deleted slots (>95% cases) that needs to be resized.
608
- // 2. Table with deleted slots that has space for the inserting element.
609
- // 3. Table with deleted slots that needs to be rehashed or resized.
610
- if (ABSL_PREDICT_TRUE(common.growth_info().HasNoGrowthLeftAndNoDeleted())) {
611
- const size_t old_capacity = common.capacity();
612
- policy.resize(common, NextCapacity(old_capacity), HashtablezInfoHandle{});
613
- target = HashSetResizeHelper::FindFirstNonFullAfterResize(
614
- common, old_capacity, hash);
615
- } else {
616
- // Note: the table may have no deleted slots here when generations
617
- // are enabled.
618
- const bool rehash_for_bug_detection =
619
- common.should_rehash_for_bug_detection_on_insert();
620
- if (rehash_for_bug_detection) {
621
- // Move to a different heap allocation in order to detect bugs.
622
- const size_t cap = common.capacity();
623
- policy.resize(common,
624
- common.growth_left() > 0 ? cap : NextCapacity(cap),
625
- HashtablezInfoHandle{});
1484
+ void ResizeAllocatedTableWithSeedChange(
1485
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1486
+ size_t new_capacity) {
1487
+ ResizeNonSooImpl<ResizeNonSooMode::kGuaranteedAllocated>(
1488
+ common, policy, new_capacity, common.infoz());
1489
+ }
1490
+
1491
+ void ReserveEmptyNonAllocatedTableToFitBucketCount(
1492
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1493
+ size_t bucket_count) {
1494
+ size_t new_capacity = NormalizeCapacity(bucket_count);
1495
+ ValidateMaxSize(CapacityToGrowth(new_capacity), policy.slot_size);
1496
+ ResizeEmptyNonAllocatedTableImpl(common, policy, new_capacity,
1497
+ /*force_infoz=*/false);
1498
+ }
1499
+
1500
+ // Resizes a full SOO table to the NextCapacity(SooCapacity()).
1501
+ template <size_t SooSlotMemcpySize, bool TransferUsesMemcpy>
1502
+ size_t GrowSooTableToNextCapacityAndPrepareInsert(
1503
+ CommonFields& common, const PolicyFunctions& __restrict policy,
1504
+ size_t new_hash, ctrl_t soo_slot_ctrl) {
1505
+ AssertSoo(common, policy);
1506
+ if (ABSL_PREDICT_FALSE(soo_slot_ctrl == ctrl_t::kEmpty)) {
1507
+ // The table is empty, it is only used for forced sampling of SOO tables.
1508
+ return GrowEmptySooTableToNextCapacityForceSamplingAndPrepareInsert(
1509
+ common, policy, new_hash);
1510
+ }
1511
+ ABSL_SWISSTABLE_ASSERT(common.size() == policy.soo_capacity());
1512
+ static constexpr size_t kNewCapacity = NextCapacity(SooCapacity());
1513
+ const size_t slot_size = policy.slot_size;
1514
+ const size_t slot_align = policy.slot_align;
1515
+ common.set_capacity(kNewCapacity);
1516
+
1517
+ // Since the table is not empty, it will not be sampled.
1518
+ // The decision to sample was already made during the first insertion.
1519
+ RawHashSetLayout layout(kNewCapacity, slot_size, slot_align,
1520
+ /*has_infoz=*/false);
1521
+ void* alloc = policy.get_char_alloc(common);
1522
+ char* mem = static_cast<char*>(policy.alloc(alloc, layout.alloc_size()));
1523
+ const GenerationType old_generation = common.generation();
1524
+ common.set_generation_ptr(
1525
+ reinterpret_cast<GenerationType*>(mem + layout.generation_offset()));
1526
+ common.set_generation(NextGeneration(old_generation));
1527
+
1528
+ // We do not set control and slots in CommonFields yet to avoid overriding
1529
+ // SOO data.
1530
+ ctrl_t* new_ctrl = reinterpret_cast<ctrl_t*>(mem + layout.control_offset());
1531
+ void* new_slots = mem + layout.slot_offset();
1532
+
1533
+ PrepareInsertCommon(common);
1534
+ ABSL_SWISSTABLE_ASSERT(common.size() == 2);
1535
+ GetGrowthInfoFromControl(new_ctrl).InitGrowthLeftNoDeleted(kNewCapacity - 2);
1536
+ common.generate_new_seed();
1537
+
1538
+ // After resize from capacity 1 to 3, we always have exactly the slot with
1539
+ // index 1 occupied, so we need to insert either at index 0 or index 2.
1540
+ static_assert(SooSlotIndex() == 1);
1541
+ const size_t offset = SingleGroupTableH1(new_hash, common.seed()) & 2;
1542
+ InitializeThreeElementsControlBytesAfterSoo(soo_slot_ctrl, new_hash, offset,
1543
+ new_ctrl);
1544
+
1545
+ SanitizerPoisonMemoryRegion(new_slots, slot_size * kNewCapacity);
1546
+ void* target_slot = SlotAddress(new_slots, SooSlotIndex(), slot_size);
1547
+ SanitizerUnpoisonMemoryRegion(target_slot, slot_size);
1548
+ if constexpr (TransferUsesMemcpy) {
1549
+ // Target slot is placed at index 1, but capacity is at
1550
+ // minimum 3. So we are allowed to copy at least twice as much
1551
+ // memory.
1552
+ static_assert(SooSlotIndex() == 1);
1553
+ static_assert(SooSlotMemcpySize > 0);
1554
+ static_assert(SooSlotMemcpySize <= MaxSooSlotSize());
1555
+ ABSL_SWISSTABLE_ASSERT(SooSlotMemcpySize <= 2 * slot_size);
1556
+ ABSL_SWISSTABLE_ASSERT(SooSlotMemcpySize >= slot_size);
1557
+ void* next_slot = SlotAddress(target_slot, 1, slot_size);
1558
+ SanitizerUnpoisonMemoryRegion(next_slot, SooSlotMemcpySize - slot_size);
1559
+ std::memcpy(target_slot, common.soo_data(), SooSlotMemcpySize);
1560
+ SanitizerPoisonMemoryRegion(next_slot, SooSlotMemcpySize - slot_size);
1561
+ } else {
1562
+ static_assert(SooSlotMemcpySize == 0);
1563
+ policy.transfer_n(&common, target_slot, common.soo_data(), 1);
1564
+ }
1565
+ // Seed was already generated above.
1566
+ common.set_control</*kGenerateSeed=*/false>(new_ctrl);
1567
+ common.set_slots(new_slots);
1568
+
1569
+ common.infoz().RecordInsert(new_hash, /*distance_from_desired=*/0);
1570
+ SanitizerUnpoisonMemoryRegion(SlotAddress(new_slots, offset, slot_size),
1571
+ slot_size);
1572
+ return offset;
1573
+ }
1574
+
1575
+ void GrowFullSooTableToNextCapacityForceSampling(
1576
+ CommonFields& common, const PolicyFunctions& __restrict policy) {
1577
+ AssertFullSoo(common, policy);
1578
+ ResizeFullSooTable(
1579
+ common, policy, NextCapacity(SooCapacity()),
1580
+ ResizeFullSooTableSamplingMode::kForceSampleNoResizeIfUnsampled);
1581
+ }
1582
+
1583
+ void Rehash(CommonFields& common, const PolicyFunctions& __restrict policy,
1584
+ size_t n) {
1585
+ const size_t cap = common.capacity();
1586
+
1587
+ auto clear_backing_array = [&]() {
1588
+ ClearBackingArray(common, policy, policy.get_char_alloc(common),
1589
+ /*reuse=*/false, policy.soo_enabled);
1590
+ };
1591
+
1592
+ const size_t slot_size = policy.slot_size;
1593
+
1594
+ if (n == 0) {
1595
+ if (cap <= policy.soo_capacity()) return;
1596
+ if (common.empty()) {
1597
+ clear_backing_array();
1598
+ return;
1599
+ }
1600
+ if (common.size() <= policy.soo_capacity()) {
1601
+ // When the table is already sampled, we keep it sampled.
1602
+ if (common.infoz().IsSampled()) {
1603
+ static constexpr size_t kInitialSampledCapacity =
1604
+ NextCapacity(SooCapacity());
1605
+ if (cap > kInitialSampledCapacity) {
1606
+ ResizeAllocatedTableWithSeedChange(common, policy,
1607
+ kInitialSampledCapacity);
1608
+ }
1609
+ // This asserts that we didn't lose sampling coverage in `resize`.
1610
+ ABSL_SWISSTABLE_ASSERT(common.infoz().IsSampled());
1611
+ return;
626
1612
  }
627
- if (ABSL_PREDICT_TRUE(common.growth_left() > 0)) {
628
- target = find_first_non_full(common, hash);
1613
+ ABSL_SWISSTABLE_ASSERT(slot_size <= sizeof(HeapOrSoo));
1614
+ ABSL_SWISSTABLE_ASSERT(policy.slot_align <= alignof(HeapOrSoo));
1615
+ HeapOrSoo tmp_slot(uninitialized_tag_t{});
1616
+ size_t begin_offset = FindFirstFullSlot(0, cap, common.control());
1617
+ policy.transfer_n(
1618
+ &common, &tmp_slot,
1619
+ SlotAddress(common.slot_array(), begin_offset, slot_size), 1);
1620
+ clear_backing_array();
1621
+ policy.transfer_n(&common, common.soo_data(), &tmp_slot, 1);
1622
+ common.set_full_soo();
1623
+ return;
1624
+ }
1625
+ }
1626
+
1627
+ ValidateMaxSize(n, policy.slot_size);
1628
+ // bitor is a faster way of doing `max` here. We will round up to the next
1629
+ // power-of-2-minus-1, so bitor is good enough.
1630
+ const size_t new_capacity =
1631
+ NormalizeCapacity(n | SizeToCapacity(common.size()));
1632
+ // n == 0 unconditionally rehashes as per the standard.
1633
+ if (n == 0 || new_capacity > cap) {
1634
+ if (cap == policy.soo_capacity()) {
1635
+ if (common.empty()) {
1636
+ ResizeEmptyNonAllocatedTableImpl(common, policy, new_capacity,
1637
+ /*force_infoz=*/false);
629
1638
  } else {
630
- target = FindInsertPositionWithGrowthOrRehash(common, hash, policy);
1639
+ ResizeFullSooTable(common, policy, new_capacity,
1640
+ ResizeFullSooTableSamplingMode::kNoSampling);
631
1641
  }
1642
+ } else {
1643
+ ResizeAllocatedTableWithSeedChange(common, policy, new_capacity);
1644
+ }
1645
+ // This is after resize, to ensure that we have completed the allocation
1646
+ // and have potentially sampled the hashtable.
1647
+ common.infoz().RecordReservation(n);
1648
+ }
1649
+ }
1650
+
1651
+ void Copy(CommonFields& common, const PolicyFunctions& __restrict policy,
1652
+ const CommonFields& other,
1653
+ absl::FunctionRef<void(void*, const void*)> copy_fn) {
1654
+ const size_t size = other.size();
1655
+ ABSL_SWISSTABLE_ASSERT(size > 0);
1656
+ const size_t soo_capacity = policy.soo_capacity();
1657
+ const size_t slot_size = policy.slot_size;
1658
+ if (size <= soo_capacity) {
1659
+ ABSL_SWISSTABLE_ASSERT(size == 1);
1660
+ common.set_full_soo();
1661
+ const void* other_slot =
1662
+ other.capacity() <= soo_capacity
1663
+ ? other.soo_data()
1664
+ : SlotAddress(
1665
+ other.slot_array(),
1666
+ FindFirstFullSlot(0, other.capacity(), other.control()),
1667
+ slot_size);
1668
+ copy_fn(common.soo_data(), other_slot);
1669
+
1670
+ if (policy.is_hashtablez_eligible && ShouldSampleNextTable()) {
1671
+ GrowFullSooTableToNextCapacityForceSampling(common, policy);
632
1672
  }
1673
+ return;
1674
+ }
1675
+
1676
+ ReserveTableToFitNewSize(common, policy, size);
1677
+ auto infoz = common.infoz();
1678
+ ABSL_SWISSTABLE_ASSERT(other.capacity() > soo_capacity);
1679
+ const size_t cap = common.capacity();
1680
+ ABSL_SWISSTABLE_ASSERT(cap > soo_capacity);
1681
+ // Note about single group tables:
1682
+ // 1. It is correct to have any order of elements.
1683
+ // 2. Order has to be non deterministic.
1684
+ // 3. We are assigning elements with arbitrary `shift` starting from
1685
+ // `capacity + shift` position.
1686
+ // 4. `shift` must be coprime with `capacity + 1` in order to be able to use
1687
+ // modular arithmetic to traverse all positions, instead of cycling
1688
+ // through a subset of positions. Odd numbers are coprime with any
1689
+ // `capacity + 1` (2^N).
1690
+ size_t offset = cap;
1691
+ const size_t shift = is_single_group(cap) ? (common.seed().seed() | 1) : 0;
1692
+ const void* hash_fn = policy.hash_fn(common);
1693
+ auto hasher = policy.hash_slot;
1694
+ IterateOverFullSlotsImpl(
1695
+ other, slot_size, [&](const ctrl_t* that_ctrl, void* that_slot) {
1696
+ if (shift == 0) {
1697
+ // Big tables case. Position must be searched via probing.
1698
+ // The table is guaranteed to be empty, so we can do faster than
1699
+ // a full `insert`.
1700
+ const size_t hash = (*hasher)(hash_fn, that_slot);
1701
+ FindInfo target = find_first_non_full(common, hash);
1702
+ infoz.RecordInsert(hash, target.probe_length);
1703
+ offset = target.offset;
1704
+ } else {
1705
+ // Small tables case. Next position is computed via shift.
1706
+ offset = (offset + shift) & cap;
1707
+ }
1708
+ const h2_t h2 = static_cast<h2_t>(*that_ctrl);
1709
+ // We rely on the hash not changing for small tables.
1710
+ ABSL_SWISSTABLE_ASSERT(
1711
+ H2((*hasher)(hash_fn, that_slot)) == h2 &&
1712
+ "hash function value changed unexpectedly during the copy");
1713
+ SetCtrl(common, offset, h2, slot_size);
1714
+ copy_fn(SlotAddress(common.slot_array(), offset, slot_size), that_slot);
1715
+ common.maybe_increment_generation_on_insert();
1716
+ });
1717
+ if (shift != 0) {
1718
+ // On small table copy we do not record individual inserts.
1719
+ // RecordInsert requires hash, but it is unknown for small tables.
1720
+ infoz.RecordStorageChanged(size, cap);
1721
+ }
1722
+ common.increment_size(size);
1723
+ common.growth_info().OverwriteManyEmptyAsFull(size);
1724
+ }
1725
+
1726
+ void ReserveTableToFitNewSize(CommonFields& common,
1727
+ const PolicyFunctions& __restrict policy,
1728
+ size_t new_size) {
1729
+ common.reset_reserved_growth(new_size);
1730
+ common.set_reservation_size(new_size);
1731
+ ABSL_SWISSTABLE_ASSERT(new_size > policy.soo_capacity());
1732
+ const size_t cap = common.capacity();
1733
+ if (ABSL_PREDICT_TRUE(common.empty() && cap <= policy.soo_capacity())) {
1734
+ return ReserveEmptyNonAllocatedTableToFitNewSize(common, policy, new_size);
1735
+ }
1736
+
1737
+ ABSL_SWISSTABLE_ASSERT(!common.empty() || cap > policy.soo_capacity());
1738
+ ABSL_SWISSTABLE_ASSERT(cap > 0);
1739
+ const size_t max_size_before_growth =
1740
+ cap <= policy.soo_capacity() ? policy.soo_capacity()
1741
+ : common.size() + common.growth_left();
1742
+ if (new_size <= max_size_before_growth) {
1743
+ return;
1744
+ }
1745
+ ReserveAllocatedTable(common, policy, new_size);
1746
+ }
1747
+
1748
+ size_t PrepareInsertNonSoo(CommonFields& common,
1749
+ const PolicyFunctions& __restrict policy,
1750
+ size_t hash, FindInfo target) {
1751
+ const bool rehash_for_bug_detection =
1752
+ common.should_rehash_for_bug_detection_on_insert() &&
1753
+ // Required to allow use of ResizeAllocatedTable.
1754
+ common.capacity() > 0;
1755
+ if (rehash_for_bug_detection) {
1756
+ // Move to a different heap allocation in order to detect bugs.
1757
+ const size_t cap = common.capacity();
1758
+ ResizeAllocatedTableWithSeedChange(
1759
+ common, policy, common.growth_left() > 0 ? cap : NextCapacity(cap));
1760
+ target = find_first_non_full(common, hash);
1761
+ }
1762
+
1763
+ const GrowthInfo growth_info = common.growth_info();
1764
+ // When there are no deleted slots in the table
1765
+ // and growth_left is positive, we can insert at the first
1766
+ // empty slot in the probe sequence (target).
1767
+ if (ABSL_PREDICT_FALSE(!growth_info.HasNoDeletedAndGrowthLeft())) {
1768
+ return PrepareInsertNonSooSlow(common, policy, hash);
633
1769
  }
634
1770
  PrepareInsertCommon(common);
635
- common.growth_info().OverwriteControlAsFull(common.control()[target.offset]);
1771
+ common.growth_info().OverwriteEmptyAsFull();
636
1772
  SetCtrl(common, target.offset, H2(hash), policy.slot_size);
637
1773
  common.infoz().RecordInsert(hash, target.probe_length);
638
1774
  return target.offset;
639
1775
  }
640
1776
 
1777
+ namespace {
1778
+ // Returns true if the following is true
1779
+ // 1. OptimalMemcpySizeForSooSlotTransfer(left) >
1780
+ // OptimalMemcpySizeForSooSlotTransfer(left - 1)
1781
+ // 2. OptimalMemcpySizeForSooSlotTransfer(left) are equal for all i in [left,
1782
+ // right].
1783
+ // This function is used to verify that we have all the possible template
1784
+ // instantiations for GrowFullSooTableToNextCapacity.
1785
+ // With this verification the problem may be detected at compile time instead of
1786
+ // link time.
1787
+ constexpr bool VerifyOptimalMemcpySizeForSooSlotTransferRange(size_t left,
1788
+ size_t right) {
1789
+ size_t optimal_size_for_range = OptimalMemcpySizeForSooSlotTransfer(left);
1790
+ if (optimal_size_for_range <= OptimalMemcpySizeForSooSlotTransfer(left - 1)) {
1791
+ return false;
1792
+ }
1793
+ for (size_t i = left + 1; i <= right; ++i) {
1794
+ if (OptimalMemcpySizeForSooSlotTransfer(i) != optimal_size_for_range) {
1795
+ return false;
1796
+ }
1797
+ }
1798
+ return true;
1799
+ }
1800
+ } // namespace
1801
+
1802
+ // Extern template instantiation for inline function.
1803
+ template size_t TryFindNewIndexWithoutProbing(size_t h1, size_t old_index,
1804
+ size_t old_capacity,
1805
+ ctrl_t* new_ctrl,
1806
+ size_t new_capacity);
1807
+
1808
+ // We need to instantiate ALL possible template combinations because we define
1809
+ // the function in the cc file.
1810
+ template size_t GrowSooTableToNextCapacityAndPrepareInsert<0, false>(
1811
+ CommonFields&, const PolicyFunctions&, size_t, ctrl_t);
1812
+ template size_t GrowSooTableToNextCapacityAndPrepareInsert<
1813
+ OptimalMemcpySizeForSooSlotTransfer(1), true>(CommonFields&,
1814
+ const PolicyFunctions&,
1815
+ size_t, ctrl_t);
1816
+
1817
+ static_assert(VerifyOptimalMemcpySizeForSooSlotTransferRange(2, 3));
1818
+ template size_t GrowSooTableToNextCapacityAndPrepareInsert<
1819
+ OptimalMemcpySizeForSooSlotTransfer(3), true>(CommonFields&,
1820
+ const PolicyFunctions&,
1821
+ size_t, ctrl_t);
1822
+
1823
+ static_assert(VerifyOptimalMemcpySizeForSooSlotTransferRange(4, 8));
1824
+ template size_t GrowSooTableToNextCapacityAndPrepareInsert<
1825
+ OptimalMemcpySizeForSooSlotTransfer(8), true>(CommonFields&,
1826
+ const PolicyFunctions&,
1827
+ size_t, ctrl_t);
1828
+
1829
+ #if UINTPTR_MAX == UINT32_MAX
1830
+ static_assert(MaxSooSlotSize() == 8);
1831
+ #else
1832
+ static_assert(VerifyOptimalMemcpySizeForSooSlotTransferRange(9, 16));
1833
+ template size_t GrowSooTableToNextCapacityAndPrepareInsert<
1834
+ OptimalMemcpySizeForSooSlotTransfer(16), true>(CommonFields&,
1835
+ const PolicyFunctions&,
1836
+ size_t, ctrl_t);
1837
+ static_assert(MaxSooSlotSize() == 16);
1838
+ #endif
1839
+
641
1840
  } // namespace container_internal
642
1841
  ABSL_NAMESPACE_END
643
1842
  } // namespace absl