grpc 1.52.0 → 1.53.0.pre2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (892) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +50 -5
  3. data/include/grpc/event_engine/event_engine.h +24 -2
  4. data/include/grpc/event_engine/slice_buffer.h +13 -1
  5. data/include/grpc/impl/grpc_types.h +3 -0
  6. data/include/grpc/support/time.h +6 -4
  7. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +148 -0
  8. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +52 -0
  9. data/src/core/ext/filters/backend_metrics/backend_metric_provider.h +29 -0
  10. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +3 -3
  11. data/src/core/ext/filters/channel_idle/idle_filter_state.h +3 -3
  12. data/src/core/ext/filters/client_channel/backend_metric.h +3 -3
  13. data/src/core/ext/filters/client_channel/backup_poller.h +3 -3
  14. data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
  15. data/src/core/ext/filters/client_channel/client_channel.cc +29 -33
  16. data/src/core/ext/filters/client_channel/client_channel.h +3 -3
  17. data/src/core/ext/filters/client_channel/client_channel_channelz.h +3 -3
  18. data/src/core/ext/filters/client_channel/client_channel_factory.h +3 -3
  19. data/src/core/ext/filters/client_channel/client_channel_service_config.h +3 -3
  20. data/src/core/ext/filters/client_channel/config_selector.h +3 -3
  21. data/src/core/ext/filters/client_channel/connector.h +8 -4
  22. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  23. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -3
  24. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  25. data/src/core/ext/filters/client_channel/http_proxy.h +3 -3
  26. data/src/core/ext/filters/client_channel/lb_call_state_internal.h +3 -3
  27. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -3
  28. data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -3
  29. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +3 -3
  30. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -7
  31. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +3 -3
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +3 -3
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +3 -3
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -3
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
  37. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +1 -78
  38. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +3 -3
  39. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +117 -0
  40. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +3 -3
  41. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +3 -3
  42. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
  43. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -3
  44. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +128 -0
  45. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h +71 -0
  46. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +972 -0
  47. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -6
  48. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +3 -3
  49. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +3 -3
  50. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +12 -7
  51. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +275 -107
  52. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +10 -3
  53. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +5 -0
  54. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +3 -3
  55. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -3
  56. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +6 -1
  57. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +1 -2
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +3 -3
  59. data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +3 -3
  60. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +3 -3
  61. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +1 -0
  62. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +3 -3
  63. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +3 -7
  64. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +3 -3
  65. data/src/core/ext/filters/client_channel/retry_filter.cc +10 -13
  66. data/src/core/ext/filters/client_channel/retry_filter.h +3 -3
  67. data/src/core/ext/filters/client_channel/retry_service_config.h +3 -3
  68. data/src/core/ext/filters/client_channel/retry_throttle.h +3 -3
  69. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +4 -4
  70. data/src/core/ext/filters/client_channel/subchannel.cc +5 -1
  71. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  72. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -3
  73. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -3
  74. data/src/core/ext/filters/client_channel/subchannel_stream_client.h +3 -3
  75. data/src/core/ext/filters/deadline/deadline_filter.cc +40 -48
  76. data/src/core/ext/filters/deadline/deadline_filter.h +6 -10
  77. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +3 -3
  78. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h +3 -3
  79. data/src/core/ext/filters/http/client/http_client_filter.cc +26 -21
  80. data/src/core/ext/filters/http/client/http_client_filter.h +3 -3
  81. data/src/core/ext/filters/http/client_authority_filter.h +3 -3
  82. data/src/core/ext/filters/http/message_compress/compression_filter.cc +109 -117
  83. data/src/core/ext/filters/http/message_compress/compression_filter.h +17 -10
  84. data/src/core/ext/filters/http/server/http_server_filter.cc +25 -24
  85. data/src/core/ext/filters/http/server/http_server_filter.h +3 -3
  86. data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
  87. data/src/core/ext/filters/message_size/message_size_filter.h +3 -3
  88. data/src/core/ext/filters/rbac/rbac_filter.cc +4 -3
  89. data/src/core/ext/filters/rbac/rbac_filter.h +3 -3
  90. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +3 -3
  91. data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -3
  92. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.h +3 -3
  93. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +27 -37
  94. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +5 -5
  95. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +3 -3
  96. data/src/core/ext/transport/chttp2/alpn/alpn.h +3 -3
  97. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -7
  98. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +3 -3
  99. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -0
  100. data/src/core/ext/transport/chttp2/server/chttp2_server.h +3 -3
  101. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +3 -3
  102. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +3 -3
  103. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +195 -111
  104. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
  105. data/src/core/ext/transport/chttp2/transport/context_list.h +3 -3
  106. data/src/core/ext/transport/chttp2/transport/decode_huff.h +3 -3
  107. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
  108. data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -3
  109. data/src/core/ext/transport/chttp2/transport/frame.h +3 -3
  110. data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -0
  111. data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -3
  112. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -0
  113. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -3
  114. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -0
  115. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
  116. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -0
  117. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -3
  118. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -0
  119. data/src/core/ext/transport/chttp2/transport/frame_settings.h +3 -3
  120. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +2 -0
  121. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -3
  122. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +3 -3
  123. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +3 -3
  124. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +3 -3
  125. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +18 -407
  126. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
  127. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -0
  128. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -3
  129. data/src/core/ext/transport/chttp2/transport/http2_settings.h +3 -3
  130. data/src/core/ext/transport/chttp2/transport/http_trace.h +3 -3
  131. data/src/core/ext/transport/chttp2/transport/huffsyms.h +3 -3
  132. data/src/core/ext/transport/chttp2/transport/internal.h +28 -23
  133. data/src/core/ext/transport/chttp2/transport/parsing.cc +111 -31
  134. data/src/core/ext/transport/chttp2/transport/stream_map.h +3 -3
  135. data/src/core/ext/transport/chttp2/transport/varint.h +3 -3
  136. data/src/core/ext/transport/chttp2/transport/writing.cc +9 -8
  137. data/src/core/ext/transport/inproc/inproc_transport.h +3 -3
  138. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +3 -2
  139. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +9 -0
  140. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +38 -2
  141. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +185 -0
  142. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +7 -3
  143. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +44 -0
  144. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +16 -25
  145. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +48 -74
  146. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +30 -7
  147. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +137 -0
  148. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +15 -12
  149. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +83 -51
  150. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +3 -2
  151. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +15 -0
  152. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +17 -2
  153. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +61 -0
  154. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +11 -5
  155. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +37 -6
  156. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +5 -3
  157. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +24 -0
  158. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +5 -3
  159. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +22 -0
  160. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +6 -3
  161. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +24 -0
  162. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -5
  163. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +50 -0
  164. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +57 -16
  165. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +254 -17
  166. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +3 -2
  167. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +9 -0
  168. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -2
  169. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +9 -0
  170. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +7 -6
  171. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +21 -12
  172. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -3
  173. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +23 -0
  174. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +10 -7
  175. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +42 -12
  176. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +54 -0
  177. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +188 -0
  178. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +111 -0
  179. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +444 -0
  180. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +7 -3
  181. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +24 -0
  182. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +8 -6
  183. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +31 -9
  184. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +5 -3
  185. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +24 -0
  186. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +47 -0
  187. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +113 -0
  188. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +43 -0
  189. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +114 -0
  190. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +3 -1
  191. data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.c +54 -53
  192. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.c +34 -13
  193. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.h +10 -0
  194. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +195 -187
  195. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +232 -224
  196. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +0 -5
  197. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +95 -75
  198. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +5 -0
  199. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +94 -93
  200. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +81 -75
  201. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +189 -187
  202. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +7 -3
  203. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +5 -0
  204. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +71 -66
  205. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +137 -133
  206. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +16 -12
  207. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +140 -133
  208. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +81 -70
  209. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
  210. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +771 -741
  211. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +10 -0
  212. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.c +16 -14
  213. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opentelemetry.upbdefs.c +14 -13
  214. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.c +20 -18
  215. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +53 -42
  216. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +363 -356
  217. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +149 -145
  218. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +16 -13
  219. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.c +48 -0
  220. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.h +35 -0
  221. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +14 -14
  222. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.c +40 -0
  223. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.h +40 -0
  224. data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.c +10 -9
  225. data/src/core/ext/xds/certificate_provider_store.h +3 -3
  226. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +1 -0
  227. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +3 -3
  228. data/src/core/ext/xds/upb_utils.h +3 -3
  229. data/src/core/ext/xds/xds_api.h +3 -3
  230. data/src/core/ext/xds/xds_bootstrap.h +3 -3
  231. data/src/core/ext/xds/xds_bootstrap_grpc.cc +1 -0
  232. data/src/core/ext/xds/xds_bootstrap_grpc.h +3 -3
  233. data/src/core/ext/xds/xds_certificate_provider.h +3 -3
  234. data/src/core/ext/xds/xds_channel_args.h +3 -3
  235. data/src/core/ext/xds/xds_channel_stack_modifier.h +3 -3
  236. data/src/core/ext/xds/xds_client.cc +8 -3
  237. data/src/core/ext/xds/xds_client.h +3 -3
  238. data/src/core/ext/xds/xds_client_grpc.cc +0 -1
  239. data/src/core/ext/xds/xds_client_grpc.h +3 -3
  240. data/src/core/ext/xds/xds_client_stats.h +4 -3
  241. data/src/core/ext/xds/xds_cluster.cc +11 -7
  242. data/src/core/ext/xds/xds_cluster.h +6 -6
  243. data/src/core/ext/xds/xds_cluster_specifier_plugin.h +3 -3
  244. data/src/core/ext/xds/xds_common_types.cc +1 -0
  245. data/src/core/ext/xds/xds_common_types.h +3 -3
  246. data/src/core/ext/xds/xds_endpoint.cc +1 -1
  247. data/src/core/ext/xds/xds_endpoint.h +3 -3
  248. data/src/core/ext/xds/xds_health_status.h +30 -3
  249. data/src/core/ext/xds/xds_http_fault_filter.h +3 -3
  250. data/src/core/ext/xds/xds_http_filters.cc +1 -1
  251. data/src/core/ext/xds/xds_http_filters.h +3 -3
  252. data/src/core/ext/xds/xds_http_rbac_filter.h +3 -3
  253. data/src/core/ext/xds/xds_http_stateful_session_filter.h +3 -3
  254. data/src/core/ext/xds/xds_lb_policy_registry.cc +95 -0
  255. data/src/core/ext/xds/xds_lb_policy_registry.h +3 -3
  256. data/src/core/ext/xds/xds_listener.cc +1 -0
  257. data/src/core/ext/xds/xds_listener.h +3 -3
  258. data/src/core/ext/xds/xds_resource_type.h +3 -3
  259. data/src/core/ext/xds/xds_resource_type_impl.h +3 -3
  260. data/src/core/ext/xds/xds_route_config.cc +6 -0
  261. data/src/core/ext/xds/xds_route_config.h +3 -3
  262. data/src/core/ext/xds/xds_routing.h +3 -3
  263. data/src/core/ext/xds/xds_transport.h +3 -3
  264. data/src/core/ext/xds/xds_transport_grpc.h +3 -3
  265. data/src/core/lib/address_utils/parse_address.h +3 -3
  266. data/src/core/lib/address_utils/sockaddr_utils.cc +1 -0
  267. data/src/core/lib/address_utils/sockaddr_utils.h +3 -3
  268. data/src/core/lib/avl/avl.h +3 -3
  269. data/src/core/lib/backoff/backoff.h +3 -3
  270. data/src/core/lib/channel/call_finalization.h +3 -3
  271. data/src/core/lib/channel/call_tracer.h +3 -3
  272. data/src/core/lib/channel/channel_args.cc +1 -0
  273. data/src/core/lib/channel/channel_args.h +11 -5
  274. data/src/core/lib/channel/channel_args_preconditioning.h +3 -3
  275. data/src/core/lib/channel/channel_fwd.h +3 -3
  276. data/src/core/lib/channel/channel_stack.cc +1 -2
  277. data/src/core/lib/channel/channel_stack.h +4 -4
  278. data/src/core/lib/channel/channel_stack_builder.h +3 -3
  279. data/src/core/lib/channel/channel_stack_builder_impl.cc +14 -1
  280. data/src/core/lib/channel/channel_stack_builder_impl.h +3 -3
  281. data/src/core/lib/channel/channel_trace.h +3 -3
  282. data/src/core/lib/channel/channelz.h +3 -3
  283. data/src/core/lib/channel/channelz_registry.h +3 -3
  284. data/src/core/lib/channel/connected_channel.cc +883 -354
  285. data/src/core/lib/channel/connected_channel.h +3 -3
  286. data/src/core/lib/channel/context.h +7 -3
  287. data/src/core/lib/channel/promise_based_filter.cc +532 -260
  288. data/src/core/lib/channel/promise_based_filter.h +124 -44
  289. data/src/core/lib/channel/status_util.h +3 -3
  290. data/src/core/lib/compression/compression_internal.h +3 -3
  291. data/src/core/lib/compression/message_compress.h +3 -3
  292. data/src/core/lib/config/core_configuration.h +3 -3
  293. data/src/core/lib/debug/event_log.h +3 -3
  294. data/src/core/lib/debug/histogram_view.h +3 -3
  295. data/src/core/lib/debug/stats.h +3 -3
  296. data/src/core/lib/debug/stats_data.cc +66 -65
  297. data/src/core/lib/debug/stats_data.h +42 -33
  298. data/src/core/lib/debug/trace.h +4 -26
  299. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +5 -0
  300. data/src/core/lib/event_engine/channel_args_endpoint_config.h +3 -3
  301. data/src/core/lib/event_engine/common_closures.h +3 -3
  302. data/src/core/lib/event_engine/default_event_engine.cc +9 -4
  303. data/src/core/lib/event_engine/default_event_engine.h +30 -6
  304. data/src/core/lib/event_engine/default_event_engine_factory.h +3 -3
  305. data/src/core/lib/event_engine/event_engine.cc +25 -0
  306. data/src/core/lib/event_engine/executor/executor.h +3 -3
  307. data/src/core/lib/event_engine/forkable.cc +11 -6
  308. data/src/core/lib/event_engine/forkable.h +3 -3
  309. data/src/core/lib/event_engine/handle_containers.h +10 -3
  310. data/src/core/lib/event_engine/poller.h +3 -3
  311. data/src/core/lib/event_engine/posix.h +158 -0
  312. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +44 -16
  313. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +14 -4
  314. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +6 -7
  315. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +3 -3
  316. data/src/core/lib/event_engine/posix_engine/event_poller.h +3 -3
  317. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -3
  318. data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +3 -3
  319. data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -3
  320. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +52 -55
  321. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +46 -13
  322. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +82 -12
  323. data/src/core/lib/event_engine/posix_engine/posix_engine.h +23 -9
  324. data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +3 -3
  325. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +60 -7
  326. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +65 -14
  327. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +0 -1
  328. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +6 -6
  329. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -3
  330. data/src/core/lib/event_engine/posix_engine/timer.h +3 -3
  331. data/src/core/lib/event_engine/posix_engine/timer_heap.h +3 -3
  332. data/src/core/lib/event_engine/posix_engine/timer_manager.h +3 -3
  333. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +3 -3
  334. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +3 -3
  335. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +3 -3
  336. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +3 -3
  337. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +3 -3
  338. data/src/core/lib/event_engine/resolved_address.cc +19 -0
  339. data/src/core/lib/event_engine/resolved_address_internal.h +34 -0
  340. data/src/core/lib/event_engine/shim.cc +56 -0
  341. data/src/core/lib/event_engine/shim.h +33 -0
  342. data/src/core/lib/event_engine/slice.cc +1 -1
  343. data/src/core/lib/event_engine/tcp_socket_utils.cc +18 -2
  344. data/src/core/lib/event_engine/tcp_socket_utils.h +8 -3
  345. data/src/core/lib/event_engine/thread_local.cc +29 -0
  346. data/src/core/lib/event_engine/thread_local.h +32 -0
  347. data/src/core/lib/event_engine/thread_pool.cc +41 -65
  348. data/src/core/lib/event_engine/thread_pool.h +21 -17
  349. data/src/core/lib/event_engine/time_util.h +3 -3
  350. data/src/core/lib/event_engine/trace.cc +6 -0
  351. data/src/core/lib/event_engine/trace.h +16 -3
  352. data/src/core/lib/event_engine/utils.cc +2 -2
  353. data/src/core/lib/event_engine/utils.h +12 -4
  354. data/src/core/lib/event_engine/windows/iocp.cc +24 -40
  355. data/src/core/lib/event_engine/windows/iocp.h +3 -3
  356. data/src/core/lib/event_engine/windows/win_socket.cc +56 -33
  357. data/src/core/lib/event_engine/windows/win_socket.h +34 -25
  358. data/src/core/lib/event_engine/windows/windows_endpoint.cc +331 -0
  359. data/src/core/lib/event_engine/windows/windows_endpoint.h +103 -0
  360. data/src/core/lib/event_engine/windows/windows_engine.cc +243 -20
  361. data/src/core/lib/event_engine/windows/windows_engine.h +62 -23
  362. data/src/core/lib/experiments/config.cc +16 -1
  363. data/src/core/lib/experiments/config.h +13 -3
  364. data/src/core/lib/experiments/experiments.cc +14 -8
  365. data/src/core/lib/experiments/experiments.h +80 -21
  366. data/src/core/lib/gpr/alloc.h +3 -3
  367. data/src/core/lib/gpr/spinlock.h +3 -3
  368. data/src/core/lib/gpr/string.h +3 -3
  369. data/src/core/lib/gpr/sync_abseil.cc +15 -7
  370. data/src/core/lib/gpr/time_precise.h +3 -3
  371. data/src/core/lib/gpr/tmpfile.h +3 -3
  372. data/src/core/lib/gpr/useful.h +3 -3
  373. data/src/core/lib/gprpp/atomic_utils.h +3 -3
  374. data/src/core/lib/gprpp/bitset.h +3 -3
  375. data/src/core/lib/gprpp/chunked_vector.h +3 -3
  376. data/src/core/lib/gprpp/construct_destruct.h +3 -3
  377. data/src/core/lib/gprpp/cpp_impl_of.h +3 -3
  378. data/src/core/lib/gprpp/crash.h +3 -3
  379. data/src/core/lib/gprpp/debug_location.h +3 -6
  380. data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
  381. data/src/core/lib/gprpp/env.h +3 -3
  382. data/src/core/lib/gprpp/examine_stack.h +3 -3
  383. data/src/core/lib/gprpp/fork.cc +21 -4
  384. data/src/core/lib/gprpp/fork.h +7 -5
  385. data/src/core/lib/gprpp/global_config.h +3 -3
  386. data/src/core/lib/gprpp/global_config_custom.h +3 -3
  387. data/src/core/lib/gprpp/global_config_env.cc +1 -0
  388. data/src/core/lib/gprpp/global_config_env.h +3 -3
  389. data/src/core/lib/gprpp/global_config_generic.h +3 -3
  390. data/src/core/lib/gprpp/host_port.cc +2 -0
  391. data/src/core/lib/gprpp/host_port.h +3 -3
  392. data/src/core/lib/gprpp/load_file.h +3 -3
  393. data/src/core/lib/gprpp/manual_constructor.h +3 -3
  394. data/src/core/lib/gprpp/match.h +3 -3
  395. data/src/core/lib/gprpp/memory.h +3 -3
  396. data/src/core/lib/gprpp/mpscq.h +3 -3
  397. data/src/core/lib/gprpp/no_destruct.h +3 -3
  398. data/src/core/lib/gprpp/notification.h +3 -3
  399. data/src/core/lib/gprpp/orphanable.h +3 -3
  400. data/src/core/lib/gprpp/overload.h +3 -3
  401. data/src/core/lib/gprpp/packed_table.h +3 -3
  402. data/src/core/lib/gprpp/per_cpu.h +3 -3
  403. data/src/core/lib/gprpp/ref_counted.h +3 -3
  404. data/src/core/lib/gprpp/ref_counted_ptr.h +3 -3
  405. data/src/core/lib/gprpp/single_set_ptr.h +3 -3
  406. data/src/core/lib/gprpp/sorted_pack.h +3 -3
  407. data/src/core/lib/gprpp/stat.h +3 -3
  408. data/src/core/lib/gprpp/status_helper.h +3 -3
  409. data/src/core/lib/gprpp/strerror.cc +2 -0
  410. data/src/core/lib/gprpp/strerror.h +3 -3
  411. data/src/core/lib/gprpp/sync.h +3 -3
  412. data/src/core/lib/gprpp/table.h +3 -3
  413. data/src/core/lib/gprpp/tchar.h +3 -3
  414. data/src/core/lib/gprpp/thd.h +3 -3
  415. data/src/core/lib/gprpp/time.cc +1 -0
  416. data/src/core/lib/gprpp/time.h +3 -3
  417. data/src/core/lib/gprpp/time_averaged_stats.h +3 -3
  418. data/src/core/lib/gprpp/time_util.h +3 -3
  419. data/src/core/lib/gprpp/unique_type_name.h +3 -3
  420. data/src/core/lib/gprpp/validation_errors.h +3 -3
  421. data/src/core/lib/gprpp/work_serializer.h +3 -3
  422. data/src/core/lib/handshaker/proxy_mapper.h +3 -3
  423. data/src/core/lib/handshaker/proxy_mapper_registry.h +3 -3
  424. data/src/core/lib/http/format_request.cc +1 -0
  425. data/src/core/lib/http/format_request.h +3 -3
  426. data/src/core/lib/http/httpcli.cc +1 -0
  427. data/src/core/lib/http/httpcli.h +3 -3
  428. data/src/core/lib/http/httpcli_ssl_credentials.h +3 -3
  429. data/src/core/lib/http/parser.h +3 -3
  430. data/src/core/lib/iomgr/block_annotate.h +3 -3
  431. data/src/core/lib/iomgr/buffer_list.h +3 -3
  432. data/src/core/lib/iomgr/call_combiner.cc +4 -4
  433. data/src/core/lib/iomgr/call_combiner.h +3 -3
  434. data/src/core/lib/iomgr/cfstream_handle.h +3 -3
  435. data/src/core/lib/iomgr/closure.cc +27 -0
  436. data/src/core/lib/iomgr/closure.h +5 -3
  437. data/src/core/lib/iomgr/combiner.h +3 -3
  438. data/src/core/lib/iomgr/dynamic_annotations.h +3 -3
  439. data/src/core/lib/iomgr/endpoint.h +3 -3
  440. data/src/core/lib/iomgr/endpoint_cfstream.h +3 -3
  441. data/src/core/lib/iomgr/endpoint_pair.h +3 -3
  442. data/src/core/lib/iomgr/endpoint_pair_windows.cc +10 -2
  443. data/src/core/lib/iomgr/error.h +3 -3
  444. data/src/core/lib/iomgr/error_cfstream.h +3 -3
  445. data/src/core/lib/iomgr/ev_apple.h +3 -3
  446. data/src/core/lib/iomgr/ev_epoll1_linux.h +3 -3
  447. data/src/core/lib/iomgr/ev_poll_posix.h +3 -3
  448. data/src/core/lib/iomgr/ev_posix.h +3 -3
  449. data/src/core/lib/iomgr/event_engine_shims/closure.cc +62 -0
  450. data/src/core/lib/iomgr/event_engine_shims/closure.h +39 -0
  451. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +430 -0
  452. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +43 -0
  453. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +91 -0
  454. data/src/core/lib/iomgr/event_engine_shims/tcp_client.h +44 -0
  455. data/src/core/lib/iomgr/exec_ctx.h +3 -3
  456. data/src/core/lib/iomgr/executor.h +3 -3
  457. data/src/core/lib/iomgr/fork_posix.cc +5 -4
  458. data/src/core/lib/iomgr/gethostname.h +3 -3
  459. data/src/core/lib/iomgr/grpc_if_nametoindex.h +3 -3
  460. data/src/core/lib/iomgr/internal_errqueue.h +3 -3
  461. data/src/core/lib/iomgr/iocp_windows.h +3 -3
  462. data/src/core/lib/iomgr/iomgr.h +3 -3
  463. data/src/core/lib/iomgr/iomgr_fwd.h +3 -3
  464. data/src/core/lib/iomgr/iomgr_internal.h +3 -3
  465. data/src/core/lib/iomgr/load_file.h +3 -3
  466. data/src/core/lib/iomgr/lockfree_event.h +3 -3
  467. data/src/core/lib/iomgr/nameser.h +3 -3
  468. data/src/core/lib/iomgr/polling_entity.h +3 -3
  469. data/src/core/lib/iomgr/pollset.h +3 -3
  470. data/src/core/lib/iomgr/pollset_set.h +3 -3
  471. data/src/core/lib/iomgr/pollset_set_windows.h +3 -3
  472. data/src/core/lib/iomgr/pollset_windows.cc +2 -2
  473. data/src/core/lib/iomgr/pollset_windows.h +3 -3
  474. data/src/core/lib/iomgr/port.h +3 -3
  475. data/src/core/lib/iomgr/python_util.h +3 -3
  476. data/src/core/lib/iomgr/resolve_address.h +3 -3
  477. data/src/core/lib/iomgr/resolve_address_impl.h +3 -3
  478. data/src/core/lib/iomgr/resolve_address_posix.h +3 -3
  479. data/src/core/lib/iomgr/resolve_address_windows.h +3 -3
  480. data/src/core/lib/iomgr/resolved_address.h +3 -3
  481. data/src/core/lib/iomgr/sockaddr.h +3 -3
  482. data/src/core/lib/iomgr/sockaddr_posix.h +3 -3
  483. data/src/core/lib/iomgr/sockaddr_windows.h +3 -3
  484. data/src/core/lib/iomgr/socket_factory_posix.h +3 -3
  485. data/src/core/lib/iomgr/socket_mutator.h +3 -3
  486. data/src/core/lib/iomgr/socket_utils.h +3 -3
  487. data/src/core/lib/iomgr/socket_utils_posix.h +3 -3
  488. data/src/core/lib/iomgr/socket_windows.h +3 -3
  489. data/src/core/lib/iomgr/systemd_utils.cc +19 -19
  490. data/src/core/lib/iomgr/systemd_utils.h +24 -24
  491. data/src/core/lib/iomgr/tcp_client.h +3 -3
  492. data/src/core/lib/iomgr/tcp_client_posix.cc +12 -0
  493. data/src/core/lib/iomgr/tcp_client_posix.h +3 -3
  494. data/src/core/lib/iomgr/tcp_client_windows.cc +13 -1
  495. data/src/core/lib/iomgr/tcp_posix.cc +49 -65
  496. data/src/core/lib/iomgr/tcp_posix.h +3 -3
  497. data/src/core/lib/iomgr/tcp_server.h +3 -3
  498. data/src/core/lib/iomgr/tcp_server_posix.cc +219 -4
  499. data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -3
  500. data/src/core/lib/iomgr/tcp_server_windows.cc +4 -6
  501. data/src/core/lib/iomgr/tcp_windows.h +3 -3
  502. data/src/core/lib/iomgr/timer.h +3 -3
  503. data/src/core/lib/iomgr/timer_generic.h +3 -3
  504. data/src/core/lib/iomgr/timer_heap.h +3 -3
  505. data/src/core/lib/iomgr/timer_manager.h +3 -3
  506. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -3
  507. data/src/core/lib/iomgr/wakeup_fd_pipe.h +3 -3
  508. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -3
  509. data/src/core/lib/json/json.h +3 -3
  510. data/src/core/lib/json/json_args.h +3 -3
  511. data/src/core/lib/json/json_channel_args.h +3 -3
  512. data/src/core/lib/json/json_object_loader.h +3 -3
  513. data/src/core/lib/json/json_reader.cc +1 -0
  514. data/src/core/lib/json/json_util.h +3 -3
  515. data/src/core/lib/load_balancing/lb_policy.cc +9 -0
  516. data/src/core/lib/load_balancing/lb_policy.h +9 -5
  517. data/src/core/lib/load_balancing/lb_policy_factory.h +3 -3
  518. data/src/core/lib/load_balancing/lb_policy_registry.cc +1 -0
  519. data/src/core/lib/load_balancing/lb_policy_registry.h +3 -3
  520. data/src/core/lib/load_balancing/subchannel_interface.h +8 -6
  521. data/src/core/lib/matchers/matchers.cc +1 -0
  522. data/src/core/lib/matchers/matchers.h +3 -3
  523. data/src/core/lib/promise/activity.cc +8 -6
  524. data/src/core/lib/promise/activity.h +52 -66
  525. data/src/core/lib/promise/arena_promise.h +3 -3
  526. data/src/core/lib/promise/context.h +3 -3
  527. data/src/core/lib/promise/detail/basic_join.h +197 -0
  528. data/src/core/lib/promise/detail/basic_seq.h +10 -16
  529. data/src/core/lib/promise/detail/promise_factory.h +3 -3
  530. data/src/core/lib/promise/detail/promise_like.h +3 -3
  531. data/src/core/lib/promise/detail/status.h +3 -3
  532. data/src/core/lib/promise/detail/switch.h +3 -3
  533. data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +3 -3
  534. data/src/core/lib/promise/if.h +195 -0
  535. data/src/core/lib/promise/interceptor_list.h +308 -0
  536. data/src/core/lib/promise/intra_activity_waiter.h +9 -3
  537. data/src/core/lib/promise/latch.h +99 -5
  538. data/src/core/lib/promise/loop.h +4 -4
  539. data/src/core/lib/promise/map.h +4 -6
  540. data/src/core/lib/promise/pipe.h +296 -193
  541. data/src/core/lib/promise/poll.h +113 -14
  542. data/src/core/lib/promise/promise.h +4 -5
  543. data/src/core/lib/promise/race.h +6 -9
  544. data/src/core/lib/promise/seq.h +3 -3
  545. data/src/core/lib/promise/sleep.h +3 -3
  546. data/src/core/lib/promise/{pipe.cc → trace.cc} +3 -2
  547. data/src/core/lib/promise/trace.h +24 -0
  548. data/src/core/lib/promise/try_join.h +82 -0
  549. data/src/core/lib/promise/try_seq.h +3 -3
  550. data/src/core/lib/resolver/resolver.h +3 -3
  551. data/src/core/lib/resolver/resolver_factory.h +4 -4
  552. data/src/core/lib/resolver/resolver_registry.cc +15 -0
  553. data/src/core/lib/resolver/resolver_registry.h +3 -3
  554. data/src/core/lib/resolver/server_address.cc +1 -0
  555. data/src/core/lib/resolver/server_address.h +3 -3
  556. data/src/core/lib/resource_quota/api.h +3 -3
  557. data/src/core/lib/resource_quota/arena.cc +36 -9
  558. data/src/core/lib/resource_quota/arena.h +84 -22
  559. data/src/core/lib/resource_quota/memory_quota.h +3 -3
  560. data/src/core/lib/resource_quota/periodic_update.h +3 -3
  561. data/src/core/lib/resource_quota/resource_quota.h +3 -3
  562. data/src/core/lib/resource_quota/thread_quota.h +3 -3
  563. data/src/core/lib/resource_quota/trace.h +3 -3
  564. data/src/core/lib/security/authorization/authorization_engine.h +3 -3
  565. data/src/core/lib/security/authorization/authorization_policy_provider.h +3 -3
  566. data/src/core/lib/security/authorization/evaluate_args.h +3 -3
  567. data/src/core/lib/security/authorization/grpc_authorization_engine.h +3 -3
  568. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +3 -3
  569. data/src/core/lib/security/authorization/matchers.h +3 -3
  570. data/src/core/lib/security/authorization/rbac_policy.cc +1 -0
  571. data/src/core/lib/security/authorization/rbac_policy.h +3 -3
  572. data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +3 -3
  573. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +3 -3
  574. data/src/core/lib/security/context/security_context.h +3 -3
  575. data/src/core/lib/security/credentials/alts/alts_credentials.h +3 -3
  576. data/src/core/lib/security/credentials/alts/check_gcp_environment.h +3 -3
  577. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +3 -3
  578. data/src/core/lib/security/credentials/call_creds_util.h +3 -3
  579. data/src/core/lib/security/credentials/channel_creds_registry.h +3 -3
  580. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -3
  581. data/src/core/lib/security/credentials/credentials.h +3 -3
  582. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -0
  583. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +3 -3
  584. data/src/core/lib/security/credentials/external/aws_request_signer.cc +1 -0
  585. data/src/core/lib/security/credentials/external/aws_request_signer.h +3 -3
  586. data/src/core/lib/security/credentials/external/external_account_credentials.cc +1 -0
  587. data/src/core/lib/security/credentials/external/external_account_credentials.h +3 -3
  588. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -3
  589. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
  590. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +3 -3
  591. data/src/core/lib/security/credentials/fake/fake_credentials.h +3 -3
  592. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -3
  593. data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -0
  594. data/src/core/lib/security/credentials/iam/iam_credentials.h +3 -3
  595. data/src/core/lib/security/credentials/insecure/insecure_credentials.h +3 -3
  596. data/src/core/lib/security/credentials/jwt/json_token.h +3 -3
  597. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +4 -3
  598. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
  599. data/src/core/lib/security/credentials/local/local_credentials.h +3 -3
  600. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +4 -3
  601. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -3
  602. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +3 -3
  603. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +3 -3
  604. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +1 -1
  605. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +3 -3
  606. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +3 -3
  607. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -3
  608. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -3
  609. data/src/core/lib/security/credentials/tls/tls_utils.h +3 -3
  610. data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
  611. data/src/core/lib/security/security_connector/alts/alts_security_connector.h +3 -3
  612. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
  613. data/src/core/lib/security/security_connector/fake/fake_security_connector.h +3 -3
  614. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +3 -3
  615. data/src/core/lib/security/security_connector/load_system_roots.h +3 -3
  616. data/src/core/lib/security/security_connector/load_system_roots_supported.h +3 -3
  617. data/src/core/lib/security/security_connector/local/local_security_connector.h +3 -3
  618. data/src/core/lib/security/security_connector/security_connector.h +3 -3
  619. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +1 -0
  620. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +3 -3
  621. data/src/core/lib/security/security_connector/ssl_utils.h +3 -3
  622. data/src/core/lib/security/security_connector/ssl_utils_config.h +3 -3
  623. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +3 -3
  624. data/src/core/lib/security/transport/auth_filters.h +27 -5
  625. data/src/core/lib/security/transport/secure_endpoint.h +3 -3
  626. data/src/core/lib/security/transport/security_handshaker.cc +9 -0
  627. data/src/core/lib/security/transport/security_handshaker.h +3 -3
  628. data/src/core/lib/security/transport/server_auth_filter.cc +120 -251
  629. data/src/core/lib/security/transport/tsi_error.h +3 -3
  630. data/src/core/lib/security/util/json_util.h +3 -3
  631. data/src/core/lib/service_config/service_config.h +3 -3
  632. data/src/core/lib/service_config/service_config_call_data.h +3 -3
  633. data/src/core/lib/service_config/service_config_impl.h +3 -3
  634. data/src/core/lib/service_config/service_config_parser.h +3 -3
  635. data/src/core/lib/slice/b64.h +3 -3
  636. data/src/core/lib/slice/percent_encoding.h +3 -3
  637. data/src/core/lib/slice/slice.cc +3 -3
  638. data/src/core/lib/slice/slice.h +14 -21
  639. data/src/core/lib/slice/slice_buffer.h +10 -4
  640. data/src/core/lib/slice/slice_internal.h +3 -3
  641. data/src/core/lib/slice/slice_refcount.cc +20 -0
  642. data/src/core/lib/slice/slice_refcount.h +26 -6
  643. data/src/core/lib/slice/slice_string_helpers.h +3 -3
  644. data/src/core/lib/surface/api_trace.h +3 -3
  645. data/src/core/lib/surface/builtins.h +3 -3
  646. data/src/core/lib/surface/call.cc +866 -252
  647. data/src/core/lib/surface/call.h +31 -3
  648. data/src/core/lib/surface/call_log_batch.cc +1 -0
  649. data/src/core/lib/surface/call_test_only.h +3 -3
  650. data/src/core/lib/surface/call_trace.cc +21 -11
  651. data/src/core/lib/surface/call_trace.h +3 -3
  652. data/src/core/lib/surface/channel.h +3 -3
  653. data/src/core/lib/surface/channel_init.h +3 -3
  654. data/src/core/lib/surface/channel_stack_type.h +3 -3
  655. data/src/core/lib/surface/completion_queue.cc +1 -0
  656. data/src/core/lib/surface/completion_queue.h +3 -3
  657. data/src/core/lib/surface/completion_queue_factory.h +3 -3
  658. data/src/core/lib/surface/event_string.cc +1 -0
  659. data/src/core/lib/surface/event_string.h +3 -3
  660. data/src/core/lib/surface/init.cc +1 -1
  661. data/src/core/lib/surface/init.h +3 -3
  662. data/src/core/lib/surface/init_internally.h +3 -3
  663. data/src/core/lib/surface/lame_client.cc +3 -1
  664. data/src/core/lib/surface/lame_client.h +3 -3
  665. data/src/core/lib/surface/server.cc +273 -27
  666. data/src/core/lib/surface/server.h +6 -3
  667. data/src/core/lib/surface/validate_metadata.h +3 -3
  668. data/src/core/lib/surface/version.cc +2 -2
  669. data/src/core/lib/transport/bdp_estimator.h +3 -3
  670. data/src/core/lib/transport/connectivity_state.h +3 -3
  671. data/src/core/lib/transport/error_utils.h +3 -3
  672. data/src/core/lib/transport/handshaker.cc +11 -0
  673. data/src/core/lib/transport/handshaker.h +4 -4
  674. data/src/core/lib/transport/handshaker_factory.h +3 -3
  675. data/src/core/lib/transport/handshaker_registry.h +3 -3
  676. data/src/core/lib/transport/http2_errors.h +3 -3
  677. data/src/core/lib/transport/http_connect_handshaker.h +3 -3
  678. data/src/core/lib/transport/metadata_batch.cc +11 -0
  679. data/src/core/lib/transport/metadata_batch.h +24 -3
  680. data/src/core/lib/transport/parsed_metadata.h +3 -3
  681. data/src/core/lib/transport/pid_controller.h +3 -3
  682. data/src/core/lib/transport/status_conversion.h +3 -3
  683. data/src/core/lib/transport/tcp_connect_handshaker.cc +0 -1
  684. data/src/core/lib/transport/tcp_connect_handshaker.h +3 -3
  685. data/src/core/lib/transport/timeout_encoding.h +3 -3
  686. data/src/core/lib/transport/transport.cc +3 -8
  687. data/src/core/lib/transport/transport.h +16 -8
  688. data/src/core/lib/transport/transport_fwd.h +3 -3
  689. data/src/core/lib/transport/transport_impl.h +3 -3
  690. data/src/core/lib/transport/transport_op_string.cc +1 -0
  691. data/src/core/lib/uri/uri_parser.cc +1 -1
  692. data/src/core/lib/uri/uri_parser.h +3 -3
  693. data/src/core/plugin_registry/grpc_plugin_registry.cc +5 -0
  694. data/src/core/tsi/alts/crypt/gsec.h +3 -3
  695. data/src/core/tsi/alts/frame_protector/alts_counter.h +3 -3
  696. data/src/core/tsi/alts/frame_protector/alts_crypter.h +3 -3
  697. data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +3 -3
  698. data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +3 -3
  699. data/src/core/tsi/alts/frame_protector/frame_handler.h +3 -3
  700. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +3 -3
  701. data/src/core/tsi/alts/handshaker/alts_shared_resource.h +3 -3
  702. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -3
  703. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -3
  704. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +3 -3
  705. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +3 -3
  706. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -3
  707. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +3 -3
  708. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +3 -3
  709. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +3 -3
  710. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +3 -3
  711. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +3 -3
  712. data/src/core/tsi/fake_transport_security.h +3 -3
  713. data/src/core/tsi/local_transport_security.h +3 -3
  714. data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +1 -1
  715. data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +3 -3
  716. data/src/core/tsi/ssl/session_cache/ssl_session.h +3 -3
  717. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -3
  718. data/src/core/tsi/ssl_transport_security.cc +113 -24
  719. data/src/core/tsi/ssl_transport_security.h +5 -3
  720. data/src/core/tsi/ssl_transport_security_utils.h +3 -3
  721. data/src/core/tsi/ssl_types.h +3 -3
  722. data/src/core/tsi/transport_security.h +3 -3
  723. data/src/core/tsi/transport_security_grpc.h +3 -3
  724. data/src/core/tsi/transport_security_interface.h +3 -3
  725. data/src/ruby/lib/grpc/version.rb +1 -1
  726. data/src/ruby/pb/generate_proto_ruby.sh +0 -6
  727. data/third_party/abseil-cpp/absl/algorithm/container.h +56 -57
  728. data/third_party/abseil-cpp/absl/base/attributes.h +39 -19
  729. data/third_party/abseil-cpp/absl/base/config.h +44 -3
  730. data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +3 -18
  731. data/third_party/abseil-cpp/absl/base/internal/cycleclock_config.h +55 -0
  732. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -1
  733. data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +3 -3
  734. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +2 -2
  735. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +1 -1
  736. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +10 -6
  737. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +23 -24
  738. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +3 -3
  739. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +2 -6
  740. data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +4 -1
  741. data/third_party/abseil-cpp/absl/base/internal/strerror.cc +4 -4
  742. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +14 -10
  743. data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +9 -0
  744. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +4 -0
  745. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -40
  746. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +62 -0
  747. data/third_party/abseil-cpp/absl/base/macros.h +4 -21
  748. data/third_party/abseil-cpp/absl/base/optimization.h +58 -6
  749. data/third_party/abseil-cpp/absl/base/options.h +1 -7
  750. data/third_party/abseil-cpp/absl/base/policy_checks.h +15 -13
  751. data/third_party/abseil-cpp/absl/container/fixed_array.h +7 -5
  752. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -7
  753. data/third_party/abseil-cpp/absl/container/inlined_vector.h +66 -18
  754. data/third_party/abseil-cpp/absl/container/internal/common.h +3 -3
  755. data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +132 -0
  756. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +13 -1
  757. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +4 -55
  758. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +50 -5
  759. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +14 -46
  760. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +110 -32
  761. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +155 -4
  762. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +661 -341
  763. data/third_party/abseil-cpp/absl/crc/crc32c.cc +99 -0
  764. data/third_party/abseil-cpp/absl/crc/crc32c.h +183 -0
  765. data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +256 -0
  766. data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.h +57 -0
  767. data/third_party/abseil-cpp/absl/crc/internal/crc.cc +468 -0
  768. data/third_party/abseil-cpp/absl/crc/internal/crc.h +91 -0
  769. data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +269 -0
  770. data/third_party/abseil-cpp/absl/crc/internal/crc32c.h +39 -0
  771. data/third_party/abseil-cpp/absl/crc/internal/crc32c_inline.h +72 -0
  772. data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +130 -0
  773. data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +159 -0
  774. data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +179 -0
  775. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy.h +119 -0
  776. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_fallback.cc +75 -0
  777. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +434 -0
  778. data/third_party/abseil-cpp/absl/crc/internal/crc_non_temporal_memcpy.cc +93 -0
  779. data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +725 -0
  780. data/third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +79 -0
  781. data/third_party/abseil-cpp/absl/crc/internal/non_temporal_memcpy.h +180 -0
  782. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +1 -1
  783. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +67 -38
  784. data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +1 -1
  785. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -13
  786. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +11 -9
  787. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +1 -1
  788. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +40 -85
  789. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +5 -4
  790. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +33 -8
  791. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +3 -2
  792. data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +3 -2
  793. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +118 -94
  794. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +7 -6
  795. data/third_party/abseil-cpp/absl/functional/any_invocable.h +5 -2
  796. data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +47 -26
  797. data/third_party/abseil-cpp/absl/hash/internal/city.cc +10 -10
  798. data/third_party/abseil-cpp/absl/hash/internal/hash.h +18 -4
  799. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +3 -14
  800. data/third_party/abseil-cpp/absl/memory/memory.h +26 -447
  801. data/third_party/abseil-cpp/absl/meta/type_traits.h +104 -12
  802. data/third_party/abseil-cpp/absl/numeric/bits.h +2 -3
  803. data/third_party/abseil-cpp/absl/numeric/int128.cc +10 -8
  804. data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +14 -6
  805. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +2 -1
  806. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +1 -1
  807. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +2 -23
  808. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +9 -9
  809. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +2 -2
  810. data/third_party/abseil-cpp/absl/random/random.h +6 -6
  811. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +1 -0
  812. data/third_party/abseil-cpp/absl/status/status.cc +19 -12
  813. data/third_party/abseil-cpp/absl/status/status.h +2 -2
  814. data/third_party/abseil-cpp/absl/strings/ascii.cc +5 -5
  815. data/third_party/abseil-cpp/absl/strings/charconv.cc +534 -96
  816. data/third_party/abseil-cpp/absl/strings/cord.cc +92 -40
  817. data/third_party/abseil-cpp/absl/strings/cord.h +71 -80
  818. data/third_party/abseil-cpp/absl/strings/cord_buffer.h +8 -5
  819. data/third_party/abseil-cpp/absl/strings/escaping.cc +73 -62
  820. data/third_party/abseil-cpp/absl/strings/escaping.h +24 -19
  821. data/third_party/abseil-cpp/absl/strings/internal/char_map.h +14 -12
  822. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +4 -4
  823. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +2 -2
  824. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +326 -70
  825. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +8 -4
  826. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +26 -14
  827. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +5 -5
  828. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc +9 -7
  829. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.h +5 -4
  830. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +7 -15
  831. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +3 -3
  832. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +8 -5
  833. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +7 -7
  834. data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +4 -4
  835. data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc +93 -0
  836. data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h +34 -0
  837. data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +12 -10
  838. data/third_party/abseil-cpp/absl/strings/internal/escaping.h +7 -9
  839. data/third_party/abseil-cpp/absl/strings/internal/has_absl_stringify.h +55 -0
  840. data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +9 -6
  841. data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +14 -7
  842. data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +35 -10
  843. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +113 -46
  844. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +126 -29
  845. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -2
  846. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +4 -3
  847. data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +49 -287
  848. data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +351 -0
  849. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +2 -1
  850. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +4 -2
  851. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +215 -181
  852. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +10 -209
  853. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +10 -101
  854. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +2 -1
  855. data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.cc +28 -0
  856. data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.h +57 -0
  857. data/third_party/abseil-cpp/absl/strings/numbers.cc +34 -31
  858. data/third_party/abseil-cpp/absl/strings/str_cat.cc +9 -6
  859. data/third_party/abseil-cpp/absl/strings/str_cat.h +50 -3
  860. data/third_party/abseil-cpp/absl/strings/str_format.h +71 -9
  861. data/third_party/abseil-cpp/absl/strings/string_view.cc +6 -6
  862. data/third_party/abseil-cpp/absl/strings/string_view.h +3 -10
  863. data/third_party/abseil-cpp/absl/strings/substitute.cc +8 -6
  864. data/third_party/abseil-cpp/absl/strings/substitute.h +46 -20
  865. data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +20 -17
  866. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +37 -31
  867. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +22 -8
  868. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +104 -55
  869. data/third_party/abseil-cpp/absl/synchronization/mutex.h +85 -46
  870. data/third_party/abseil-cpp/absl/synchronization/notification.cc +0 -1
  871. data/third_party/abseil-cpp/absl/synchronization/notification.h +0 -1
  872. data/third_party/abseil-cpp/absl/time/civil_time.cc +26 -0
  873. data/third_party/abseil-cpp/absl/time/civil_time.h +25 -0
  874. data/third_party/abseil-cpp/absl/time/clock.cc +17 -11
  875. data/third_party/abseil-cpp/absl/time/duration.cc +7 -7
  876. data/third_party/abseil-cpp/absl/time/format.cc +2 -1
  877. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +1 -1
  878. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +26 -5
  879. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +7 -6
  880. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +36 -35
  881. data/third_party/abseil-cpp/absl/time/time.cc +2 -2
  882. data/third_party/abseil-cpp/absl/time/time.h +253 -158
  883. data/third_party/abseil-cpp/absl/types/internal/span.h +30 -19
  884. data/third_party/abseil-cpp/absl/types/internal/variant.h +28 -40
  885. data/third_party/abseil-cpp/absl/types/span.h +29 -7
  886. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +1 -1
  887. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -2
  888. metadata +75 -10
  889. data/src/core/lib/event_engine/socket_notifier.h +0 -55
  890. data/src/core/lib/promise/for_each.h +0 -155
  891. data/src/core/lib/promise/map_pipe.h +0 -88
  892. data/src/core/lib/promise/try_concurrently.h +0 -342
@@ -92,27 +92,30 @@ class StackArray {
92
92
 
93
93
  // Calculates `10 * (*v) + carry` and stores the result in `*v` and returns
94
94
  // the carry.
95
+ // Requires: `0 <= carry <= 9`
95
96
  template <typename Int>
96
- inline Int MultiplyBy10WithCarry(Int *v, Int carry) {
97
+ inline char MultiplyBy10WithCarry(Int* v, char carry) {
97
98
  using BiggerInt = absl::conditional_t<sizeof(Int) == 4, uint64_t, uint128>;
98
- BiggerInt tmp = 10 * static_cast<BiggerInt>(*v) + carry;
99
+ BiggerInt tmp =
100
+ 10 * static_cast<BiggerInt>(*v) + static_cast<BiggerInt>(carry);
99
101
  *v = static_cast<Int>(tmp);
100
- return static_cast<Int>(tmp >> (sizeof(Int) * 8));
102
+ return static_cast<char>(tmp >> (sizeof(Int) * 8));
101
103
  }
102
104
 
103
105
  // Calculates `(2^64 * carry + *v) / 10`.
104
106
  // Stores the quotient in `*v` and returns the remainder.
105
107
  // Requires: `0 <= carry <= 9`
106
- inline uint64_t DivideBy10WithCarry(uint64_t *v, uint64_t carry) {
108
+ inline char DivideBy10WithCarry(uint64_t* v, char carry) {
107
109
  constexpr uint64_t divisor = 10;
108
110
  // 2^64 / divisor = chunk_quotient + chunk_remainder / divisor
109
111
  constexpr uint64_t chunk_quotient = (uint64_t{1} << 63) / (divisor / 2);
110
112
  constexpr uint64_t chunk_remainder = uint64_t{} - chunk_quotient * divisor;
111
113
 
114
+ const uint64_t carry_u64 = static_cast<uint64_t>(carry);
112
115
  const uint64_t mod = *v % divisor;
113
- const uint64_t next_carry = chunk_remainder * carry + mod;
114
- *v = *v / divisor + carry * chunk_quotient + next_carry / divisor;
115
- return next_carry % divisor;
116
+ const uint64_t next_carry = chunk_remainder * carry_u64 + mod;
117
+ *v = *v / divisor + carry_u64 * chunk_quotient + next_carry / divisor;
118
+ return static_cast<char>(next_carry % divisor);
116
119
  }
117
120
 
118
121
  using MaxFloatType =
@@ -125,11 +128,11 @@ using MaxFloatType =
125
128
  //
126
129
  // Requires `0 <= exp` and `exp <= numeric_limits<MaxFloatType>::max_exponent`.
127
130
  class BinaryToDecimal {
128
- static constexpr int ChunksNeeded(int exp) {
131
+ static constexpr size_t ChunksNeeded(int exp) {
129
132
  // We will left shift a uint128 by `exp` bits, so we need `128+exp` total
130
133
  // bits. Round up to 32.
131
134
  // See constructor for details about adding `10%` to the value.
132
- return (128 + exp + 31) / 32 * 11 / 10;
135
+ return static_cast<size_t>((128 + exp + 31) / 32 * 11 / 10);
133
136
  }
134
137
 
135
138
  public:
@@ -140,7 +143,7 @@ class BinaryToDecimal {
140
143
  assert(exp > 0);
141
144
  assert(exp <= std::numeric_limits<MaxFloatType>::max_exponent);
142
145
  static_assert(
143
- static_cast<int>(StackArray::kMaxCapacity) >=
146
+ StackArray::kMaxCapacity >=
144
147
  ChunksNeeded(std::numeric_limits<MaxFloatType>::max_exponent),
145
148
  "");
146
149
 
@@ -149,9 +152,9 @@ class BinaryToDecimal {
149
152
  [=](absl::Span<uint32_t> input) { f(BinaryToDecimal(input, v, exp)); });
150
153
  }
151
154
 
152
- int TotalDigits() const {
153
- return static_cast<int>((decimal_end_ - decimal_start_) * kDigitsPerChunk +
154
- CurrentDigits().size());
155
+ size_t TotalDigits() const {
156
+ return (decimal_end_ - decimal_start_) * kDigitsPerChunk +
157
+ CurrentDigits().size();
155
158
  }
156
159
 
157
160
  // See the current block of digits.
@@ -190,30 +193,31 @@ class BinaryToDecimal {
190
193
  // the decimal representation is around 7% less efficient in space than the
191
194
  // binary one. We allocate an extra 10% memory to account for this. See
192
195
  // ChunksNeeded for this calculation.
193
- int chunk_index = exp / 32;
196
+ size_t after_chunk_index = static_cast<size_t>(exp / 32 + 1);
194
197
  decimal_start_ = decimal_end_ = ChunksNeeded(exp);
195
198
  const int offset = exp % 32;
196
199
  // Left shift v by exp bits.
197
- data_[chunk_index] = static_cast<uint32_t>(v << offset);
200
+ data_[after_chunk_index - 1] = static_cast<uint32_t>(v << offset);
198
201
  for (v >>= (32 - offset); v; v >>= 32)
199
- data_[++chunk_index] = static_cast<uint32_t>(v);
202
+ data_[++after_chunk_index - 1] = static_cast<uint32_t>(v);
200
203
 
201
- while (chunk_index >= 0) {
204
+ while (after_chunk_index > 0) {
202
205
  // While we have more than one chunk available, go in steps of 1e9.
203
- // `data_[chunk_index]` holds the highest non-zero binary chunk, so keep
204
- // the variable updated.
206
+ // `data_[after_chunk_index - 1]` holds the highest non-zero binary chunk,
207
+ // so keep the variable updated.
205
208
  uint32_t carry = 0;
206
- for (int i = chunk_index; i >= 0; --i) {
207
- uint64_t tmp = uint64_t{data_[i]} + (uint64_t{carry} << 32);
208
- data_[i] = static_cast<uint32_t>(tmp / uint64_t{1000000000});
209
+ for (size_t i = after_chunk_index; i > 0; --i) {
210
+ uint64_t tmp = uint64_t{data_[i - 1]} + (uint64_t{carry} << 32);
211
+ data_[i - 1] = static_cast<uint32_t>(tmp / uint64_t{1000000000});
209
212
  carry = static_cast<uint32_t>(tmp % uint64_t{1000000000});
210
213
  }
211
214
 
212
215
  // If the highest chunk is now empty, remove it from view.
213
- if (data_[chunk_index] == 0) --chunk_index;
216
+ if (data_[after_chunk_index - 1] == 0)
217
+ --after_chunk_index;
214
218
 
215
219
  --decimal_start_;
216
- assert(decimal_start_ != chunk_index);
220
+ assert(decimal_start_ != after_chunk_index - 1);
217
221
  data_[decimal_start_] = carry;
218
222
  }
219
223
 
@@ -225,13 +229,13 @@ class BinaryToDecimal {
225
229
  }
226
230
 
227
231
  private:
228
- static constexpr int kDigitsPerChunk = 9;
232
+ static constexpr size_t kDigitsPerChunk = 9;
229
233
 
230
- int decimal_start_;
231
- int decimal_end_;
234
+ size_t decimal_start_;
235
+ size_t decimal_end_;
232
236
 
233
237
  char digits_[kDigitsPerChunk];
234
- int size_ = 0;
238
+ size_t size_ = 0;
235
239
 
236
240
  absl::Span<uint32_t> data_;
237
241
  };
@@ -251,25 +255,26 @@ class FractionalDigitGenerator {
251
255
  static_assert(StackArray::kMaxCapacity >=
252
256
  (Limits::digits + 128 - Limits::min_exponent + 31) / 32,
253
257
  "");
254
- StackArray::RunWithCapacity((Limits::digits + exp + 31) / 32,
255
- [=](absl::Span<uint32_t> input) {
256
- f(FractionalDigitGenerator(input, v, exp));
257
- });
258
+ StackArray::RunWithCapacity(
259
+ static_cast<size_t>((Limits::digits + exp + 31) / 32),
260
+ [=](absl::Span<uint32_t> input) {
261
+ f(FractionalDigitGenerator(input, v, exp));
262
+ });
258
263
  }
259
264
 
260
265
  // Returns true if there are any more non-zero digits left.
261
- bool HasMoreDigits() const { return next_digit_ != 0 || chunk_index_ >= 0; }
266
+ bool HasMoreDigits() const { return next_digit_ != 0 || after_chunk_index_; }
262
267
 
263
268
  // Returns true if the remainder digits are greater than 5000...
264
269
  bool IsGreaterThanHalf() const {
265
- return next_digit_ > 5 || (next_digit_ == 5 && chunk_index_ >= 0);
270
+ return next_digit_ > 5 || (next_digit_ == 5 && after_chunk_index_);
266
271
  }
267
272
  // Returns true if the remainder digits are exactly 5000...
268
- bool IsExactlyHalf() const { return next_digit_ == 5 && chunk_index_ < 0; }
273
+ bool IsExactlyHalf() const { return next_digit_ == 5 && !after_chunk_index_; }
269
274
 
270
275
  struct Digits {
271
- int digit_before_nine;
272
- int num_nines;
276
+ char digit_before_nine;
277
+ size_t num_nines;
273
278
  };
274
279
 
275
280
  // Get the next set of digits.
@@ -288,35 +293,37 @@ class FractionalDigitGenerator {
288
293
 
289
294
  private:
290
295
  // Return the next digit.
291
- int GetOneDigit() {
292
- if (chunk_index_ < 0) return 0;
296
+ char GetOneDigit() {
297
+ if (!after_chunk_index_)
298
+ return 0;
293
299
 
294
- uint32_t carry = 0;
295
- for (int i = chunk_index_; i >= 0; --i) {
296
- carry = MultiplyBy10WithCarry(&data_[i], carry);
300
+ char carry = 0;
301
+ for (size_t i = after_chunk_index_; i > 0; --i) {
302
+ carry = MultiplyBy10WithCarry(&data_[i - 1], carry);
297
303
  }
298
304
  // If the lowest chunk is now empty, remove it from view.
299
- if (data_[chunk_index_] == 0) --chunk_index_;
305
+ if (data_[after_chunk_index_ - 1] == 0)
306
+ --after_chunk_index_;
300
307
  return carry;
301
308
  }
302
309
 
303
310
  FractionalDigitGenerator(absl::Span<uint32_t> data, uint128 v, int exp)
304
- : chunk_index_(exp / 32), data_(data) {
311
+ : after_chunk_index_(static_cast<size_t>(exp / 32 + 1)), data_(data) {
305
312
  const int offset = exp % 32;
306
313
  // Right shift `v` by `exp` bits.
307
- data_[chunk_index_] = static_cast<uint32_t>(v << (32 - offset));
314
+ data_[after_chunk_index_ - 1] = static_cast<uint32_t>(v << (32 - offset));
308
315
  v >>= offset;
309
316
  // Make sure we don't overflow the data. We already calculated that
310
317
  // non-zero bits fit, so we might not have space for leading zero bits.
311
- for (int pos = chunk_index_; v; v >>= 32)
318
+ for (size_t pos = after_chunk_index_ - 1; v; v >>= 32)
312
319
  data_[--pos] = static_cast<uint32_t>(v);
313
320
 
314
321
  // Fill next_digit_, as GetDigits expects it to be populated always.
315
322
  next_digit_ = GetOneDigit();
316
323
  }
317
324
 
318
- int next_digit_;
319
- int chunk_index_;
325
+ char next_digit_;
326
+ size_t after_chunk_index_;
320
327
  absl::Span<uint32_t> data_;
321
328
  };
322
329
 
@@ -362,7 +369,7 @@ char *PrintIntegralDigitsFromRightFast(uint128 v, char *p) {
362
369
  auto low = static_cast<uint64_t>(v);
363
370
 
364
371
  while (high != 0) {
365
- uint64_t carry = DivideBy10WithCarry(&high, 0);
372
+ char carry = DivideBy10WithCarry(&high, 0);
366
373
  carry = DivideBy10WithCarry(&low, carry);
367
374
  *--p = carry + '0';
368
375
  }
@@ -373,13 +380,15 @@ char *PrintIntegralDigitsFromRightFast(uint128 v, char *p) {
373
380
  // shifting.
374
381
  // Performs rounding if necessary to fit within `precision`.
375
382
  // Returns the pointer to one after the last character written.
376
- char *PrintFractionalDigitsFast(uint64_t v, char *start, int exp,
377
- int precision) {
383
+ char* PrintFractionalDigitsFast(uint64_t v,
384
+ char* start,
385
+ int exp,
386
+ size_t precision) {
378
387
  char *p = start;
379
388
  v <<= (64 - exp);
380
389
  while (precision > 0) {
381
390
  if (!v) return p;
382
- *p++ = MultiplyBy10WithCarry(&v, uint64_t{0}) + '0';
391
+ *p++ = MultiplyBy10WithCarry(&v, 0) + '0';
383
392
  --precision;
384
393
  }
385
394
 
@@ -393,8 +402,6 @@ char *PrintFractionalDigitsFast(uint64_t v, char *start, int exp,
393
402
  RoundToEven(p - 1);
394
403
  }
395
404
 
396
- assert(precision == 0);
397
- // Precision can only be zero here.
398
405
  return p;
399
406
  }
400
407
 
@@ -402,8 +409,10 @@ char *PrintFractionalDigitsFast(uint64_t v, char *start, int exp,
402
409
  // after shifting.
403
410
  // Performs rounding if necessary to fit within `precision`.
404
411
  // Returns the pointer to one after the last character written.
405
- char *PrintFractionalDigitsFast(uint128 v, char *start, int exp,
406
- int precision) {
412
+ char* PrintFractionalDigitsFast(uint128 v,
413
+ char* start,
414
+ int exp,
415
+ size_t precision) {
407
416
  char *p = start;
408
417
  v <<= (128 - exp);
409
418
  auto high = static_cast<uint64_t>(v >> 64);
@@ -412,7 +421,7 @@ char *PrintFractionalDigitsFast(uint128 v, char *start, int exp,
412
421
  // While we have digits to print and `low` is not empty, do the long
413
422
  // multiplication.
414
423
  while (precision > 0 && low != 0) {
415
- uint64_t carry = MultiplyBy10WithCarry(&low, uint64_t{0});
424
+ char carry = MultiplyBy10WithCarry(&low, 0);
416
425
  carry = MultiplyBy10WithCarry(&high, carry);
417
426
 
418
427
  *p++ = carry + '0';
@@ -424,7 +433,7 @@ char *PrintFractionalDigitsFast(uint128 v, char *start, int exp,
424
433
  // above.
425
434
  while (precision > 0) {
426
435
  if (!high) return p;
427
- *p++ = MultiplyBy10WithCarry(&high, uint64_t{0}) + '0';
436
+ *p++ = MultiplyBy10WithCarry(&high, 0) + '0';
428
437
  --precision;
429
438
  }
430
439
 
@@ -438,14 +447,12 @@ char *PrintFractionalDigitsFast(uint128 v, char *start, int exp,
438
447
  RoundToEven(p - 1);
439
448
  }
440
449
 
441
- assert(precision == 0);
442
- // Precision can only be zero here.
443
450
  return p;
444
451
  }
445
452
 
446
453
  struct FormatState {
447
454
  char sign_char;
448
- int precision;
455
+ size_t precision;
449
456
  const FormatConversionSpecImpl &conv;
450
457
  FormatSinkImpl *sink;
451
458
 
@@ -455,9 +462,9 @@ struct FormatState {
455
462
  };
456
463
 
457
464
  struct Padding {
458
- int left_spaces;
459
- int zeros;
460
- int right_spaces;
465
+ size_t left_spaces;
466
+ size_t zeros;
467
+ size_t right_spaces;
461
468
  };
462
469
 
463
470
  Padding ExtraWidthToPadding(size_t total_size, const FormatState &state) {
@@ -465,7 +472,7 @@ Padding ExtraWidthToPadding(size_t total_size, const FormatState &state) {
465
472
  static_cast<size_t>(state.conv.width()) <= total_size) {
466
473
  return {0, 0, 0};
467
474
  }
468
- int missing_chars = state.conv.width() - total_size;
475
+ size_t missing_chars = static_cast<size_t>(state.conv.width()) - total_size;
469
476
  if (state.conv.has_left_flag()) {
470
477
  return {0, 0, missing_chars};
471
478
  } else if (state.conv.has_zero_flag()) {
@@ -475,8 +482,10 @@ Padding ExtraWidthToPadding(size_t total_size, const FormatState &state) {
475
482
  }
476
483
  }
477
484
 
478
- void FinalPrint(const FormatState &state, absl::string_view data,
479
- int padding_offset, int trailing_zeros,
485
+ void FinalPrint(const FormatState& state,
486
+ absl::string_view data,
487
+ size_t padding_offset,
488
+ size_t trailing_zeros,
480
489
  absl::string_view data_postfix) {
481
490
  if (state.conv.width() < 0) {
482
491
  // No width specified. Fast-path.
@@ -487,10 +496,10 @@ void FinalPrint(const FormatState &state, absl::string_view data,
487
496
  return;
488
497
  }
489
498
 
490
- auto padding = ExtraWidthToPadding((state.sign_char != '\0' ? 1 : 0) +
491
- data.size() + data_postfix.size() +
492
- static_cast<size_t>(trailing_zeros),
493
- state);
499
+ auto padding =
500
+ ExtraWidthToPadding((state.sign_char != '\0' ? 1 : 0) + data.size() +
501
+ data_postfix.size() + trailing_zeros,
502
+ state);
494
503
 
495
504
  state.sink->Append(padding.left_spaces, ' ');
496
505
  if (state.sign_char != '\0') state.sink->Append(1, state.sign_char);
@@ -547,15 +556,16 @@ void FormatFFast(Int v, int exp, const FormatState &state) {
547
556
  if (integral_digits_start[-1] != '0') --integral_digits_start;
548
557
  }
549
558
 
550
- size_t size = fractional_digits_end - integral_digits_start;
559
+ size_t size =
560
+ static_cast<size_t>(fractional_digits_end - integral_digits_start);
551
561
 
552
562
  // In `alt` mode (flag #) we keep the `.` even if there are no fractional
553
563
  // digits. In non-alt mode, we strip it.
554
564
  if (!state.ShouldPrintDot()) --size;
555
565
  FinalPrint(state, absl::string_view(integral_digits_start, size),
556
566
  /*padding_offset=*/0,
557
- static_cast<int>(state.precision - (fractional_digits_end -
558
- fractional_digits_start)),
567
+ state.precision - static_cast<size_t>(fractional_digits_end -
568
+ fractional_digits_start),
559
569
  /*data_postfix=*/"");
560
570
  }
561
571
 
@@ -567,21 +577,22 @@ void FormatFFast(Int v, int exp, const FormatState &state) {
567
577
  void FormatFPositiveExpSlow(uint128 v, int exp, const FormatState &state) {
568
578
  BinaryToDecimal::RunConversion(v, exp, [&](BinaryToDecimal btd) {
569
579
  const size_t total_digits =
570
- btd.TotalDigits() +
571
- (state.ShouldPrintDot() ? static_cast<size_t>(state.precision) + 1 : 0);
580
+ btd.TotalDigits() + (state.ShouldPrintDot() ? state.precision + 1 : 0);
572
581
 
573
582
  const auto padding = ExtraWidthToPadding(
574
583
  total_digits + (state.sign_char != '\0' ? 1 : 0), state);
575
584
 
576
585
  state.sink->Append(padding.left_spaces, ' ');
577
- if (state.sign_char != '\0') state.sink->Append(1, state.sign_char);
586
+ if (state.sign_char != '\0')
587
+ state.sink->Append(1, state.sign_char);
578
588
  state.sink->Append(padding.zeros, '0');
579
589
 
580
590
  do {
581
591
  state.sink->Append(btd.CurrentDigits());
582
592
  } while (btd.AdvanceDigits());
583
593
 
584
- if (state.ShouldPrintDot()) state.sink->Append(1, '.');
594
+ if (state.ShouldPrintDot())
595
+ state.sink->Append(1, '.');
585
596
  state.sink->Append(state.precision, '0');
586
597
  state.sink->Append(padding.right_spaces, ' ');
587
598
  });
@@ -594,8 +605,7 @@ void FormatFPositiveExpSlow(uint128 v, int exp, const FormatState &state) {
594
605
  // digits.
595
606
  void FormatFNegativeExpSlow(uint128 v, int exp, const FormatState &state) {
596
607
  const size_t total_digits =
597
- /* 0 */ 1 +
598
- (state.ShouldPrintDot() ? static_cast<size_t>(state.precision) + 1 : 0);
608
+ /* 0 */ 1 + (state.ShouldPrintDot() ? state.precision + 1 : 0);
599
609
  auto padding =
600
610
  ExtraWidthToPadding(total_digits + (state.sign_char ? 1 : 0), state);
601
611
  padding.zeros += 1;
@@ -606,7 +616,7 @@ void FormatFNegativeExpSlow(uint128 v, int exp, const FormatState &state) {
606
616
  if (state.ShouldPrintDot()) state.sink->Append(1, '.');
607
617
 
608
618
  // Print digits
609
- int digits_to_go = state.precision;
619
+ size_t digits_to_go = state.precision;
610
620
 
611
621
  FractionalDigitGenerator::RunConversion(
612
622
  v, exp, [&](FractionalDigitGenerator digit_gen) {
@@ -666,7 +676,8 @@ void FormatFNegativeExpSlow(uint128 v, int exp, const FormatState &state) {
666
676
  template <typename Int>
667
677
  void FormatF(Int mantissa, int exp, const FormatState &state) {
668
678
  if (exp >= 0) {
669
- const int total_bits = sizeof(Int) * 8 - LeadingZeros(mantissa) + exp;
679
+ const int total_bits =
680
+ static_cast<int>(sizeof(Int) * 8) - LeadingZeros(mantissa) + exp;
670
681
 
671
682
  // Fallback to the slow stack-based approach if we can't do it in a 64 or
672
683
  // 128 bit state.
@@ -686,9 +697,9 @@ void FormatF(Int mantissa, int exp, const FormatState &state) {
686
697
  // Grab the group of four bits (nibble) from `n`. E.g., nibble 1 corresponds to
687
698
  // bits 4-7.
688
699
  template <typename Int>
689
- uint8_t GetNibble(Int n, int nibble_index) {
700
+ uint8_t GetNibble(Int n, size_t nibble_index) {
690
701
  constexpr Int mask_low_nibble = Int{0xf};
691
- int shift = nibble_index * 4;
702
+ int shift = static_cast<int>(nibble_index * 4);
692
703
  n &= mask_low_nibble << shift;
693
704
  return static_cast<uint8_t>((n >> shift) & 0xf);
694
705
  }
@@ -696,9 +707,9 @@ uint8_t GetNibble(Int n, int nibble_index) {
696
707
  // Add one to the given nibble, applying carry to higher nibbles. Returns true
697
708
  // if overflow, false otherwise.
698
709
  template <typename Int>
699
- bool IncrementNibble(int nibble_index, Int *n) {
700
- constexpr int kShift = sizeof(Int) * 8 - 1;
701
- constexpr int kNumNibbles = sizeof(Int) * 8 / 4;
710
+ bool IncrementNibble(size_t nibble_index, Int* n) {
711
+ constexpr size_t kShift = sizeof(Int) * 8 - 1;
712
+ constexpr size_t kNumNibbles = sizeof(Int) * 8 / 4;
702
713
  Int before = *n >> kShift;
703
714
  // Here we essentially want to take the number 1 and move it into the requsted
704
715
  // nibble, then add it to *n to effectively increment the nibble. However,
@@ -706,28 +717,32 @@ bool IncrementNibble(int nibble_index, Int *n) {
706
717
  // i.e., if the nibble_index is out of range. So therefore we check for this
707
718
  // and if we are out of range we just add 0 which leaves *n unchanged, which
708
719
  // seems like the reasonable thing to do in that case.
709
- *n += ((nibble_index >= kNumNibbles) ? 0 : (Int{1} << (nibble_index * 4)));
720
+ *n += ((nibble_index >= kNumNibbles)
721
+ ? 0
722
+ : (Int{1} << static_cast<int>(nibble_index * 4)));
710
723
  Int after = *n >> kShift;
711
724
  return (before && !after) || (nibble_index >= kNumNibbles);
712
725
  }
713
726
 
714
727
  // Return a mask with 1's in the given nibble and all lower nibbles.
715
728
  template <typename Int>
716
- Int MaskUpToNibbleInclusive(int nibble_index) {
717
- constexpr int kNumNibbles = sizeof(Int) * 8 / 4;
729
+ Int MaskUpToNibbleInclusive(size_t nibble_index) {
730
+ constexpr size_t kNumNibbles = sizeof(Int) * 8 / 4;
718
731
  static const Int ones = ~Int{0};
719
- return ones >> std::max(0, 4 * (kNumNibbles - nibble_index - 1));
732
+ ++nibble_index;
733
+ return ones >> static_cast<int>(
734
+ 4 * (std::max(kNumNibbles, nibble_index) - nibble_index));
720
735
  }
721
736
 
722
737
  // Return a mask with 1's below the given nibble.
723
738
  template <typename Int>
724
- Int MaskUpToNibbleExclusive(int nibble_index) {
725
- return nibble_index <= 0 ? 0 : MaskUpToNibbleInclusive<Int>(nibble_index - 1);
739
+ Int MaskUpToNibbleExclusive(size_t nibble_index) {
740
+ return nibble_index == 0 ? 0 : MaskUpToNibbleInclusive<Int>(nibble_index - 1);
726
741
  }
727
742
 
728
743
  template <typename Int>
729
- Int MoveToNibble(uint8_t nibble, int nibble_index) {
730
- return Int{nibble} << (4 * nibble_index);
744
+ Int MoveToNibble(uint8_t nibble, size_t nibble_index) {
745
+ return Int{nibble} << static_cast<int>(4 * nibble_index);
731
746
  }
732
747
 
733
748
  // Given mantissa size, find optimal # of mantissa bits to put in initial digit.
@@ -744,10 +759,10 @@ Int MoveToNibble(uint8_t nibble, int nibble_index) {
744
759
  // a multiple of four. Once again, the goal is to have all fractional digits
745
760
  // represent real precision.
746
761
  template <typename Float>
747
- constexpr int HexFloatLeadingDigitSizeInBits() {
762
+ constexpr size_t HexFloatLeadingDigitSizeInBits() {
748
763
  return std::numeric_limits<Float>::digits % 4 > 0
749
- ? std::numeric_limits<Float>::digits % 4
750
- : 4;
764
+ ? static_cast<size_t>(std::numeric_limits<Float>::digits % 4)
765
+ : size_t{4};
751
766
  }
752
767
 
753
768
  // This function captures the rounding behavior of glibc for hex float
@@ -757,16 +772,17 @@ constexpr int HexFloatLeadingDigitSizeInBits() {
757
772
  // point that is not followed by 800000..., it disregards the parity and rounds
758
773
  // up if > 8 and rounds down if < 8.
759
774
  template <typename Int>
760
- bool HexFloatNeedsRoundUp(Int mantissa, int final_nibble_displayed,
775
+ bool HexFloatNeedsRoundUp(Int mantissa,
776
+ size_t final_nibble_displayed,
761
777
  uint8_t leading) {
762
778
  // If the last nibble (hex digit) to be displayed is the lowest on in the
763
779
  // mantissa then that means that we don't have any further nibbles to inform
764
780
  // rounding, so don't round.
765
- if (final_nibble_displayed <= 0) {
781
+ if (final_nibble_displayed == 0) {
766
782
  return false;
767
783
  }
768
- int rounding_nibble_idx = final_nibble_displayed - 1;
769
- constexpr int kTotalNibbles = sizeof(Int) * 8 / 4;
784
+ size_t rounding_nibble_idx = final_nibble_displayed - 1;
785
+ constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4;
770
786
  assert(final_nibble_displayed <= kTotalNibbles);
771
787
  Int mantissa_up_to_rounding_nibble_inclusive =
772
788
  mantissa & MaskUpToNibbleInclusive<Int>(rounding_nibble_idx);
@@ -793,7 +809,7 @@ struct HexFloatTypeParams {
793
809
  }
794
810
 
795
811
  int min_exponent;
796
- int leading_digit_size_bits;
812
+ size_t leading_digit_size_bits;
797
813
  };
798
814
 
799
815
  // Hex Float Rounding. First check if we need to round; if so, then we do that
@@ -803,10 +819,12 @@ struct HexFloatTypeParams {
803
819
  template <typename Int>
804
820
  void FormatARound(bool precision_specified, const FormatState &state,
805
821
  uint8_t *leading, Int *mantissa, int *exp) {
806
- constexpr int kTotalNibbles = sizeof(Int) * 8 / 4;
822
+ constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4;
807
823
  // Index of the last nibble that we could display given precision.
808
- int final_nibble_displayed =
809
- precision_specified ? std::max(0, (kTotalNibbles - state.precision)) : 0;
824
+ size_t final_nibble_displayed =
825
+ precision_specified
826
+ ? (std::max(kTotalNibbles, state.precision) - state.precision)
827
+ : 0;
810
828
  if (HexFloatNeedsRoundUp(*mantissa, final_nibble_displayed, *leading)) {
811
829
  // Need to round up.
812
830
  bool overflow = IncrementNibble(final_nibble_displayed, mantissa);
@@ -830,9 +848,9 @@ void FormatARound(bool precision_specified, const FormatState &state,
830
848
  template <typename Int>
831
849
  void FormatANormalize(const HexFloatTypeParams float_traits, uint8_t *leading,
832
850
  Int *mantissa, int *exp) {
833
- constexpr int kIntBits = sizeof(Int) * 8;
851
+ constexpr size_t kIntBits = sizeof(Int) * 8;
834
852
  static const Int kHighIntBit = Int{1} << (kIntBits - 1);
835
- const int kLeadDigitBitsCount = float_traits.leading_digit_size_bits;
853
+ const size_t kLeadDigitBitsCount = float_traits.leading_digit_size_bits;
836
854
  // Normalize mantissa so that highest bit set is in MSB position, unless we
837
855
  // get interrupted by the exponent threshold.
838
856
  while (*mantissa && !(*mantissa & kHighIntBit)) {
@@ -846,18 +864,18 @@ void FormatANormalize(const HexFloatTypeParams float_traits, uint8_t *leading,
846
864
  }
847
865
  // Extract bits for leading digit then shift them away leaving the
848
866
  // fractional part.
849
- *leading =
850
- static_cast<uint8_t>(*mantissa >> (kIntBits - kLeadDigitBitsCount));
851
- *exp -= (*mantissa != 0) ? kLeadDigitBitsCount : *exp;
852
- *mantissa <<= kLeadDigitBitsCount;
867
+ *leading = static_cast<uint8_t>(
868
+ *mantissa >> static_cast<int>(kIntBits - kLeadDigitBitsCount));
869
+ *exp -= (*mantissa != 0) ? static_cast<int>(kLeadDigitBitsCount) : *exp;
870
+ *mantissa <<= static_cast<int>(kLeadDigitBitsCount);
853
871
  }
854
872
 
855
873
  template <typename Int>
856
874
  void FormatA(const HexFloatTypeParams float_traits, Int mantissa, int exp,
857
875
  bool uppercase, const FormatState &state) {
858
876
  // Int properties.
859
- constexpr int kIntBits = sizeof(Int) * 8;
860
- constexpr int kTotalNibbles = sizeof(Int) * 8 / 4;
877
+ constexpr size_t kIntBits = sizeof(Int) * 8;
878
+ constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4;
861
879
  // Did the user specify a precision explicitly?
862
880
  const bool precision_specified = state.conv.precision() >= 0;
863
881
 
@@ -903,16 +921,19 @@ void FormatA(const HexFloatTypeParams float_traits, Int mantissa, int exp,
903
921
  }
904
922
 
905
923
  // ============ Fractional Digits ============
906
- int digits_emitted = 0;
924
+ size_t digits_emitted = 0;
907
925
  while (mantissa > 0) {
908
926
  *digits_iter++ = digits[GetNibble(mantissa, kTotalNibbles - 1)];
909
927
  mantissa <<= 4;
910
928
  ++digits_emitted;
911
929
  }
912
- int trailing_zeros =
913
- precision_specified ? state.precision - digits_emitted : 0;
914
- assert(trailing_zeros >= 0);
915
- auto digits_result = string_view(digits_buffer, digits_iter - digits_buffer);
930
+ size_t trailing_zeros = 0;
931
+ if (precision_specified) {
932
+ assert(state.precision >= digits_emitted);
933
+ trailing_zeros = state.precision - digits_emitted;
934
+ }
935
+ auto digits_result = string_view(
936
+ digits_buffer, static_cast<size_t>(digits_iter - digits_buffer));
916
937
 
917
938
  // =============== Exponent ==================
918
939
  constexpr size_t kBufSizeForExpDecRepr =
@@ -925,11 +946,11 @@ void FormatA(const HexFloatTypeParams float_traits, Int mantissa, int exp,
925
946
  numbers_internal::FastIntToBuffer(exp < 0 ? -exp : exp, exp_buffer + 2);
926
947
 
927
948
  // ============ Assemble Result ==============
928
- FinalPrint(state, //
929
- digits_result, // 0xN.NNN...
930
- 2, // offset in `data` to start padding if needed.
931
- trailing_zeros, // num remaining mantissa padding zeros
932
- exp_buffer); // exponent
949
+ FinalPrint(state,
950
+ digits_result, // 0xN.NNN...
951
+ 2, // offset of any padding
952
+ static_cast<size_t>(trailing_zeros), // remaining mantissa padding
953
+ exp_buffer); // exponent
933
954
  }
934
955
 
935
956
  char *CopyStringTo(absl::string_view v, char *out) {
@@ -961,10 +982,10 @@ bool FallbackToSnprintf(const Float v, const FormatConversionSpecImpl &conv,
961
982
  int n = snprintf(&space[0], space.size(), fmt, w, p, v);
962
983
  if (n < 0) return false;
963
984
  if (static_cast<size_t>(n) < space.size()) {
964
- result = absl::string_view(space.data(), n);
985
+ result = absl::string_view(space.data(), static_cast<size_t>(n));
965
986
  break;
966
987
  }
967
- space.resize(n + 1);
988
+ space.resize(static_cast<size_t>(n) + 1);
968
989
  }
969
990
  sink->Append(result);
970
991
  return true;
@@ -972,13 +993,13 @@ bool FallbackToSnprintf(const Float v, const FormatConversionSpecImpl &conv,
972
993
 
973
994
  // 128-bits in decimal: ceil(128*log(2)/log(10))
974
995
  // or std::numeric_limits<__uint128_t>::digits10
975
- constexpr int kMaxFixedPrecision = 39;
996
+ constexpr size_t kMaxFixedPrecision = 39;
976
997
 
977
- constexpr int kBufferLength = /*sign*/ 1 +
978
- /*integer*/ kMaxFixedPrecision +
979
- /*point*/ 1 +
980
- /*fraction*/ kMaxFixedPrecision +
981
- /*exponent e+123*/ 5;
998
+ constexpr size_t kBufferLength = /*sign*/ 1 +
999
+ /*integer*/ kMaxFixedPrecision +
1000
+ /*point*/ 1 +
1001
+ /*fraction*/ kMaxFixedPrecision +
1002
+ /*exponent e+123*/ 5;
982
1003
 
983
1004
  struct Buffer {
984
1005
  void push_front(char c) {
@@ -1001,7 +1022,7 @@ struct Buffer {
1001
1022
 
1002
1023
  char last_digit() const { return end[-1] == '.' ? end[-2] : end[-1]; }
1003
1024
 
1004
- int size() const { return static_cast<int>(end - begin); }
1025
+ size_t size() const { return static_cast<size_t>(end - begin); }
1005
1026
 
1006
1027
  char data[kBufferLength];
1007
1028
  char *begin;
@@ -1030,8 +1051,9 @@ bool ConvertNonNumericFloats(char sign_char, Float v,
1030
1051
  return false;
1031
1052
  }
1032
1053
 
1033
- return sink->PutPaddedString(string_view(text, ptr - text), conv.width(), -1,
1034
- conv.has_left_flag());
1054
+ return sink->PutPaddedString(
1055
+ string_view(text, static_cast<size_t>(ptr - text)), conv.width(), -1,
1056
+ conv.has_left_flag());
1035
1057
  }
1036
1058
 
1037
1059
  // Round up the last digit of the value.
@@ -1068,12 +1090,12 @@ void PrintExponent(int exp, char e, Buffer *out) {
1068
1090
  }
1069
1091
  // Exponent digits.
1070
1092
  if (exp > 99) {
1071
- out->push_back(exp / 100 + '0');
1072
- out->push_back(exp / 10 % 10 + '0');
1073
- out->push_back(exp % 10 + '0');
1093
+ out->push_back(static_cast<char>(exp / 100 + '0'));
1094
+ out->push_back(static_cast<char>(exp / 10 % 10 + '0'));
1095
+ out->push_back(static_cast<char>(exp % 10 + '0'));
1074
1096
  } else {
1075
- out->push_back(exp / 10 + '0');
1076
- out->push_back(exp % 10 + '0');
1097
+ out->push_back(static_cast<char>(exp / 10 + '0'));
1098
+ out->push_back(static_cast<char>(exp % 10 + '0'));
1077
1099
  }
1078
1100
  }
1079
1101
 
@@ -1115,8 +1137,8 @@ Decomposed<Float> Decompose(Float v) {
1115
1137
  // In Fixed mode, we add a '.' at the end.
1116
1138
  // In Precision mode, we add a '.' after the first digit.
1117
1139
  template <FormatStyle mode, typename Int>
1118
- int PrintIntegralDigits(Int digits, Buffer *out) {
1119
- int printed = 0;
1140
+ size_t PrintIntegralDigits(Int digits, Buffer* out) {
1141
+ size_t printed = 0;
1120
1142
  if (digits) {
1121
1143
  for (; digits; digits /= 10) out->push_front(digits % 10 + '0');
1122
1144
  printed = out->size();
@@ -1135,10 +1157,10 @@ int PrintIntegralDigits(Int digits, Buffer *out) {
1135
1157
  }
1136
1158
 
1137
1159
  // Back out 'extra_digits' digits and round up if necessary.
1138
- bool RemoveExtraPrecision(int extra_digits, bool has_leftover_value,
1139
- Buffer *out, int *exp_out) {
1140
- if (extra_digits <= 0) return false;
1141
-
1160
+ void RemoveExtraPrecision(size_t extra_digits,
1161
+ bool has_leftover_value,
1162
+ Buffer* out,
1163
+ int* exp_out) {
1142
1164
  // Back out the extra digits
1143
1165
  out->end -= extra_digits;
1144
1166
 
@@ -1158,15 +1180,17 @@ bool RemoveExtraPrecision(int extra_digits, bool has_leftover_value,
1158
1180
  if (needs_to_round_up) {
1159
1181
  RoundUp<FormatStyle::Precision>(out, exp_out);
1160
1182
  }
1161
- return true;
1162
1183
  }
1163
1184
 
1164
1185
  // Print the value into the buffer.
1165
1186
  // This will not include the exponent, which will be returned in 'exp_out' for
1166
1187
  // Precision mode.
1167
1188
  template <typename Int, typename Float, FormatStyle mode>
1168
- bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out,
1169
- int *exp_out) {
1189
+ bool FloatToBufferImpl(Int int_mantissa,
1190
+ int exp,
1191
+ size_t precision,
1192
+ Buffer* out,
1193
+ int* exp_out) {
1170
1194
  assert((CanFitMantissa<Float, Int>()));
1171
1195
 
1172
1196
  const int int_bits = std::numeric_limits<Int>::digits;
@@ -1182,14 +1206,16 @@ bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out,
1182
1206
  // The value will overflow the Int
1183
1207
  return false;
1184
1208
  }
1185
- int digits_printed = PrintIntegralDigits<mode>(int_mantissa << exp, out);
1186
- int digits_to_zero_pad = precision;
1209
+ size_t digits_printed = PrintIntegralDigits<mode>(int_mantissa << exp, out);
1210
+ size_t digits_to_zero_pad = precision;
1187
1211
  if (mode == FormatStyle::Precision) {
1188
- *exp_out = digits_printed - 1;
1189
- digits_to_zero_pad -= digits_printed - 1;
1190
- if (RemoveExtraPrecision(-digits_to_zero_pad, false, out, exp_out)) {
1212
+ *exp_out = static_cast<int>(digits_printed - 1);
1213
+ if (digits_to_zero_pad < digits_printed - 1) {
1214
+ RemoveExtraPrecision(digits_printed - 1 - digits_to_zero_pad, false,
1215
+ out, exp_out);
1191
1216
  return true;
1192
1217
  }
1218
+ digits_to_zero_pad -= digits_printed - 1;
1193
1219
  }
1194
1220
  for (; digits_to_zero_pad-- > 0;) out->push_back('0');
1195
1221
  return true;
@@ -1203,10 +1229,10 @@ bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out,
1203
1229
  const Int mask = (Int{1} << exp) - 1;
1204
1230
 
1205
1231
  // Print the integral part first.
1206
- int digits_printed = PrintIntegralDigits<mode>(int_mantissa >> exp, out);
1232
+ size_t digits_printed = PrintIntegralDigits<mode>(int_mantissa >> exp, out);
1207
1233
  int_mantissa &= mask;
1208
1234
 
1209
- int fractional_count = precision;
1235
+ size_t fractional_count = precision;
1210
1236
  if (mode == FormatStyle::Precision) {
1211
1237
  if (digits_printed == 0) {
1212
1238
  // Find the first non-zero digit, when in Precision mode.
@@ -1222,20 +1248,21 @@ bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out,
1222
1248
  int_mantissa &= mask;
1223
1249
  } else {
1224
1250
  // We already have a digit, and a '.'
1225
- *exp_out = digits_printed - 1;
1226
- fractional_count -= *exp_out;
1227
- if (RemoveExtraPrecision(-fractional_count, int_mantissa != 0, out,
1228
- exp_out)) {
1251
+ *exp_out = static_cast<int>(digits_printed - 1);
1252
+ if (fractional_count < digits_printed - 1) {
1229
1253
  // If we had enough digits, return right away.
1230
1254
  // The code below will try to round again otherwise.
1255
+ RemoveExtraPrecision(digits_printed - 1 - fractional_count,
1256
+ int_mantissa != 0, out, exp_out);
1231
1257
  return true;
1232
1258
  }
1259
+ fractional_count -= digits_printed - 1;
1233
1260
  }
1234
1261
  }
1235
1262
 
1236
1263
  auto get_next_digit = [&] {
1237
1264
  int_mantissa *= 10;
1238
- int digit = static_cast<int>(int_mantissa >> exp);
1265
+ char digit = static_cast<char>(int_mantissa >> exp);
1239
1266
  int_mantissa &= mask;
1240
1267
  return digit;
1241
1268
  };
@@ -1245,7 +1272,7 @@ bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out,
1245
1272
  out->push_back(get_next_digit() + '0');
1246
1273
  }
1247
1274
 
1248
- int next_digit = get_next_digit();
1275
+ char next_digit = get_next_digit();
1249
1276
  if (next_digit > 5 ||
1250
1277
  (next_digit == 5 && (int_mantissa || out->last_digit() % 2 == 1))) {
1251
1278
  RoundUp<mode>(out, exp_out);
@@ -1255,24 +1282,25 @@ bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out,
1255
1282
  }
1256
1283
 
1257
1284
  template <FormatStyle mode, typename Float>
1258
- bool FloatToBuffer(Decomposed<Float> decomposed, int precision, Buffer *out,
1259
- int *exp) {
1285
+ bool FloatToBuffer(Decomposed<Float> decomposed,
1286
+ size_t precision,
1287
+ Buffer* out,
1288
+ int* exp) {
1260
1289
  if (precision > kMaxFixedPrecision) return false;
1261
1290
 
1262
1291
  // Try with uint64_t.
1263
1292
  if (CanFitMantissa<Float, std::uint64_t>() &&
1264
1293
  FloatToBufferImpl<std::uint64_t, Float, mode>(
1265
- static_cast<std::uint64_t>(decomposed.mantissa),
1266
- static_cast<std::uint64_t>(decomposed.exponent), precision, out, exp))
1294
+ static_cast<std::uint64_t>(decomposed.mantissa), decomposed.exponent,
1295
+ precision, out, exp))
1267
1296
  return true;
1268
1297
 
1269
1298
  #if defined(ABSL_HAVE_INTRINSIC_INT128)
1270
1299
  // If that is not enough, try with __uint128_t.
1271
1300
  return CanFitMantissa<Float, __uint128_t>() &&
1272
1301
  FloatToBufferImpl<__uint128_t, Float, mode>(
1273
- static_cast<__uint128_t>(decomposed.mantissa),
1274
- static_cast<__uint128_t>(decomposed.exponent), precision, out,
1275
- exp);
1302
+ static_cast<__uint128_t>(decomposed.mantissa), decomposed.exponent,
1303
+ precision, out, exp);
1276
1304
  #endif
1277
1305
  return false;
1278
1306
  }
@@ -1280,12 +1308,15 @@ bool FloatToBuffer(Decomposed<Float> decomposed, int precision, Buffer *out,
1280
1308
  void WriteBufferToSink(char sign_char, absl::string_view str,
1281
1309
  const FormatConversionSpecImpl &conv,
1282
1310
  FormatSinkImpl *sink) {
1283
- int left_spaces = 0, zeros = 0, right_spaces = 0;
1284
- int missing_chars =
1285
- conv.width() >= 0 ? std::max(conv.width() - static_cast<int>(str.size()) -
1286
- static_cast<int>(sign_char != 0),
1287
- 0)
1288
- : 0;
1311
+ size_t left_spaces = 0, zeros = 0, right_spaces = 0;
1312
+ size_t missing_chars = 0;
1313
+ if (conv.width() >= 0) {
1314
+ const size_t conv_width_size_t = static_cast<size_t>(conv.width());
1315
+ const size_t existing_chars =
1316
+ str.size() + static_cast<size_t>(sign_char != 0);
1317
+ if (conv_width_size_t > existing_chars)
1318
+ missing_chars = conv_width_size_t - existing_chars;
1319
+ }
1289
1320
  if (conv.has_left_flag()) {
1290
1321
  right_spaces = missing_chars;
1291
1322
  } else if (conv.has_zero_flag()) {
@@ -1321,7 +1352,8 @@ bool FloatToSink(const Float v, const FormatConversionSpecImpl &conv,
1321
1352
  return true;
1322
1353
  }
1323
1354
 
1324
- int precision = conv.precision() < 0 ? 6 : conv.precision();
1355
+ size_t precision =
1356
+ conv.precision() < 0 ? 6 : static_cast<size_t>(conv.precision());
1325
1357
 
1326
1358
  int exp = 0;
1327
1359
 
@@ -1348,12 +1380,12 @@ bool FloatToSink(const Float v, const FormatConversionSpecImpl &conv,
1348
1380
  &buffer);
1349
1381
  } else if (c == FormatConversionCharInternal::g ||
1350
1382
  c == FormatConversionCharInternal::G) {
1351
- precision = std::max(0, precision - 1);
1383
+ precision = std::max(precision, size_t{1}) - 1;
1352
1384
  if (!FloatToBuffer<FormatStyle::Precision>(decomposed, precision, &buffer,
1353
1385
  &exp)) {
1354
1386
  return FallbackToSnprintf(v, conv, sink);
1355
1387
  }
1356
- if (precision + 1 > exp && exp >= -4) {
1388
+ if ((exp < 0 || precision + 1 > static_cast<size_t>(exp)) && exp >= -4) {
1357
1389
  if (exp < 0) {
1358
1390
  // Have 1.23456, needs 0.00123456
1359
1391
  // Move the first digit
@@ -1388,9 +1420,11 @@ bool FloatToSink(const Float v, const FormatConversionSpecImpl &conv,
1388
1420
  return false;
1389
1421
  }
1390
1422
 
1391
- WriteBufferToSink(sign_char,
1392
- absl::string_view(buffer.begin, buffer.end - buffer.begin),
1393
- conv, sink);
1423
+ WriteBufferToSink(
1424
+ sign_char,
1425
+ absl::string_view(buffer.begin,
1426
+ static_cast<size_t>(buffer.end - buffer.begin)),
1427
+ conv, sink);
1394
1428
 
1395
1429
  return true;
1396
1430
  }