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.
- checksums.yaml +4 -4
- data/Makefile +50 -5
- data/include/grpc/event_engine/event_engine.h +24 -2
- data/include/grpc/event_engine/slice_buffer.h +13 -1
- data/include/grpc/impl/grpc_types.h +3 -0
- data/include/grpc/support/time.h +6 -4
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +148 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +52 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_provider.h +29 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.h +3 -3
- data/src/core/ext/filters/channel_idle/idle_filter_state.h +3 -3
- data/src/core/ext/filters/client_channel/backend_metric.h +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.h +3 -3
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +29 -33
- data/src/core/ext/filters/client_channel/client_channel.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_factory.h +3 -3
- data/src/core/ext/filters/client_channel/client_channel_service_config.h +3 -3
- data/src/core/ext/filters/client_channel/config_selector.h +3 -3
- data/src/core/ext/filters/client_channel/connector.h +8 -4
- data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -3
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -3
- data/src/core/ext/filters/client_channel/lb_call_state_internal.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +1 -78
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +117 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +128 -0
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h +71 -0
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +972 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +12 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +275 -107
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +10 -3
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +5 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +6 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +1 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +3 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +3 -7
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +3 -3
- data/src/core/ext/filters/client_channel/retry_filter.cc +10 -13
- data/src/core/ext/filters/client_channel/retry_filter.h +3 -3
- data/src/core/ext/filters/client_channel/retry_service_config.h +3 -3
- data/src/core/ext/filters/client_channel/retry_throttle.h +3 -3
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +4 -4
- data/src/core/ext/filters/client_channel/subchannel.cc +5 -1
- data/src/core/ext/filters/client_channel/subchannel.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.h +3 -3
- data/src/core/ext/filters/deadline/deadline_filter.cc +40 -48
- data/src/core/ext/filters/deadline/deadline_filter.h +6 -10
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +3 -3
- data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h +3 -3
- data/src/core/ext/filters/http/client/http_client_filter.cc +26 -21
- data/src/core/ext/filters/http/client/http_client_filter.h +3 -3
- data/src/core/ext/filters/http/client_authority_filter.h +3 -3
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +109 -117
- data/src/core/ext/filters/http/message_compress/compression_filter.h +17 -10
- data/src/core/ext/filters/http/server/http_server_filter.cc +25 -24
- data/src/core/ext/filters/http/server/http_server_filter.h +3 -3
- data/src/core/ext/filters/message_size/message_size_filter.cc +2 -1
- data/src/core/ext/filters/message_size/message_size_filter.h +3 -3
- data/src/core/ext/filters/rbac/rbac_filter.cc +4 -3
- data/src/core/ext/filters/rbac/rbac_filter.h +3 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +3 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.h +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +27 -37
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +5 -5
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +3 -3
- data/src/core/ext/transport/chttp2/alpn/alpn.h +3 -3
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +3 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +3 -3
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +3 -3
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +195 -111
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
- data/src/core/ext/transport/chttp2/transport/context_list.h +3 -3
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_constants.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +18 -407
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -3
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +3 -3
- data/src/core/ext/transport/chttp2/transport/http_trace.h +3 -3
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +3 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +28 -23
- data/src/core/ext/transport/chttp2/transport/parsing.cc +111 -31
- data/src/core/ext/transport/chttp2/transport/stream_map.h +3 -3
- data/src/core/ext/transport/chttp2/transport/varint.h +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +9 -8
- data/src/core/ext/transport/inproc/inproc_transport.h +3 -3
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +9 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +38 -2
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +185 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +7 -3
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +44 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +16 -25
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +48 -74
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +30 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +137 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +15 -12
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +83 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +15 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +17 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +61 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +11 -5
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +37 -6
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +22 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +6 -3
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -5
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +50 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +57 -16
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +254 -17
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +9 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +9 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +7 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +21 -12
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -3
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +23 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +10 -7
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +42 -12
- 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
- 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
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +111 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +444 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +7 -3
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +8 -6
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +31 -9
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +24 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +113 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +43 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +114 -0
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +3 -1
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.c +54 -53
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.c +34 -13
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump_shared.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +195 -187
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +232 -224
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +0 -5
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +95 -75
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +94 -93
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +81 -75
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +189 -187
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +7 -3
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +71 -66
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +137 -133
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +16 -12
- data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +140 -133
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +81 -70
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +771 -741
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.c +16 -14
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opentelemetry.upbdefs.c +14 -13
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.c +20 -18
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +53 -42
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +363 -356
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +149 -145
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +16 -13
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.c +48 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/filter_state.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +14 -14
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.c +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/status_code_input.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.c +10 -9
- data/src/core/ext/xds/certificate_provider_store.h +3 -3
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +1 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +3 -3
- data/src/core/ext/xds/upb_utils.h +3 -3
- data/src/core/ext/xds/xds_api.h +3 -3
- data/src/core/ext/xds/xds_bootstrap.h +3 -3
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +1 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +3 -3
- data/src/core/ext/xds/xds_certificate_provider.h +3 -3
- data/src/core/ext/xds/xds_channel_args.h +3 -3
- data/src/core/ext/xds/xds_channel_stack_modifier.h +3 -3
- data/src/core/ext/xds/xds_client.cc +8 -3
- data/src/core/ext/xds/xds_client.h +3 -3
- data/src/core/ext/xds/xds_client_grpc.cc +0 -1
- data/src/core/ext/xds/xds_client_grpc.h +3 -3
- data/src/core/ext/xds/xds_client_stats.h +4 -3
- data/src/core/ext/xds/xds_cluster.cc +11 -7
- data/src/core/ext/xds/xds_cluster.h +6 -6
- data/src/core/ext/xds/xds_cluster_specifier_plugin.h +3 -3
- data/src/core/ext/xds/xds_common_types.cc +1 -0
- data/src/core/ext/xds/xds_common_types.h +3 -3
- data/src/core/ext/xds/xds_endpoint.cc +1 -1
- data/src/core/ext/xds/xds_endpoint.h +3 -3
- data/src/core/ext/xds/xds_health_status.h +30 -3
- data/src/core/ext/xds/xds_http_fault_filter.h +3 -3
- data/src/core/ext/xds/xds_http_filters.cc +1 -1
- data/src/core/ext/xds/xds_http_filters.h +3 -3
- data/src/core/ext/xds/xds_http_rbac_filter.h +3 -3
- data/src/core/ext/xds/xds_http_stateful_session_filter.h +3 -3
- data/src/core/ext/xds/xds_lb_policy_registry.cc +95 -0
- data/src/core/ext/xds/xds_lb_policy_registry.h +3 -3
- data/src/core/ext/xds/xds_listener.cc +1 -0
- data/src/core/ext/xds/xds_listener.h +3 -3
- data/src/core/ext/xds/xds_resource_type.h +3 -3
- data/src/core/ext/xds/xds_resource_type_impl.h +3 -3
- data/src/core/ext/xds/xds_route_config.cc +6 -0
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_routing.h +3 -3
- data/src/core/ext/xds/xds_transport.h +3 -3
- data/src/core/ext/xds/xds_transport_grpc.h +3 -3
- data/src/core/lib/address_utils/parse_address.h +3 -3
- data/src/core/lib/address_utils/sockaddr_utils.cc +1 -0
- data/src/core/lib/address_utils/sockaddr_utils.h +3 -3
- data/src/core/lib/avl/avl.h +3 -3
- data/src/core/lib/backoff/backoff.h +3 -3
- data/src/core/lib/channel/call_finalization.h +3 -3
- data/src/core/lib/channel/call_tracer.h +3 -3
- data/src/core/lib/channel/channel_args.cc +1 -0
- data/src/core/lib/channel/channel_args.h +11 -5
- data/src/core/lib/channel/channel_args_preconditioning.h +3 -3
- data/src/core/lib/channel/channel_fwd.h +3 -3
- data/src/core/lib/channel/channel_stack.cc +1 -2
- data/src/core/lib/channel/channel_stack.h +4 -4
- data/src/core/lib/channel/channel_stack_builder.h +3 -3
- data/src/core/lib/channel/channel_stack_builder_impl.cc +14 -1
- data/src/core/lib/channel/channel_stack_builder_impl.h +3 -3
- data/src/core/lib/channel/channel_trace.h +3 -3
- data/src/core/lib/channel/channelz.h +3 -3
- data/src/core/lib/channel/channelz_registry.h +3 -3
- data/src/core/lib/channel/connected_channel.cc +883 -354
- data/src/core/lib/channel/connected_channel.h +3 -3
- data/src/core/lib/channel/context.h +7 -3
- data/src/core/lib/channel/promise_based_filter.cc +532 -260
- data/src/core/lib/channel/promise_based_filter.h +124 -44
- data/src/core/lib/channel/status_util.h +3 -3
- data/src/core/lib/compression/compression_internal.h +3 -3
- data/src/core/lib/compression/message_compress.h +3 -3
- data/src/core/lib/config/core_configuration.h +3 -3
- data/src/core/lib/debug/event_log.h +3 -3
- data/src/core/lib/debug/histogram_view.h +3 -3
- data/src/core/lib/debug/stats.h +3 -3
- data/src/core/lib/debug/stats_data.cc +66 -65
- data/src/core/lib/debug/stats_data.h +42 -33
- data/src/core/lib/debug/trace.h +4 -26
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +5 -0
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +3 -3
- data/src/core/lib/event_engine/common_closures.h +3 -3
- data/src/core/lib/event_engine/default_event_engine.cc +9 -4
- data/src/core/lib/event_engine/default_event_engine.h +30 -6
- data/src/core/lib/event_engine/default_event_engine_factory.h +3 -3
- data/src/core/lib/event_engine/event_engine.cc +25 -0
- data/src/core/lib/event_engine/executor/executor.h +3 -3
- data/src/core/lib/event_engine/forkable.cc +11 -6
- data/src/core/lib/event_engine/forkable.h +3 -3
- data/src/core/lib/event_engine/handle_containers.h +10 -3
- data/src/core/lib/event_engine/poller.h +3 -3
- data/src/core/lib/event_engine/posix.h +158 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +44 -16
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +14 -4
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +6 -7
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +3 -3
- data/src/core/lib/event_engine/posix_engine/event_poller.h +3 -3
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -3
- data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +3 -3
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +52 -55
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +46 -13
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +82 -12
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +23 -9
- data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +60 -7
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +65 -14
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +0 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +6 -6
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer_heap.h +3 -3
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +3 -3
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +3 -3
- data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +3 -3
- data/src/core/lib/event_engine/resolved_address.cc +19 -0
- data/src/core/lib/event_engine/resolved_address_internal.h +34 -0
- data/src/core/lib/event_engine/shim.cc +56 -0
- data/src/core/lib/event_engine/shim.h +33 -0
- data/src/core/lib/event_engine/slice.cc +1 -1
- data/src/core/lib/event_engine/tcp_socket_utils.cc +18 -2
- data/src/core/lib/event_engine/tcp_socket_utils.h +8 -3
- data/src/core/lib/event_engine/thread_local.cc +29 -0
- data/src/core/lib/event_engine/thread_local.h +32 -0
- data/src/core/lib/event_engine/thread_pool.cc +41 -65
- data/src/core/lib/event_engine/thread_pool.h +21 -17
- data/src/core/lib/event_engine/time_util.h +3 -3
- data/src/core/lib/event_engine/trace.cc +6 -0
- data/src/core/lib/event_engine/trace.h +16 -3
- data/src/core/lib/event_engine/utils.cc +2 -2
- data/src/core/lib/event_engine/utils.h +12 -4
- data/src/core/lib/event_engine/windows/iocp.cc +24 -40
- data/src/core/lib/event_engine/windows/iocp.h +3 -3
- data/src/core/lib/event_engine/windows/win_socket.cc +56 -33
- data/src/core/lib/event_engine/windows/win_socket.h +34 -25
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +331 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.h +103 -0
- data/src/core/lib/event_engine/windows/windows_engine.cc +243 -20
- data/src/core/lib/event_engine/windows/windows_engine.h +62 -23
- data/src/core/lib/experiments/config.cc +16 -1
- data/src/core/lib/experiments/config.h +13 -3
- data/src/core/lib/experiments/experiments.cc +14 -8
- data/src/core/lib/experiments/experiments.h +80 -21
- data/src/core/lib/gpr/alloc.h +3 -3
- data/src/core/lib/gpr/spinlock.h +3 -3
- data/src/core/lib/gpr/string.h +3 -3
- data/src/core/lib/gpr/sync_abseil.cc +15 -7
- data/src/core/lib/gpr/time_precise.h +3 -3
- data/src/core/lib/gpr/tmpfile.h +3 -3
- data/src/core/lib/gpr/useful.h +3 -3
- data/src/core/lib/gprpp/atomic_utils.h +3 -3
- data/src/core/lib/gprpp/bitset.h +3 -3
- data/src/core/lib/gprpp/chunked_vector.h +3 -3
- data/src/core/lib/gprpp/construct_destruct.h +3 -3
- data/src/core/lib/gprpp/cpp_impl_of.h +3 -3
- data/src/core/lib/gprpp/crash.h +3 -3
- data/src/core/lib/gprpp/debug_location.h +3 -6
- data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
- data/src/core/lib/gprpp/env.h +3 -3
- data/src/core/lib/gprpp/examine_stack.h +3 -3
- data/src/core/lib/gprpp/fork.cc +21 -4
- data/src/core/lib/gprpp/fork.h +7 -5
- data/src/core/lib/gprpp/global_config.h +3 -3
- data/src/core/lib/gprpp/global_config_custom.h +3 -3
- data/src/core/lib/gprpp/global_config_env.cc +1 -0
- data/src/core/lib/gprpp/global_config_env.h +3 -3
- data/src/core/lib/gprpp/global_config_generic.h +3 -3
- data/src/core/lib/gprpp/host_port.cc +2 -0
- data/src/core/lib/gprpp/host_port.h +3 -3
- data/src/core/lib/gprpp/load_file.h +3 -3
- data/src/core/lib/gprpp/manual_constructor.h +3 -3
- data/src/core/lib/gprpp/match.h +3 -3
- data/src/core/lib/gprpp/memory.h +3 -3
- data/src/core/lib/gprpp/mpscq.h +3 -3
- data/src/core/lib/gprpp/no_destruct.h +3 -3
- data/src/core/lib/gprpp/notification.h +3 -3
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/overload.h +3 -3
- data/src/core/lib/gprpp/packed_table.h +3 -3
- data/src/core/lib/gprpp/per_cpu.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +3 -3
- data/src/core/lib/gprpp/single_set_ptr.h +3 -3
- data/src/core/lib/gprpp/sorted_pack.h +3 -3
- data/src/core/lib/gprpp/stat.h +3 -3
- data/src/core/lib/gprpp/status_helper.h +3 -3
- data/src/core/lib/gprpp/strerror.cc +2 -0
- data/src/core/lib/gprpp/strerror.h +3 -3
- data/src/core/lib/gprpp/sync.h +3 -3
- data/src/core/lib/gprpp/table.h +3 -3
- data/src/core/lib/gprpp/tchar.h +3 -3
- data/src/core/lib/gprpp/thd.h +3 -3
- data/src/core/lib/gprpp/time.cc +1 -0
- data/src/core/lib/gprpp/time.h +3 -3
- data/src/core/lib/gprpp/time_averaged_stats.h +3 -3
- data/src/core/lib/gprpp/time_util.h +3 -3
- data/src/core/lib/gprpp/unique_type_name.h +3 -3
- data/src/core/lib/gprpp/validation_errors.h +3 -3
- data/src/core/lib/gprpp/work_serializer.h +3 -3
- data/src/core/lib/handshaker/proxy_mapper.h +3 -3
- data/src/core/lib/handshaker/proxy_mapper_registry.h +3 -3
- data/src/core/lib/http/format_request.cc +1 -0
- data/src/core/lib/http/format_request.h +3 -3
- data/src/core/lib/http/httpcli.cc +1 -0
- data/src/core/lib/http/httpcli.h +3 -3
- data/src/core/lib/http/httpcli_ssl_credentials.h +3 -3
- data/src/core/lib/http/parser.h +3 -3
- data/src/core/lib/iomgr/block_annotate.h +3 -3
- data/src/core/lib/iomgr/buffer_list.h +3 -3
- data/src/core/lib/iomgr/call_combiner.cc +4 -4
- data/src/core/lib/iomgr/call_combiner.h +3 -3
- data/src/core/lib/iomgr/cfstream_handle.h +3 -3
- data/src/core/lib/iomgr/closure.cc +27 -0
- data/src/core/lib/iomgr/closure.h +5 -3
- data/src/core/lib/iomgr/combiner.h +3 -3
- data/src/core/lib/iomgr/dynamic_annotations.h +3 -3
- data/src/core/lib/iomgr/endpoint.h +3 -3
- data/src/core/lib/iomgr/endpoint_cfstream.h +3 -3
- data/src/core/lib/iomgr/endpoint_pair.h +3 -3
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +10 -2
- data/src/core/lib/iomgr/error.h +3 -3
- data/src/core/lib/iomgr/error_cfstream.h +3 -3
- data/src/core/lib/iomgr/ev_apple.h +3 -3
- data/src/core/lib/iomgr/ev_epoll1_linux.h +3 -3
- data/src/core/lib/iomgr/ev_poll_posix.h +3 -3
- data/src/core/lib/iomgr/ev_posix.h +3 -3
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +62 -0
- data/src/core/lib/iomgr/event_engine_shims/closure.h +39 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +430 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +43 -0
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +91 -0
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.h +44 -0
- data/src/core/lib/iomgr/exec_ctx.h +3 -3
- data/src/core/lib/iomgr/executor.h +3 -3
- data/src/core/lib/iomgr/fork_posix.cc +5 -4
- data/src/core/lib/iomgr/gethostname.h +3 -3
- data/src/core/lib/iomgr/grpc_if_nametoindex.h +3 -3
- data/src/core/lib/iomgr/internal_errqueue.h +3 -3
- data/src/core/lib/iomgr/iocp_windows.h +3 -3
- data/src/core/lib/iomgr/iomgr.h +3 -3
- data/src/core/lib/iomgr/iomgr_fwd.h +3 -3
- data/src/core/lib/iomgr/iomgr_internal.h +3 -3
- data/src/core/lib/iomgr/load_file.h +3 -3
- data/src/core/lib/iomgr/lockfree_event.h +3 -3
- data/src/core/lib/iomgr/nameser.h +3 -3
- data/src/core/lib/iomgr/polling_entity.h +3 -3
- data/src/core/lib/iomgr/pollset.h +3 -3
- data/src/core/lib/iomgr/pollset_set.h +3 -3
- data/src/core/lib/iomgr/pollset_set_windows.h +3 -3
- data/src/core/lib/iomgr/pollset_windows.cc +2 -2
- data/src/core/lib/iomgr/pollset_windows.h +3 -3
- data/src/core/lib/iomgr/port.h +3 -3
- data/src/core/lib/iomgr/python_util.h +3 -3
- data/src/core/lib/iomgr/resolve_address.h +3 -3
- data/src/core/lib/iomgr/resolve_address_impl.h +3 -3
- data/src/core/lib/iomgr/resolve_address_posix.h +3 -3
- data/src/core/lib/iomgr/resolve_address_windows.h +3 -3
- data/src/core/lib/iomgr/resolved_address.h +3 -3
- data/src/core/lib/iomgr/sockaddr.h +3 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +3 -3
- data/src/core/lib/iomgr/sockaddr_windows.h +3 -3
- data/src/core/lib/iomgr/socket_factory_posix.h +3 -3
- data/src/core/lib/iomgr/socket_mutator.h +3 -3
- data/src/core/lib/iomgr/socket_utils.h +3 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -3
- data/src/core/lib/iomgr/socket_windows.h +3 -3
- data/src/core/lib/iomgr/systemd_utils.cc +19 -19
- data/src/core/lib/iomgr/systemd_utils.h +24 -24
- data/src/core/lib/iomgr/tcp_client.h +3 -3
- data/src/core/lib/iomgr/tcp_client_posix.cc +12 -0
- data/src/core/lib/iomgr/tcp_client_posix.h +3 -3
- data/src/core/lib/iomgr/tcp_client_windows.cc +13 -1
- data/src/core/lib/iomgr/tcp_posix.cc +49 -65
- data/src/core/lib/iomgr/tcp_posix.h +3 -3
- data/src/core/lib/iomgr/tcp_server.h +3 -3
- data/src/core/lib/iomgr/tcp_server_posix.cc +219 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +4 -6
- data/src/core/lib/iomgr/tcp_windows.h +3 -3
- data/src/core/lib/iomgr/timer.h +3 -3
- data/src/core/lib/iomgr/timer_generic.h +3 -3
- data/src/core/lib/iomgr/timer_heap.h +3 -3
- data/src/core/lib/iomgr/timer_manager.h +3 -3
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -3
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +3 -3
- data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -3
- data/src/core/lib/json/json.h +3 -3
- data/src/core/lib/json/json_args.h +3 -3
- data/src/core/lib/json/json_channel_args.h +3 -3
- data/src/core/lib/json/json_object_loader.h +3 -3
- data/src/core/lib/json/json_reader.cc +1 -0
- data/src/core/lib/json/json_util.h +3 -3
- data/src/core/lib/load_balancing/lb_policy.cc +9 -0
- data/src/core/lib/load_balancing/lb_policy.h +9 -5
- data/src/core/lib/load_balancing/lb_policy_factory.h +3 -3
- data/src/core/lib/load_balancing/lb_policy_registry.cc +1 -0
- data/src/core/lib/load_balancing/lb_policy_registry.h +3 -3
- data/src/core/lib/load_balancing/subchannel_interface.h +8 -6
- data/src/core/lib/matchers/matchers.cc +1 -0
- data/src/core/lib/matchers/matchers.h +3 -3
- data/src/core/lib/promise/activity.cc +8 -6
- data/src/core/lib/promise/activity.h +52 -66
- data/src/core/lib/promise/arena_promise.h +3 -3
- data/src/core/lib/promise/context.h +3 -3
- data/src/core/lib/promise/detail/basic_join.h +197 -0
- data/src/core/lib/promise/detail/basic_seq.h +10 -16
- data/src/core/lib/promise/detail/promise_factory.h +3 -3
- data/src/core/lib/promise/detail/promise_like.h +3 -3
- data/src/core/lib/promise/detail/status.h +3 -3
- data/src/core/lib/promise/detail/switch.h +3 -3
- data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +3 -3
- data/src/core/lib/promise/if.h +195 -0
- data/src/core/lib/promise/interceptor_list.h +308 -0
- data/src/core/lib/promise/intra_activity_waiter.h +9 -3
- data/src/core/lib/promise/latch.h +99 -5
- data/src/core/lib/promise/loop.h +4 -4
- data/src/core/lib/promise/map.h +4 -6
- data/src/core/lib/promise/pipe.h +296 -193
- data/src/core/lib/promise/poll.h +113 -14
- data/src/core/lib/promise/promise.h +4 -5
- data/src/core/lib/promise/race.h +6 -9
- data/src/core/lib/promise/seq.h +3 -3
- data/src/core/lib/promise/sleep.h +3 -3
- data/src/core/lib/promise/{pipe.cc → trace.cc} +3 -2
- data/src/core/lib/promise/trace.h +24 -0
- data/src/core/lib/promise/try_join.h +82 -0
- data/src/core/lib/promise/try_seq.h +3 -3
- data/src/core/lib/resolver/resolver.h +3 -3
- data/src/core/lib/resolver/resolver_factory.h +4 -4
- data/src/core/lib/resolver/resolver_registry.cc +15 -0
- data/src/core/lib/resolver/resolver_registry.h +3 -3
- data/src/core/lib/resolver/server_address.cc +1 -0
- data/src/core/lib/resolver/server_address.h +3 -3
- data/src/core/lib/resource_quota/api.h +3 -3
- data/src/core/lib/resource_quota/arena.cc +36 -9
- data/src/core/lib/resource_quota/arena.h +84 -22
- data/src/core/lib/resource_quota/memory_quota.h +3 -3
- data/src/core/lib/resource_quota/periodic_update.h +3 -3
- data/src/core/lib/resource_quota/resource_quota.h +3 -3
- data/src/core/lib/resource_quota/thread_quota.h +3 -3
- data/src/core/lib/resource_quota/trace.h +3 -3
- data/src/core/lib/security/authorization/authorization_engine.h +3 -3
- data/src/core/lib/security/authorization/authorization_policy_provider.h +3 -3
- data/src/core/lib/security/authorization/evaluate_args.h +3 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +3 -3
- data/src/core/lib/security/authorization/grpc_server_authz_filter.h +3 -3
- data/src/core/lib/security/authorization/matchers.h +3 -3
- data/src/core/lib/security/authorization/rbac_policy.cc +1 -0
- data/src/core/lib/security/authorization/rbac_policy.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +3 -3
- data/src/core/lib/security/context/security_context.h +3 -3
- data/src/core/lib/security/credentials/alts/alts_credentials.h +3 -3
- data/src/core/lib/security/credentials/alts/check_gcp_environment.h +3 -3
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +3 -3
- data/src/core/lib/security/credentials/call_creds_util.h +3 -3
- data/src/core/lib/security/credentials/channel_creds_registry.h +3 -3
- data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -3
- data/src/core/lib/security/credentials/credentials.h +3 -3
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.h +3 -3
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +3 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.h +3 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +3 -3
- data/src/core/lib/security/credentials/insecure/insecure_credentials.h +3 -3
- data/src/core/lib/security/credentials/jwt/json_token.h +3 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +4 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
- data/src/core/lib/security/credentials/local/local_credentials.h +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +4 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +3 -3
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +3 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -3
- data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -3
- data/src/core/lib/security/credentials/tls/tls_utils.h +3 -3
- data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/load_system_roots.h +3 -3
- data/src/core/lib/security/security_connector/load_system_roots_supported.h +3 -3
- data/src/core/lib/security/security_connector/local/local_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl_utils.h +3 -3
- data/src/core/lib/security/security_connector/ssl_utils_config.h +3 -3
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +3 -3
- data/src/core/lib/security/transport/auth_filters.h +27 -5
- data/src/core/lib/security/transport/secure_endpoint.h +3 -3
- data/src/core/lib/security/transport/security_handshaker.cc +9 -0
- data/src/core/lib/security/transport/security_handshaker.h +3 -3
- data/src/core/lib/security/transport/server_auth_filter.cc +120 -251
- data/src/core/lib/security/transport/tsi_error.h +3 -3
- data/src/core/lib/security/util/json_util.h +3 -3
- data/src/core/lib/service_config/service_config.h +3 -3
- data/src/core/lib/service_config/service_config_call_data.h +3 -3
- data/src/core/lib/service_config/service_config_impl.h +3 -3
- data/src/core/lib/service_config/service_config_parser.h +3 -3
- data/src/core/lib/slice/b64.h +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +3 -3
- data/src/core/lib/slice/slice.h +14 -21
- data/src/core/lib/slice/slice_buffer.h +10 -4
- data/src/core/lib/slice/slice_internal.h +3 -3
- data/src/core/lib/slice/slice_refcount.cc +20 -0
- data/src/core/lib/slice/slice_refcount.h +26 -6
- data/src/core/lib/slice/slice_string_helpers.h +3 -3
- data/src/core/lib/surface/api_trace.h +3 -3
- data/src/core/lib/surface/builtins.h +3 -3
- data/src/core/lib/surface/call.cc +866 -252
- data/src/core/lib/surface/call.h +31 -3
- data/src/core/lib/surface/call_log_batch.cc +1 -0
- data/src/core/lib/surface/call_test_only.h +3 -3
- data/src/core/lib/surface/call_trace.cc +21 -11
- data/src/core/lib/surface/call_trace.h +3 -3
- data/src/core/lib/surface/channel.h +3 -3
- data/src/core/lib/surface/channel_init.h +3 -3
- data/src/core/lib/surface/channel_stack_type.h +3 -3
- data/src/core/lib/surface/completion_queue.cc +1 -0
- data/src/core/lib/surface/completion_queue.h +3 -3
- data/src/core/lib/surface/completion_queue_factory.h +3 -3
- data/src/core/lib/surface/event_string.cc +1 -0
- data/src/core/lib/surface/event_string.h +3 -3
- data/src/core/lib/surface/init.cc +1 -1
- data/src/core/lib/surface/init.h +3 -3
- data/src/core/lib/surface/init_internally.h +3 -3
- data/src/core/lib/surface/lame_client.cc +3 -1
- data/src/core/lib/surface/lame_client.h +3 -3
- data/src/core/lib/surface/server.cc +273 -27
- data/src/core/lib/surface/server.h +6 -3
- data/src/core/lib/surface/validate_metadata.h +3 -3
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +3 -3
- data/src/core/lib/transport/connectivity_state.h +3 -3
- data/src/core/lib/transport/error_utils.h +3 -3
- data/src/core/lib/transport/handshaker.cc +11 -0
- data/src/core/lib/transport/handshaker.h +4 -4
- data/src/core/lib/transport/handshaker_factory.h +3 -3
- data/src/core/lib/transport/handshaker_registry.h +3 -3
- data/src/core/lib/transport/http2_errors.h +3 -3
- data/src/core/lib/transport/http_connect_handshaker.h +3 -3
- data/src/core/lib/transport/metadata_batch.cc +11 -0
- data/src/core/lib/transport/metadata_batch.h +24 -3
- data/src/core/lib/transport/parsed_metadata.h +3 -3
- data/src/core/lib/transport/pid_controller.h +3 -3
- data/src/core/lib/transport/status_conversion.h +3 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +0 -1
- data/src/core/lib/transport/tcp_connect_handshaker.h +3 -3
- data/src/core/lib/transport/timeout_encoding.h +3 -3
- data/src/core/lib/transport/transport.cc +3 -8
- data/src/core/lib/transport/transport.h +16 -8
- data/src/core/lib/transport/transport_fwd.h +3 -3
- data/src/core/lib/transport/transport_impl.h +3 -3
- data/src/core/lib/transport/transport_op_string.cc +1 -0
- data/src/core/lib/uri/uri_parser.cc +1 -1
- data/src/core/lib/uri/uri_parser.h +3 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +5 -0
- data/src/core/tsi/alts/crypt/gsec.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_counter.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_crypter.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +3 -3
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +3 -3
- data/src/core/tsi/alts/frame_protector/frame_handler.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +3 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +3 -3
- data/src/core/tsi/fake_transport_security.h +3 -3
- data/src/core/tsi/local_transport_security.h +3 -3
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +1 -1
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +3 -3
- data/src/core/tsi/ssl/session_cache/ssl_session.h +3 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -3
- data/src/core/tsi/ssl_transport_security.cc +113 -24
- data/src/core/tsi/ssl_transport_security.h +5 -3
- data/src/core/tsi/ssl_transport_security_utils.h +3 -3
- data/src/core/tsi/ssl_types.h +3 -3
- data/src/core/tsi/transport_security.h +3 -3
- data/src/core/tsi/transport_security_grpc.h +3 -3
- data/src/core/tsi/transport_security_interface.h +3 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +0 -6
- data/third_party/abseil-cpp/absl/algorithm/container.h +56 -57
- data/third_party/abseil-cpp/absl/base/attributes.h +39 -19
- data/third_party/abseil-cpp/absl/base/config.h +44 -3
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +3 -18
- data/third_party/abseil-cpp/absl/base/internal/cycleclock_config.h +55 -0
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -1
- data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +3 -3
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +1 -1
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +10 -6
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +23 -24
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +3 -3
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +2 -6
- data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +4 -1
- data/third_party/abseil-cpp/absl/base/internal/strerror.cc +4 -4
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +14 -10
- data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +9 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +4 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -40
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h +62 -0
- data/third_party/abseil-cpp/absl/base/macros.h +4 -21
- data/third_party/abseil-cpp/absl/base/optimization.h +58 -6
- data/third_party/abseil-cpp/absl/base/options.h +1 -7
- data/third_party/abseil-cpp/absl/base/policy_checks.h +15 -13
- data/third_party/abseil-cpp/absl/container/fixed_array.h +7 -5
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -7
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +66 -18
- data/third_party/abseil-cpp/absl/container/internal/common.h +3 -3
- data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +132 -0
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +13 -1
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +4 -55
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +50 -5
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +14 -46
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +110 -32
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +155 -4
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +661 -341
- data/third_party/abseil-cpp/absl/crc/crc32c.cc +99 -0
- data/third_party/abseil-cpp/absl/crc/crc32c.h +183 -0
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +256 -0
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.h +57 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc.cc +468 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc.h +91 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +269 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc32c.h +39 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc32c_inline.h +72 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +130 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +159 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +179 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy.h +119 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_fallback.cc +75 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +434 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_non_temporal_memcpy.cc +93 -0
- data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +725 -0
- data/third_party/abseil-cpp/absl/crc/internal/non_temporal_arm_intrinsics.h +79 -0
- data/third_party/abseil-cpp/absl/crc/internal/non_temporal_memcpy.h +180 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +67 -38
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -13
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +11 -9
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +40 -85
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +5 -4
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +33 -8
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +3 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +3 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +118 -94
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +7 -6
- data/third_party/abseil-cpp/absl/functional/any_invocable.h +5 -2
- data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +47 -26
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +10 -10
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +18 -4
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +3 -14
- data/third_party/abseil-cpp/absl/memory/memory.h +26 -447
- data/third_party/abseil-cpp/absl/meta/type_traits.h +104 -12
- data/third_party/abseil-cpp/absl/numeric/bits.h +2 -3
- data/third_party/abseil-cpp/absl/numeric/int128.cc +10 -8
- data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +14 -6
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +2 -1
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +2 -23
- data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +9 -9
- data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +2 -2
- data/third_party/abseil-cpp/absl/random/random.h +6 -6
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +1 -0
- data/third_party/abseil-cpp/absl/status/status.cc +19 -12
- data/third_party/abseil-cpp/absl/status/status.h +2 -2
- data/third_party/abseil-cpp/absl/strings/ascii.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/charconv.cc +534 -96
- data/third_party/abseil-cpp/absl/strings/cord.cc +92 -40
- data/third_party/abseil-cpp/absl/strings/cord.h +71 -80
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +8 -5
- data/third_party/abseil-cpp/absl/strings/escaping.cc +73 -62
- data/third_party/abseil-cpp/absl/strings/escaping.h +24 -19
- data/third_party/abseil-cpp/absl/strings/internal/char_map.h +14 -12
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +4 -4
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +326 -70
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +8 -4
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +26 -14
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.cc +9 -7
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_crc.h +5 -4
- data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +7 -15
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +3 -3
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +8 -5
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +7 -7
- data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +4 -4
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.cc +93 -0
- data/third_party/abseil-cpp/absl/strings/internal/damerau_levenshtein_distance.h +34 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +12 -10
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +7 -9
- data/third_party/abseil-cpp/absl/strings/internal/has_absl_stringify.h +55 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +9 -6
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +14 -7
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +35 -10
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +113 -46
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +126 -29
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +4 -3
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +49 -287
- data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +351 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +4 -2
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +215 -181
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +10 -209
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +10 -101
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.cc +28 -0
- data/third_party/abseil-cpp/absl/strings/internal/stringify_sink.h +57 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +34 -31
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +9 -6
- data/third_party/abseil-cpp/absl/strings/str_cat.h +50 -3
- data/third_party/abseil-cpp/absl/strings/str_format.h +71 -9
- data/third_party/abseil-cpp/absl/strings/string_view.cc +6 -6
- data/third_party/abseil-cpp/absl/strings/string_view.h +3 -10
- data/third_party/abseil-cpp/absl/strings/substitute.cc +8 -6
- data/third_party/abseil-cpp/absl/strings/substitute.h +46 -20
- data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +20 -17
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +37 -31
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +22 -8
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +104 -55
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +85 -46
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +0 -1
- data/third_party/abseil-cpp/absl/synchronization/notification.h +0 -1
- data/third_party/abseil-cpp/absl/time/civil_time.cc +26 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +25 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +17 -11
- data/third_party/abseil-cpp/absl/time/duration.cc +7 -7
- data/third_party/abseil-cpp/absl/time/format.cc +2 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +26 -5
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +7 -6
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +36 -35
- data/third_party/abseil-cpp/absl/time/time.cc +2 -2
- data/third_party/abseil-cpp/absl/time/time.h +253 -158
- data/third_party/abseil-cpp/absl/types/internal/span.h +30 -19
- data/third_party/abseil-cpp/absl/types/internal/variant.h +28 -40
- data/third_party/abseil-cpp/absl/types/span.h +29 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -2
- metadata +75 -10
- data/src/core/lib/event_engine/socket_notifier.h +0 -55
- data/src/core/lib/promise/for_each.h +0 -155
- data/src/core/lib/promise/map_pipe.h +0 -88
- 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
|
97
|
+
inline char MultiplyBy10WithCarry(Int* v, char carry) {
|
97
98
|
using BiggerInt = absl::conditional_t<sizeof(Int) == 4, uint64_t, uint128>;
|
98
|
-
BiggerInt tmp =
|
99
|
+
BiggerInt tmp =
|
100
|
+
10 * static_cast<BiggerInt>(*v) + static_cast<BiggerInt>(carry);
|
99
101
|
*v = static_cast<Int>(tmp);
|
100
|
-
return static_cast<
|
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
|
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 *
|
114
|
-
*v = *v / 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
|
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
|
-
|
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
|
-
|
153
|
-
return
|
154
|
-
|
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
|
-
|
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_[
|
200
|
+
data_[after_chunk_index - 1] = static_cast<uint32_t>(v << offset);
|
198
201
|
for (v >>= (32 - offset); v; v >>= 32)
|
199
|
-
data_[++
|
202
|
+
data_[++after_chunk_index - 1] = static_cast<uint32_t>(v);
|
200
203
|
|
201
|
-
while (
|
204
|
+
while (after_chunk_index > 0) {
|
202
205
|
// While we have more than one chunk available, go in steps of 1e9.
|
203
|
-
// `data_[
|
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 (
|
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_[
|
216
|
+
if (data_[after_chunk_index - 1] == 0)
|
217
|
+
--after_chunk_index;
|
214
218
|
|
215
219
|
--decimal_start_;
|
216
|
-
assert(decimal_start_ !=
|
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
|
232
|
+
static constexpr size_t kDigitsPerChunk = 9;
|
229
233
|
|
230
|
-
|
231
|
-
|
234
|
+
size_t decimal_start_;
|
235
|
+
size_t decimal_end_;
|
232
236
|
|
233
237
|
char digits_[kDigitsPerChunk];
|
234
|
-
|
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(
|
255
|
-
|
256
|
-
|
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 ||
|
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 &&
|
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 &&
|
273
|
+
bool IsExactlyHalf() const { return next_digit_ == 5 && !after_chunk_index_; }
|
269
274
|
|
270
275
|
struct Digits {
|
271
|
-
|
272
|
-
|
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
|
-
|
292
|
-
if (
|
296
|
+
char GetOneDigit() {
|
297
|
+
if (!after_chunk_index_)
|
298
|
+
return 0;
|
293
299
|
|
294
|
-
|
295
|
-
for (
|
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_[
|
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
|
-
:
|
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_[
|
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 (
|
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
|
-
|
319
|
-
|
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
|
-
|
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
|
377
|
-
|
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,
|
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
|
406
|
-
|
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
|
-
|
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,
|
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
|
-
|
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
|
-
|
459
|
-
|
460
|
-
|
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
|
-
|
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
|
479
|
-
|
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 =
|
491
|
-
|
492
|
-
|
493
|
-
|
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 =
|
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
|
-
|
558
|
-
|
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')
|
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())
|
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
|
-
|
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 =
|
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,
|
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(
|
700
|
-
constexpr
|
701
|
-
constexpr
|
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)
|
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(
|
717
|
-
constexpr
|
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
|
-
|
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(
|
725
|
-
return nibble_index
|
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,
|
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
|
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,
|
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
|
781
|
+
if (final_nibble_displayed == 0) {
|
766
782
|
return false;
|
767
783
|
}
|
768
|
-
|
769
|
-
constexpr
|
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
|
-
|
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
|
822
|
+
constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4;
|
807
823
|
// Index of the last nibble that we could display given precision.
|
808
|
-
|
809
|
-
precision_specified
|
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
|
851
|
+
constexpr size_t kIntBits = sizeof(Int) * 8;
|
834
852
|
static const Int kHighIntBit = Int{1} << (kIntBits - 1);
|
835
|
-
const
|
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
|
-
|
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
|
860
|
-
constexpr
|
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
|
-
|
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
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
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,
|
930
|
-
2,
|
931
|
-
trailing_zeros, //
|
932
|
-
exp_buffer);
|
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
|
996
|
+
constexpr size_t kMaxFixedPrecision = 39;
|
976
997
|
|
977
|
-
constexpr
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
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
|
-
|
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(
|
1034
|
-
|
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
|
-
|
1119
|
-
|
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
|
-
|
1139
|
-
|
1140
|
-
|
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,
|
1169
|
-
int
|
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
|
-
|
1186
|
-
|
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
|
1190
|
-
|
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
|
-
|
1232
|
+
size_t digits_printed = PrintIntegralDigits<mode>(int_mantissa >> exp, out);
|
1207
1233
|
int_mantissa &= mask;
|
1208
1234
|
|
1209
|
-
|
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
|
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
|
-
|
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
|
-
|
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,
|
1259
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
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
|
-
|
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(
|
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(
|
1392
|
-
|
1393
|
-
|
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
|
}
|