grpc 1.55.0 → 1.58.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +783 -492
- data/include/grpc/event_engine/event_engine.h +26 -36
- data/include/grpc/event_engine/memory_allocator.h +2 -2
- data/include/grpc/grpc_audit_logging.h +96 -0
- data/include/grpc/grpc_security.h +19 -0
- data/include/grpc/impl/channel_arg_names.h +371 -0
- data/include/grpc/impl/grpc_types.h +1 -350
- data/include/grpc/module.modulemap +3 -0
- data/include/grpc/support/json.h +218 -0
- data/include/grpc/support/port_platform.h +29 -23
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +6 -1
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +2 -1
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +4 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +137 -115
- data/src/core/ext/filters/client_channel/client_channel.h +6 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +19 -18
- data/src/core/ext/filters/client_channel/client_channel_internal.h +16 -21
- data/src/core/ext/filters/client_channel/config_selector.h +9 -24
- data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +6 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +27 -53
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +23 -9
- data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +84 -136
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +480 -0
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +52 -0
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +202 -0
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +6 -9
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +132 -74
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +9 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +168 -104
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +20 -0
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +14 -43
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +22 -14
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +18 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +33 -88
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +7 -5
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +57 -22
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +76 -6
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +53 -43
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +17 -52
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +55 -114
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +32 -83
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +21 -67
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +62 -133
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +23 -62
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +24 -93
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +102 -11
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +44 -37
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +4 -1
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_plugin.cc +6 -0
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +135 -73
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/service_config_helper.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +28 -27
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +10 -4
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +428 -256
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +32 -1
- data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
- data/src/core/ext/filters/client_channel/retry_filter.h +92 -1
- data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
- data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
- data/src/core/ext/filters/client_channel/retry_service_config.cc +2 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +40 -90
- data/src/core/ext/filters/client_channel/subchannel.cc +17 -199
- data/src/core/ext/filters/client_channel/subchannel.h +14 -48
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +1 -1
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -0
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +6 -5
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +1 -0
- data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
- data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +94 -3
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -8
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +164 -88
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +16 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +15 -16
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +463 -519
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +46 -95
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +6 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +176 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +326 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +631 -547
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +157 -11
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +47 -33
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +19 -5
- data/src/core/ext/transport/chttp2/transport/internal.h +39 -76
- data/src/core/ext/transport/chttp2/transport/parsing.cc +43 -22
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +80 -0
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +55 -0
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +98 -0
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +73 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +82 -91
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +11 -2
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +15 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
- data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
- data/src/core/ext/xds/certificate_provider_store.cc +4 -9
- data/src/core/ext/xds/certificate_provider_store.h +1 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +30 -42
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +14 -9
- data/src/core/ext/xds/xds_api.cc +9 -6
- data/src/core/ext/xds/xds_api.h +3 -2
- data/src/core/ext/xds/xds_audit_logger_registry.cc +122 -0
- data/src/core/ext/xds/xds_audit_logger_registry.h +68 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +51 -36
- data/src/core/ext/xds/xds_bootstrap_grpc.h +10 -13
- data/src/core/ext/xds/xds_client.cc +5 -4
- data/src/core/ext/xds/xds_client_grpc.cc +12 -6
- data/src/core/ext/xds/xds_client_grpc.h +16 -2
- data/src/core/ext/xds/xds_client_stats.h +11 -1
- data/src/core/ext/xds/xds_cluster.cc +46 -35
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +11 -8
- data/src/core/ext/xds/xds_common_types.cc +3 -1
- data/src/core/ext/xds/xds_endpoint.cc +4 -7
- data/src/core/ext/xds/xds_health_status.cc +0 -17
- data/src/core/ext/xds/xds_health_status.h +5 -25
- data/src/core/ext/xds/xds_http_fault_filter.cc +14 -12
- data/src/core/ext/xds/xds_http_rbac_filter.cc +147 -65
- data/src/core/ext/xds/xds_http_stateful_session_filter.cc +13 -10
- data/src/core/ext/xds/xds_lb_policy_registry.cc +58 -16
- data/src/core/ext/xds/xds_listener.cc +1 -0
- data/src/core/ext/xds/xds_route_config.cc +44 -3
- data/src/core/ext/xds/xds_transport_grpc.cc +2 -1
- data/src/core/lib/address_utils/parse_address.cc +63 -1
- data/src/core/lib/address_utils/parse_address.h +8 -0
- data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
- data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
- data/src/core/lib/avl/avl.h +15 -173
- data/src/core/lib/backoff/random_early_detection.h +5 -0
- data/src/core/lib/channel/call_tracer.cc +289 -0
- data/src/core/lib/channel/call_tracer.h +35 -0
- data/src/core/lib/channel/channel_args.cc +120 -46
- data/src/core/lib/channel/channel_args.h +52 -4
- data/src/core/lib/channel/channel_trace.cc +16 -12
- data/src/core/lib/channel/channelz.cc +159 -132
- data/src/core/lib/channel/channelz.h +42 -35
- data/src/core/lib/channel/channelz_registry.cc +23 -20
- data/src/core/lib/channel/connected_channel.cc +21 -8
- data/src/core/lib/channel/promise_based_filter.cc +4 -5
- data/src/core/lib/channel/promise_based_filter.h +3 -0
- data/src/core/lib/compression/compression_internal.cc +8 -7
- data/src/core/lib/config/config_vars.cc +20 -18
- data/src/core/lib/config/config_vars.h +4 -4
- data/src/core/lib/config/load_config.cc +13 -0
- data/src/core/lib/config/load_config.h +6 -0
- data/src/core/lib/debug/event_log.h +1 -1
- data/src/core/lib/debug/stats_data.cc +93 -21
- data/src/core/lib/debug/stats_data.h +42 -1
- data/src/core/lib/debug/trace.cc +21 -55
- data/src/core/lib/debug/trace.h +3 -1
- data/src/core/lib/event_engine/ares_resolver.cc +712 -0
- data/src/core/lib/event_engine/ares_resolver.h +150 -0
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +218 -0
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +86 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +354 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +146 -0
- data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +79 -0
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +229 -0
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +117 -0
- data/src/core/lib/event_engine/default_event_engine.cc +13 -1
- data/src/core/lib/event_engine/default_event_engine_factory.cc +14 -2
- data/src/core/lib/event_engine/event_engine.cc +0 -12
- data/src/core/lib/event_engine/forkable.cc +62 -43
- data/src/core/lib/event_engine/forkable.h +15 -0
- data/src/core/lib/event_engine/grpc_polled_fd.h +73 -0
- data/src/core/lib/event_engine/handle_containers.h +0 -4
- data/src/core/lib/event_engine/poller.h +2 -2
- data/src/core/lib/event_engine/posix.h +4 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +5 -7
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +29 -9
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +10 -1
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +197 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +7 -18
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +28 -14
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +12 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +82 -21
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +22 -14
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +70 -31
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +12 -8
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +43 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
- data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +1 -1
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +2 -0
- data/src/core/lib/event_engine/shim.cc +7 -1
- data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
- data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/{thread_pool.cc → thread_pool/original_thread_pool.cc} +28 -25
- data/src/core/lib/event_engine/{thread_pool.h → thread_pool/original_thread_pool.h} +11 -15
- data/src/core/lib/event_engine/thread_pool/thread_count.cc +58 -0
- data/src/core/lib/event_engine/thread_pool/thread_count.h +161 -0
- data/src/core/lib/event_engine/{executor/executor.h → thread_pool/thread_pool.h} +21 -9
- data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +47 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +517 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +223 -0
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +157 -0
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +104 -0
- data/src/core/lib/event_engine/windows/iocp.cc +4 -3
- data/src/core/lib/event_engine/windows/iocp.h +3 -3
- data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
- data/src/core/lib/event_engine/windows/win_socket.h +4 -4
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +60 -59
- data/src/core/lib/event_engine/windows/windows_endpoint.h +17 -13
- data/src/core/lib/event_engine/windows/windows_engine.cc +21 -18
- data/src/core/lib/event_engine/windows/windows_engine.h +14 -18
- data/src/core/lib/event_engine/windows/windows_listener.cc +3 -3
- data/src/core/lib/event_engine/windows/windows_listener.h +3 -2
- data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +63 -0
- data/src/core/lib/event_engine/work_queue/basic_work_queue.h +71 -0
- data/src/core/lib/event_engine/work_queue/work_queue.h +62 -0
- data/src/core/lib/experiments/config.cc +112 -29
- data/src/core/lib/experiments/config.h +33 -5
- data/src/core/lib/experiments/experiments.cc +226 -64
- data/src/core/lib/experiments/experiments.h +93 -30
- data/src/core/lib/gpr/log_internal.h +55 -0
- data/src/core/lib/gprpp/crash.cc +10 -0
- data/src/core/lib/gprpp/crash.h +3 -0
- data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
- data/src/core/lib/gprpp/fork.cc +8 -9
- data/src/core/lib/gprpp/fork.h +6 -5
- data/src/core/lib/gprpp/if_list.h +4530 -0
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/per_cpu.cc +33 -0
- data/src/core/lib/gprpp/per_cpu.h +29 -6
- data/src/core/lib/gprpp/ref_counted.h +9 -7
- data/src/core/lib/gprpp/ref_counted_string.cc +44 -0
- data/src/core/lib/gprpp/ref_counted_string.h +146 -0
- data/src/core/lib/gprpp/sorted_pack.h +3 -12
- data/src/core/lib/gprpp/status_helper.h +16 -15
- data/src/core/lib/gprpp/time.cc +1 -0
- data/src/core/lib/gprpp/time.h +13 -1
- data/src/core/lib/gprpp/type_list.h +32 -0
- data/src/core/lib/gprpp/work_serializer.cc +36 -0
- data/src/core/lib/gprpp/work_serializer.h +5 -0
- data/src/core/lib/http/httpcli.h +6 -9
- data/src/core/lib/http/httpcli_security_connector.cc +1 -0
- data/src/core/lib/iomgr/buffer_list.cc +2 -0
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
- data/src/core/lib/iomgr/endpoint_cfstream.cc +10 -8
- data/src/core/lib/iomgr/error.cc +32 -2
- data/src/core/lib/iomgr/error.h +9 -10
- data/src/core/lib/iomgr/ev_apple.cc +12 -12
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -10
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +22 -23
- data/src/core/lib/iomgr/exec_ctx.h +11 -0
- data/src/core/lib/iomgr/iocp_windows.cc +24 -3
- data/src/core/lib/iomgr/iocp_windows.h +11 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +1 -1
- data/src/core/lib/iomgr/pollset.h +4 -5
- data/src/core/lib/iomgr/port.h +10 -0
- data/src/core/lib/iomgr/resolve_address.cc +13 -1
- data/src/core/lib/iomgr/resolve_address.h +17 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +33 -2
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
- data/src/core/lib/iomgr/socket_windows.cc +61 -7
- data/src/core/lib/iomgr/socket_windows.h +9 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -3
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
- data/src/core/lib/iomgr/tcp_posix.cc +24 -7
- data/src/core/lib/iomgr/tcp_server_posix.cc +184 -120
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -1
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +26 -2
- data/src/core/lib/iomgr/tcp_server_windows.cc +1 -1
- data/src/core/lib/iomgr/tcp_windows.cc +1 -3
- data/src/core/lib/iomgr/vsock.cc +59 -0
- data/src/core/lib/iomgr/vsock.h +38 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
- data/src/core/lib/json/json.h +2 -166
- data/src/core/lib/json/json_object_loader.cc +8 -9
- data/src/core/lib/json/json_object_loader.h +25 -18
- data/src/core/lib/json/json_reader.cc +13 -6
- data/src/core/lib/json/json_util.cc +6 -11
- data/src/core/lib/json/json_writer.cc +7 -8
- data/src/core/lib/load_balancing/delegating_helper.h +115 -0
- data/src/core/lib/load_balancing/lb_policy.h +33 -0
- data/src/core/lib/load_balancing/lb_policy_registry.cc +2 -1
- data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
- data/src/core/lib/matchers/matchers.cc +3 -4
- data/src/core/lib/matchers/matchers.h +2 -1
- data/src/core/lib/promise/activity.cc +5 -0
- data/src/core/lib/promise/activity.h +10 -0
- data/src/core/lib/promise/detail/basic_seq.h +1 -372
- data/src/core/lib/promise/detail/promise_factory.h +1 -1
- data/src/core/lib/promise/detail/seq_state.h +2076 -0
- data/src/core/lib/promise/party.cc +31 -13
- data/src/core/lib/promise/party.h +12 -3
- data/src/core/lib/promise/pipe.h +9 -2
- data/src/core/lib/promise/prioritized_race.h +95 -0
- data/src/core/lib/promise/seq.h +19 -2
- data/src/core/lib/promise/sleep.cc +2 -1
- data/src/core/lib/promise/sleep.h +5 -10
- data/src/core/lib/promise/try_seq.h +34 -2
- data/src/core/lib/resolver/resolver_factory.h +3 -2
- data/src/core/lib/resolver/server_address.cc +9 -102
- data/src/core/lib/resolver/server_address.h +10 -70
- data/src/core/lib/resource_quota/api.cc +1 -0
- data/src/core/lib/resource_quota/arena.cc +2 -0
- data/src/core/lib/resource_quota/arena.h +42 -8
- data/src/core/lib/resource_quota/memory_quota.cc +7 -8
- data/src/core/lib/resource_quota/memory_quota.h +2 -3
- data/src/core/lib/resource_quota/resource_quota.h +1 -0
- data/src/core/lib/security/authorization/audit_logging.cc +98 -0
- data/src/core/lib/security/authorization/audit_logging.h +73 -0
- data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +47 -2
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +18 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +36 -4
- data/src/core/lib/security/authorization/rbac_policy.h +19 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +75 -0
- data/src/core/lib/security/authorization/stdout_logger.h +61 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +8 -4
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +8 -18
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +14 -8
- data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +19 -12
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +8 -0
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +44 -3
- data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
- data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +32 -14
- data/src/core/lib/security/credentials/jwt/json_token.h +4 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +43 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +8 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +5 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +2 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +1 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +2 -5
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +3 -1
- data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +8 -5
- data/src/core/lib/security/transport/security_handshaker.cc +1 -0
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -0
- data/src/core/lib/security/util/json_util.cc +1 -0
- data/src/core/lib/service_config/service_config_call_data.h +54 -20
- data/src/core/lib/service_config/service_config_impl.cc +2 -1
- data/src/core/lib/slice/slice.h +16 -0
- data/src/core/lib/surface/call.cc +100 -59
- data/src/core/lib/surface/channel.cc +1 -0
- data/src/core/lib/surface/completion_queue.cc +16 -2
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/server.cc +67 -64
- data/src/core/lib/surface/server.h +1 -15
- data/src/core/lib/surface/validate_metadata.cc +37 -22
- data/src/core/lib/surface/validate_metadata.h +13 -3
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/batch_builder.cc +15 -12
- data/src/core/lib/transport/batch_builder.h +39 -35
- data/src/core/lib/transport/metadata_batch.cc +7 -7
- data/src/core/lib/transport/metadata_batch.h +86 -48
- data/src/core/lib/transport/parsed_metadata.h +34 -20
- data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
- data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -2
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -0
- data/src/core/tsi/alts/crypt/aes_gcm.cc +27 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
- data/src/core/tsi/ssl_transport_security.cc +44 -9
- data/src/core/tsi/ssl_transport_security.h +13 -1
- data/src/ruby/bin/math_pb.rb +24 -18
- data/src/ruby/ext/grpc/extconf.rb +27 -27
- data/src/ruby/ext/grpc/rb_call.c +62 -39
- data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_channel.c +109 -84
- data/src/ruby/ext/grpc/rb_channel.h +1 -0
- data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
- data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
- data/src/ruby/ext/grpc/rb_grpc.c +192 -30
- data/src/ruby/ext/grpc/rb_grpc.h +8 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/ext/grpc/rb_server.c +62 -45
- data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
- data/src/ruby/lib/grpc/generic/active_call.rb +9 -14
- data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
- data/src/ruby/pb/test/client.rb +16 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +3 -3
- data/third_party/abseil-cpp/absl/algorithm/container.h +3 -2
- data/third_party/abseil-cpp/absl/base/attributes.h +58 -5
- data/third_party/abseil-cpp/absl/base/call_once.h +1 -1
- data/third_party/abseil-cpp/absl/base/casts.h +8 -8
- data/third_party/abseil-cpp/absl/base/config.h +89 -106
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +26 -1
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -2
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +50 -39
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +2 -1
- data/third_party/abseil-cpp/absl/base/internal/prefetch.h +17 -18
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +32 -3
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +24 -4
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +31 -73
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +9 -8
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +11 -11
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +23 -32
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +2 -3
- data/third_party/abseil-cpp/absl/base/options.h +1 -1
- data/third_party/abseil-cpp/absl/base/policy_checks.h +3 -3
- data/third_party/abseil-cpp/absl/base/prefetch.h +198 -0
- data/third_party/abseil-cpp/absl/container/fixed_array.h +54 -29
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +5 -1
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +6 -2
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +167 -79
- data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +3 -21
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +46 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +2 -0
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +85 -26
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +35 -18
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +70 -29
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +437 -236
- data/third_party/abseil-cpp/absl/crc/crc32c.h +8 -1
- data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +14 -8
- data/third_party/abseil-cpp/absl/crc/internal/crc.cc +4 -35
- data/third_party/abseil-cpp/absl/crc/internal/crc.h +2 -10
- data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +1 -1
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +1 -1
- data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +4 -4
- data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +8 -10
- data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +17 -19
- data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +8 -8
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +2 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +59 -23
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +1 -1
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +1 -1
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +43 -19
- data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +3 -0
- data/third_party/abseil-cpp/absl/flags/commandlineflag.h +1 -1
- data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.cc +1 -1
- data/third_party/abseil-cpp/absl/flags/internal/flag.cc +2 -2
- data/third_party/abseil-cpp/absl/flags/internal/flag.h +16 -15
- data/third_party/abseil-cpp/absl/flags/internal/flag_msvc.inc +1 -1
- data/third_party/abseil-cpp/absl/flags/marshalling.cc +43 -2
- data/third_party/abseil-cpp/absl/flags/marshalling.h +5 -0
- data/third_party/abseil-cpp/absl/functional/any_invocable.h +9 -1
- data/third_party/abseil-cpp/absl/functional/bind_front.h +1 -1
- data/third_party/abseil-cpp/absl/functional/function_ref.h +3 -3
- data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +37 -24
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +19 -9
- data/third_party/abseil-cpp/absl/hash/hash.h +7 -4
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +38 -15
- data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +6 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +48 -373
- data/third_party/abseil-cpp/absl/numeric/bits.h +4 -4
- data/third_party/abseil-cpp/absl/numeric/int128.cc +20 -8
- data/third_party/abseil-cpp/absl/numeric/int128.h +36 -39
- data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +0 -3
- data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +47 -30
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +4 -3
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/platform.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +4 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +1 -1
- data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +1 -1
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +1 -1
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +4 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +12 -24
- data/third_party/abseil-cpp/absl/status/status.cc +11 -7
- data/third_party/abseil-cpp/absl/status/status.h +11 -2
- data/third_party/abseil-cpp/absl/status/statusor.h +22 -8
- data/third_party/abseil-cpp/absl/strings/ascii.cc +54 -6
- data/third_party/abseil-cpp/absl/strings/charconv.cc +21 -4
- data/third_party/abseil-cpp/absl/strings/charconv.h +2 -2
- data/third_party/abseil-cpp/absl/strings/cord.cc +1 -2
- data/third_party/abseil-cpp/absl/strings/cord.h +32 -5
- data/third_party/abseil-cpp/absl/strings/cord_analysis.cc +23 -1
- data/third_party/abseil-cpp/absl/strings/cord_analysis.h +18 -0
- data/third_party/abseil-cpp/absl/strings/cord_buffer.h +2 -5
- data/third_party/abseil-cpp/absl/strings/escaping.cc +10 -32
- data/third_party/abseil-cpp/absl/strings/escaping.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +2 -4
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +3 -3
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +0 -1
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +15 -13
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +13 -4
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +8 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +5 -3
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h +4 -7
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +8 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +2 -2
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +46 -20
- data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +1 -34
- data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +2 -1
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +23 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +2 -77
- data/third_party/abseil-cpp/absl/strings/internal/memutil.h +4 -112
- data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +10 -31
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +8 -8
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +5 -20
- data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +1 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +1 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +9 -9
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +56 -6
- data/third_party/abseil-cpp/absl/strings/match.cc +87 -0
- data/third_party/abseil-cpp/absl/strings/match.h +19 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +154 -122
- data/third_party/abseil-cpp/absl/strings/numbers.h +1 -6
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +7 -50
- data/third_party/abseil-cpp/absl/strings/str_cat.h +83 -15
- data/third_party/abseil-cpp/absl/strings/str_format.h +6 -3
- data/third_party/abseil-cpp/absl/strings/str_split.cc +9 -6
- data/third_party/abseil-cpp/absl/strings/string_view.cc +26 -4
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +5 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +63 -43
- data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.cc +111 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.h +63 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +11 -7
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.cc +225 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +122 -114
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +12 -8
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +10 -1
- data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.cc +167 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.h +60 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.cc +122 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.h +65 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.cc +91 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.h +56 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +19 -113
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.cc +42 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.h +90 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.cc +151 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.h +70 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +407 -411
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +152 -118
- data/third_party/abseil-cpp/absl/time/clock.cc +6 -7
- data/third_party/abseil-cpp/absl/time/duration.cc +24 -26
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +1 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +3 -3
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +8 -6
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +6 -3
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +4 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +4 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +322 -295
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +8 -17
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +51 -33
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +7 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +128 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +1 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +5 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +34 -34
- data/third_party/abseil-cpp/absl/time/time.cc +9 -2
- data/third_party/abseil-cpp/absl/time/time.h +115 -15
- data/third_party/abseil-cpp/absl/types/internal/optional.h +0 -52
- data/third_party/abseil-cpp/absl/types/internal/span.h +2 -2
- data/third_party/abseil-cpp/absl/types/internal/variant.h +2 -2
- data/third_party/abseil-cpp/absl/types/optional.h +15 -13
- data/third_party/abseil-cpp/absl/types/span.h +1 -2
- data/third_party/boringssl-with-bazel/err_data.c +554 -553
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strex.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +11 -4
- data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +10 -6
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +7 -4
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +9 -7
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/bio/errno.c +92 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +7 -50
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +23 -22
- data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +16 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +11 -2
- data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +31 -22
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +29 -26
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +189 -13
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +31 -192
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_fuchsia.c +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_linux.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_freebsd.c → cpu_aarch64_openbsd.c} +23 -24
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_sysreg.c +93 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_freebsd.c +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +55 -50
- data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm.c → curve25519/curve25519_64_adx.c} +4 -24
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2834 -7442
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +26 -8
- data/third_party/boringssl-with-bazel/src/crypto/dh_extra/dh_asn1.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/dh_extra/params.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +42 -34
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +17 -11
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +23 -21
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/check.c +37 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +41 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +9 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +204 -428
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +31 -64
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +105 -143
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +19 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +16 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +27 -30
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +23 -26
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +21 -37
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +31 -31
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +16 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +11 -5
- data/third_party/boringssl-with-bazel/src/crypto/{hkdf → fipsmodule/hkdf}/hkdf.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +2 -10
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +115 -133
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +12 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +57 -47
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +1 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/polyval.c +27 -28
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -41
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +76 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.c +5 -288
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +143 -83
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +126 -233
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +113 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/service_indicator.c +4 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c +33 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +169 -6
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +216 -87
- data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +23 -15
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +25 -46
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +6 -13
- data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +18 -14
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
- data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +52 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/trusty.c +38 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
- data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +77 -0
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_crypt.c +568 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +152 -72
- data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +230 -60
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +35 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +580 -120
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +27 -18
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +8 -19
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +0 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +17 -39
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +39 -48
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -141
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.c +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +72 -23
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +22 -29
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +33 -46
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +3 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +16 -49
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -26
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +17 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +5 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
- data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +11 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +37 -112
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +11 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +28 -11
- data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +14 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +34 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +2 -11
- data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +91 -62
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +26 -19
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +275 -96
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +236 -213
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +201 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -25
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +8 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +758 -603
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +45 -12
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +11 -6
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +10 -68
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +24 -16
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +69 -29
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +37 -18
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +209 -209
- data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +4 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +46 -155
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +209 -33
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +17 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +27 -19
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +5 -21
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -2
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_msvc.h +1281 -0
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64_msvc.h +2002 -0
- data/third_party/cares/cares/include/ares.h +23 -1
- data/third_party/cares/cares/{src/lib → include}/ares_nameser.h +9 -7
- data/third_party/cares/cares/include/ares_rules.h +2 -2
- data/third_party/cares/cares/include/ares_version.h +3 -3
- data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +266 -0
- data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +240 -0
- data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +49 -80
- data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +37 -43
- data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +12 -4
- data/third_party/cares/cares/src/lib/ares_data.c +16 -0
- data/third_party/cares/cares/src/lib/ares_data.h +7 -0
- data/third_party/cares/cares/src/lib/ares_destroy.c +8 -0
- data/third_party/cares/cares/src/lib/ares_expand_name.c +17 -6
- data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +1 -0
- data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +156 -78
- data/third_party/cares/cares/src/lib/ares_gethostbyname.c +130 -326
- data/third_party/cares/cares/src/lib/ares_init.c +97 -485
- data/third_party/cares/cares/src/lib/ares_library_init.c +2 -89
- data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +23 -142
- data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +22 -142
- data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +184 -0
- data/third_party/cares/cares/src/lib/ares_private.h +30 -16
- data/third_party/cares/cares/src/lib/ares_process.c +55 -16
- data/third_party/cares/cares/src/lib/ares_query.c +1 -35
- data/third_party/cares/cares/src/lib/ares_rand.c +279 -0
- data/third_party/cares/cares/src/lib/ares_send.c +5 -7
- data/third_party/cares/cares/src/lib/ares_strdup.c +12 -19
- data/third_party/cares/cares/src/lib/ares_strsplit.c +44 -128
- data/third_party/cares/cares/src/lib/ares_strsplit.h +9 -10
- data/third_party/cares/cares/src/lib/inet_net_pton.c +78 -116
- data/third_party/cares/cares/src/tools/ares_getopt.h +53 -0
- data/third_party/upb/upb/collections/map.c +3 -3
- metadata +106 -45
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +0 -175
- data/src/core/ext/filters/client_channel/health/health_check_client.h +0 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
- data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
- data/src/core/lib/promise/detail/basic_join.h +0 -197
- data/src/core/lib/promise/detail/switch.h +0 -1455
- data/src/core/lib/promise/try_join.h +0 -82
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +0 -403
- data/third_party/boringssl-with-bazel/src/crypto/refcount_lock.c +0 -52
- data/third_party/cares/cares/src/lib/ares_library_init.h +0 -43
- data/third_party/re2/util/benchmark.h +0 -156
- data/third_party/re2/util/flags.h +0 -26
- data/third_party/re2/util/malloc_counter.h +0 -19
- data/third_party/re2/util/pcre.cc +0 -1025
- data/third_party/re2/util/pcre.h +0 -681
- data/third_party/re2/util/test.h +0 -50
- data/third_party/upb/upb/mini_table.h +0 -36
- data/third_party/zlib/gzclose.c +0 -25
- data/third_party/zlib/gzlib.c +0 -639
- data/third_party/zlib/gzread.c +0 -650
- data/third_party/zlib/gzwrite.c +0 -677
@@ -62,6 +62,8 @@
|
|
62
62
|
// pseudo-struct:
|
63
63
|
//
|
64
64
|
// struct BackingArray {
|
65
|
+
// // The number of elements we can insert before growing the capacity.
|
66
|
+
// size_t growth_left;
|
65
67
|
// // Control bytes for the "real" slots.
|
66
68
|
// ctrl_t ctrl[capacity];
|
67
69
|
// // Always `ctrl_t::kSentinel`. This is used by iterators to find when to
|
@@ -115,7 +117,7 @@
|
|
115
117
|
// starting with that index and extract potential candidates: occupied slots
|
116
118
|
// with a control byte equal to `H2(hash(x))`. If we find an empty slot in the
|
117
119
|
// group, we stop and return an error. Each candidate slot `y` is compared with
|
118
|
-
// `x`; if `x == y`, we are done and return `&y`; otherwise we
|
120
|
+
// `x`; if `x == y`, we are done and return `&y`; otherwise we continue to the
|
119
121
|
// next probe index. Tombstones effectively behave like full slots that never
|
120
122
|
// match the value we're looking for.
|
121
123
|
//
|
@@ -174,21 +176,23 @@
|
|
174
176
|
|
175
177
|
#include <algorithm>
|
176
178
|
#include <cmath>
|
179
|
+
#include <cstddef>
|
177
180
|
#include <cstdint>
|
178
181
|
#include <cstring>
|
179
182
|
#include <iterator>
|
180
183
|
#include <limits>
|
181
184
|
#include <memory>
|
185
|
+
#include <string>
|
182
186
|
#include <tuple>
|
183
187
|
#include <type_traits>
|
184
188
|
#include <utility>
|
185
189
|
|
186
190
|
#include "absl/base/config.h"
|
187
191
|
#include "absl/base/internal/endian.h"
|
188
|
-
#include "absl/base/internal/prefetch.h"
|
189
192
|
#include "absl/base/internal/raw_logging.h"
|
190
193
|
#include "absl/base/optimization.h"
|
191
194
|
#include "absl/base/port.h"
|
195
|
+
#include "absl/base/prefetch.h"
|
192
196
|
#include "absl/container/internal/common.h"
|
193
197
|
#include "absl/container/internal/compressed_tuple.h"
|
194
198
|
#include "absl/container/internal/container_memory.h"
|
@@ -235,6 +239,14 @@ namespace container_internal {
|
|
235
239
|
// We use uint8_t so we don't need to worry about padding.
|
236
240
|
using GenerationType = uint8_t;
|
237
241
|
|
242
|
+
// A sentinel value for empty generations. Using 0 makes it easy to constexpr
|
243
|
+
// initialize an array of this value.
|
244
|
+
constexpr GenerationType SentinelEmptyGeneration() { return 0; }
|
245
|
+
|
246
|
+
constexpr GenerationType NextGeneration(GenerationType generation) {
|
247
|
+
return ++generation == SentinelEmptyGeneration() ? ++generation : generation;
|
248
|
+
}
|
249
|
+
|
238
250
|
#ifdef ABSL_SWISSTABLE_ENABLE_GENERATIONS
|
239
251
|
constexpr bool SwisstableGenerationsEnabled() { return true; }
|
240
252
|
constexpr size_t NumGenerationBytes() { return sizeof(GenerationType); }
|
@@ -367,12 +379,12 @@ class NonIterableBitMask {
|
|
367
379
|
return static_cast<uint32_t>((bit_width(mask_) - 1) >> Shift);
|
368
380
|
}
|
369
381
|
|
370
|
-
//
|
382
|
+
// Returns the number of trailing zero *abstract* bits.
|
371
383
|
uint32_t TrailingZeros() const {
|
372
384
|
return container_internal::TrailingZeros(mask_) >> Shift;
|
373
385
|
}
|
374
386
|
|
375
|
-
//
|
387
|
+
// Returns the number of leading zero *abstract* bits.
|
376
388
|
uint32_t LeadingZeros() const {
|
377
389
|
constexpr int total_significant_bits = SignificantBits << Shift;
|
378
390
|
constexpr int extra_bits = sizeof(T) * 8 - total_significant_bits;
|
@@ -475,19 +487,23 @@ static_assert(ctrl_t::kDeleted == static_cast<ctrl_t>(-2),
|
|
475
487
|
"ctrl_t::kDeleted must be -2 to make the implementation of "
|
476
488
|
"ConvertSpecialToEmptyAndFullToDeleted efficient");
|
477
489
|
|
478
|
-
|
490
|
+
// See definition comment for why this is size 32.
|
491
|
+
ABSL_DLL extern const ctrl_t kEmptyGroup[32];
|
479
492
|
|
480
493
|
// Returns a pointer to a control byte group that can be used by empty tables.
|
481
494
|
inline ctrl_t* EmptyGroup() {
|
482
495
|
// Const must be cast away here; no uses of this function will actually write
|
483
496
|
// to it, because it is only used for empty tables.
|
484
|
-
return const_cast<ctrl_t*>(kEmptyGroup);
|
497
|
+
return const_cast<ctrl_t*>(kEmptyGroup + 16);
|
485
498
|
}
|
486
499
|
|
487
|
-
// Returns a pointer to
|
488
|
-
|
489
|
-
|
490
|
-
|
500
|
+
// Returns a pointer to a generation to use for an empty hashtable.
|
501
|
+
GenerationType* EmptyGeneration();
|
502
|
+
|
503
|
+
// Returns whether `generation` is a generation for an empty hashtable that
|
504
|
+
// could be returned by EmptyGeneration().
|
505
|
+
inline bool IsEmptyGeneration(const GenerationType* generation) {
|
506
|
+
return *generation == SentinelEmptyGeneration();
|
491
507
|
}
|
492
508
|
|
493
509
|
// Mixes a randomly generated per-process seed with `hash` and `ctrl` to
|
@@ -674,9 +690,10 @@ struct GroupAArch64Impl {
|
|
674
690
|
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
|
675
691
|
uint64_t mask = vget_lane_u64(vreinterpret_u64_u8(ctrl), 0);
|
676
692
|
constexpr uint64_t msbs = 0x8080808080808080ULL;
|
677
|
-
constexpr uint64_t
|
678
|
-
|
679
|
-
auto
|
693
|
+
constexpr uint64_t slsbs = 0x0202020202020202ULL;
|
694
|
+
constexpr uint64_t midbs = 0x7e7e7e7e7e7e7e7eULL;
|
695
|
+
auto x = slsbs & (mask >> 6);
|
696
|
+
auto res = (x + midbs) | msbs;
|
680
697
|
little_endian::Store64(dst, res);
|
681
698
|
}
|
682
699
|
|
@@ -749,6 +766,15 @@ using Group = GroupAArch64Impl;
|
|
749
766
|
using Group = GroupPortableImpl;
|
750
767
|
#endif
|
751
768
|
|
769
|
+
// When there is an insertion with no reserved growth, we rehash with
|
770
|
+
// probability `min(1, RehashProbabilityConstant() / capacity())`. Using a
|
771
|
+
// constant divided by capacity ensures that inserting N elements is still O(N)
|
772
|
+
// in the average case. Using the constant 16 means that we expect to rehash ~8
|
773
|
+
// times more often than when generations are disabled. We are adding expected
|
774
|
+
// rehash_probability * #insertions/capacity_growth = 16/capacity * ((7/8 -
|
775
|
+
// 7/16) * capacity)/capacity_growth = ~7 extra rehashes per capacity growth.
|
776
|
+
inline size_t RehashProbabilityConstant() { return 16; }
|
777
|
+
|
752
778
|
class CommonFieldsGenerationInfoEnabled {
|
753
779
|
// A sentinel value for reserved_growth_ indicating that we just ran out of
|
754
780
|
// reserved growth on the last insertion. When reserve is called and then
|
@@ -760,8 +786,11 @@ class CommonFieldsGenerationInfoEnabled {
|
|
760
786
|
public:
|
761
787
|
CommonFieldsGenerationInfoEnabled() = default;
|
762
788
|
CommonFieldsGenerationInfoEnabled(CommonFieldsGenerationInfoEnabled&& that)
|
763
|
-
: reserved_growth_(that.reserved_growth_),
|
789
|
+
: reserved_growth_(that.reserved_growth_),
|
790
|
+
reservation_size_(that.reservation_size_),
|
791
|
+
generation_(that.generation_) {
|
764
792
|
that.reserved_growth_ = 0;
|
793
|
+
that.reservation_size_ = 0;
|
765
794
|
that.generation_ = EmptyGeneration();
|
766
795
|
}
|
767
796
|
CommonFieldsGenerationInfoEnabled& operator=(
|
@@ -769,19 +798,17 @@ class CommonFieldsGenerationInfoEnabled {
|
|
769
798
|
|
770
799
|
// Whether we should rehash on insert in order to detect bugs of using invalid
|
771
800
|
// references. We rehash on the first insertion after reserved_growth_ reaches
|
772
|
-
// 0 after a call to reserve.
|
773
|
-
// TODO(b/254649633): we could potentially do a rehash with low probability
|
801
|
+
// 0 after a call to reserve. We also do a rehash with low probability
|
774
802
|
// whenever reserved_growth_ is zero.
|
775
|
-
bool should_rehash_for_bug_detection_on_insert(
|
776
|
-
|
777
|
-
}
|
803
|
+
bool should_rehash_for_bug_detection_on_insert(const ctrl_t* ctrl,
|
804
|
+
size_t capacity) const;
|
778
805
|
void maybe_increment_generation_on_insert() {
|
779
806
|
if (reserved_growth_ == kReservedGrowthJustRanOut) reserved_growth_ = 0;
|
780
807
|
|
781
808
|
if (reserved_growth_ > 0) {
|
782
809
|
if (--reserved_growth_ == 0) reserved_growth_ = kReservedGrowthJustRanOut;
|
783
810
|
} else {
|
784
|
-
|
811
|
+
*generation_ = NextGeneration(*generation_);
|
785
812
|
}
|
786
813
|
}
|
787
814
|
void reset_reserved_growth(size_t reservation, size_t size) {
|
@@ -789,6 +816,8 @@ class CommonFieldsGenerationInfoEnabled {
|
|
789
816
|
}
|
790
817
|
size_t reserved_growth() const { return reserved_growth_; }
|
791
818
|
void set_reserved_growth(size_t r) { reserved_growth_ = r; }
|
819
|
+
size_t reservation_size() const { return reservation_size_; }
|
820
|
+
void set_reservation_size(size_t r) { reservation_size_ = r; }
|
792
821
|
GenerationType generation() const { return *generation_; }
|
793
822
|
void set_generation(GenerationType g) { *generation_ = g; }
|
794
823
|
GenerationType* generation_ptr() const { return generation_; }
|
@@ -796,10 +825,14 @@ class CommonFieldsGenerationInfoEnabled {
|
|
796
825
|
|
797
826
|
private:
|
798
827
|
// The number of insertions remaining that are guaranteed to not rehash due to
|
799
|
-
// a prior call to reserve. Note: we store reserved growth
|
828
|
+
// a prior call to reserve. Note: we store reserved growth in addition to
|
800
829
|
// reservation size because calls to erase() decrease size_ but don't decrease
|
801
830
|
// reserved growth.
|
802
831
|
size_t reserved_growth_ = 0;
|
832
|
+
// The maximum argument to reserve() since the container was cleared. We need
|
833
|
+
// to keep track of this, in addition to reserved growth, because we reset
|
834
|
+
// reserved growth to this when erase(begin(), end()) is called.
|
835
|
+
size_t reservation_size_ = 0;
|
803
836
|
// Pointer to the generation counter, which is used to validate iterators and
|
804
837
|
// is stored in the backing array between the control bytes and the slots.
|
805
838
|
// Note that we can't store the generation inside the container itself and
|
@@ -820,11 +853,15 @@ class CommonFieldsGenerationInfoDisabled {
|
|
820
853
|
CommonFieldsGenerationInfoDisabled& operator=(
|
821
854
|
CommonFieldsGenerationInfoDisabled&&) = default;
|
822
855
|
|
823
|
-
bool should_rehash_for_bug_detection_on_insert() const {
|
856
|
+
bool should_rehash_for_bug_detection_on_insert(const ctrl_t*, size_t) const {
|
857
|
+
return false;
|
858
|
+
}
|
824
859
|
void maybe_increment_generation_on_insert() {}
|
825
860
|
void reset_reserved_growth(size_t, size_t) {}
|
826
861
|
size_t reserved_growth() const { return 0; }
|
827
862
|
void set_reserved_growth(size_t) {}
|
863
|
+
size_t reservation_size() const { return 0; }
|
864
|
+
void set_reservation_size(size_t) {}
|
828
865
|
GenerationType generation() const { return 0; }
|
829
866
|
void set_generation(GenerationType) {}
|
830
867
|
GenerationType* generation_ptr() const { return nullptr; }
|
@@ -867,6 +904,44 @@ using CommonFieldsGenerationInfo = CommonFieldsGenerationInfoDisabled;
|
|
867
904
|
using HashSetIteratorGenerationInfo = HashSetIteratorGenerationInfoDisabled;
|
868
905
|
#endif
|
869
906
|
|
907
|
+
// Returns whether `n` is a valid capacity (i.e., number of slots).
|
908
|
+
//
|
909
|
+
// A valid capacity is a non-zero integer `2^m - 1`.
|
910
|
+
inline bool IsValidCapacity(size_t n) { return ((n + 1) & n) == 0 && n > 0; }
|
911
|
+
|
912
|
+
// Computes the offset from the start of the backing allocation of the control
|
913
|
+
// bytes. growth_left is stored at the beginning of the backing array.
|
914
|
+
inline size_t ControlOffset() { return sizeof(size_t); }
|
915
|
+
|
916
|
+
// Returns the number of "cloned control bytes".
|
917
|
+
//
|
918
|
+
// This is the number of control bytes that are present both at the beginning
|
919
|
+
// of the control byte array and at the end, such that we can create a
|
920
|
+
// `Group::kWidth`-width probe window starting from any control byte.
|
921
|
+
constexpr size_t NumClonedBytes() { return Group::kWidth - 1; }
|
922
|
+
|
923
|
+
// Given the capacity of a table, computes the offset (from the start of the
|
924
|
+
// backing allocation) of the generation counter (if it exists).
|
925
|
+
inline size_t GenerationOffset(size_t capacity) {
|
926
|
+
assert(IsValidCapacity(capacity));
|
927
|
+
const size_t num_control_bytes = capacity + 1 + NumClonedBytes();
|
928
|
+
return ControlOffset() + num_control_bytes;
|
929
|
+
}
|
930
|
+
|
931
|
+
// Given the capacity of a table, computes the offset (from the start of the
|
932
|
+
// backing allocation) at which the slots begin.
|
933
|
+
inline size_t SlotOffset(size_t capacity, size_t slot_align) {
|
934
|
+
assert(IsValidCapacity(capacity));
|
935
|
+
return (GenerationOffset(capacity) + NumGenerationBytes() + slot_align - 1) &
|
936
|
+
(~slot_align + 1);
|
937
|
+
}
|
938
|
+
|
939
|
+
// Given the capacity of a table, computes the total size of the backing
|
940
|
+
// array.
|
941
|
+
inline size_t AllocSize(size_t capacity, size_t slot_size, size_t slot_align) {
|
942
|
+
return SlotOffset(capacity, slot_align) + capacity * slot_size;
|
943
|
+
}
|
944
|
+
|
870
945
|
// CommonFields hold the fields in raw_hash_set that do not depend
|
871
946
|
// on template parameters. This allows us to conveniently pass all
|
872
947
|
// of this state to helper functions as a single argument.
|
@@ -884,72 +959,102 @@ class CommonFields : public CommonFieldsGenerationInfo {
|
|
884
959
|
std::move(static_cast<CommonFieldsGenerationInfo&&>(that))),
|
885
960
|
// Explicitly copying fields into "this" and then resetting "that"
|
886
961
|
// fields generates less code then calling absl::exchange per field.
|
887
|
-
control_(that.
|
888
|
-
slots_(that.
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
that.
|
893
|
-
that.
|
894
|
-
that.
|
895
|
-
that.capacity_ = 0;
|
896
|
-
that.growth_left() = 0;
|
962
|
+
control_(that.control()),
|
963
|
+
slots_(that.slot_array()),
|
964
|
+
capacity_(that.capacity()),
|
965
|
+
compressed_tuple_(that.size(), std::move(that.infoz())) {
|
966
|
+
that.set_control(EmptyGroup());
|
967
|
+
that.set_slots(nullptr);
|
968
|
+
that.set_capacity(0);
|
969
|
+
that.set_size(0);
|
897
970
|
}
|
898
971
|
CommonFields& operator=(CommonFields&&) = default;
|
899
972
|
|
973
|
+
ctrl_t* control() const { return control_; }
|
974
|
+
void set_control(ctrl_t* c) { control_ = c; }
|
975
|
+
void* backing_array_start() const {
|
976
|
+
// growth_left is stored before control bytes.
|
977
|
+
assert(reinterpret_cast<uintptr_t>(control()) % alignof(size_t) == 0);
|
978
|
+
return control() - sizeof(size_t);
|
979
|
+
}
|
980
|
+
|
981
|
+
// Note: we can't use slots() because Qt defines "slots" as a macro.
|
982
|
+
void* slot_array() const { return slots_; }
|
983
|
+
void set_slots(void* s) { slots_ = s; }
|
984
|
+
|
985
|
+
// The number of filled slots.
|
986
|
+
size_t size() const { return compressed_tuple_.template get<0>(); }
|
987
|
+
void set_size(size_t s) { compressed_tuple_.template get<0>() = s; }
|
988
|
+
|
989
|
+
// The total number of available slots.
|
990
|
+
size_t capacity() const { return capacity_; }
|
991
|
+
void set_capacity(size_t c) {
|
992
|
+
assert(c == 0 || IsValidCapacity(c));
|
993
|
+
capacity_ = c;
|
994
|
+
}
|
995
|
+
|
900
996
|
// The number of slots we can still fill without needing to rehash.
|
901
|
-
|
997
|
+
// This is stored in the heap allocation before the control bytes.
|
998
|
+
size_t growth_left() const {
|
999
|
+
return *reinterpret_cast<size_t*>(backing_array_start());
|
1000
|
+
}
|
1001
|
+
void set_growth_left(size_t gl) {
|
1002
|
+
*reinterpret_cast<size_t*>(backing_array_start()) = gl;
|
1003
|
+
}
|
902
1004
|
|
903
1005
|
HashtablezInfoHandle& infoz() { return compressed_tuple_.template get<1>(); }
|
904
1006
|
const HashtablezInfoHandle& infoz() const {
|
905
1007
|
return compressed_tuple_.template get<1>();
|
906
1008
|
}
|
907
1009
|
|
1010
|
+
bool should_rehash_for_bug_detection_on_insert() const {
|
1011
|
+
return CommonFieldsGenerationInfo::
|
1012
|
+
should_rehash_for_bug_detection_on_insert(control(), capacity());
|
1013
|
+
}
|
908
1014
|
void reset_reserved_growth(size_t reservation) {
|
909
|
-
CommonFieldsGenerationInfo::reset_reserved_growth(reservation,
|
1015
|
+
CommonFieldsGenerationInfo::reset_reserved_growth(reservation, size());
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
// The size of the backing array allocation.
|
1019
|
+
size_t alloc_size(size_t slot_size, size_t slot_align) const {
|
1020
|
+
return AllocSize(capacity(), slot_size, slot_align);
|
910
1021
|
}
|
911
1022
|
|
1023
|
+
// Returns the number of control bytes set to kDeleted. For testing only.
|
1024
|
+
size_t TombstonesCount() const {
|
1025
|
+
return static_cast<size_t>(
|
1026
|
+
std::count(control(), control() + capacity(), ctrl_t::kDeleted));
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
private:
|
912
1030
|
// TODO(b/259599413): Investigate removing some of these fields:
|
913
1031
|
// - control/slots can be derived from each other
|
914
|
-
// -
|
1032
|
+
// - we can use 6 bits for capacity since it's always a power of two minus 1
|
915
1033
|
|
916
|
-
// The control bytes (and, also, a pointer to the base of the backing
|
1034
|
+
// The control bytes (and, also, a pointer near to the base of the backing
|
1035
|
+
// array).
|
917
1036
|
//
|
918
1037
|
// This contains `capacity + 1 + NumClonedBytes()` entries, even
|
919
1038
|
// when the table is empty (hence EmptyGroup).
|
1039
|
+
//
|
1040
|
+
// Note that growth_left is stored immediately before this pointer.
|
920
1041
|
ctrl_t* control_ = EmptyGroup();
|
921
1042
|
|
922
1043
|
// The beginning of the slots, located at `SlotOffset()` bytes after
|
923
1044
|
// `control`. May be null for empty tables.
|
924
1045
|
void* slots_ = nullptr;
|
925
1046
|
|
926
|
-
// The number of filled slots.
|
927
|
-
size_t size_ = 0;
|
928
|
-
|
929
|
-
// The total number of available slots.
|
930
1047
|
size_t capacity_ = 0;
|
931
1048
|
|
932
|
-
// Bundle together
|
1049
|
+
// Bundle together size and HashtablezInfoHandle to ensure EBO for
|
933
1050
|
// HashtablezInfoHandle when sampling is turned off.
|
934
1051
|
absl::container_internal::CompressedTuple<size_t, HashtablezInfoHandle>
|
935
1052
|
compressed_tuple_{0u, HashtablezInfoHandle{}};
|
936
1053
|
};
|
937
1054
|
|
938
|
-
// Returns he number of "cloned control bytes".
|
939
|
-
//
|
940
|
-
// This is the number of control bytes that are present both at the beginning
|
941
|
-
// of the control byte array and at the end, such that we can create a
|
942
|
-
// `Group::kWidth`-width probe window starting from any control byte.
|
943
|
-
constexpr size_t NumClonedBytes() { return Group::kWidth - 1; }
|
944
|
-
|
945
1055
|
template <class Policy, class Hash, class Eq, class Alloc>
|
946
1056
|
class raw_hash_set;
|
947
1057
|
|
948
|
-
// Returns whether `n` is a valid capacity (i.e., number of slots).
|
949
|
-
//
|
950
|
-
// A valid capacity is a non-zero integer `2^m - 1`.
|
951
|
-
inline bool IsValidCapacity(size_t n) { return ((n + 1) & n) == 0 && n > 0; }
|
952
|
-
|
953
1058
|
// Returns the next valid capacity after `n`.
|
954
1059
|
inline size_t NextCapacity(size_t n) {
|
955
1060
|
assert(IsValidCapacity(n) || n == 0);
|
@@ -1021,34 +1126,75 @@ size_t SelectBucketCountForIterRange(InputIter first, InputIter last,
|
|
1021
1126
|
return 0;
|
1022
1127
|
}
|
1023
1128
|
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1129
|
+
constexpr bool SwisstableDebugEnabled() {
|
1130
|
+
#if defined(ABSL_SWISSTABLE_ENABLE_GENERATIONS) || \
|
1131
|
+
ABSL_OPTION_HARDENED == 1 || !defined(NDEBUG)
|
1132
|
+
return true;
|
1133
|
+
#else
|
1134
|
+
return false;
|
1135
|
+
#endif
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
inline void AssertIsFull(const ctrl_t* ctrl, GenerationType generation,
|
1139
|
+
const GenerationType* generation_ptr,
|
1140
|
+
const char* operation) {
|
1141
|
+
if (!SwisstableDebugEnabled()) return;
|
1142
|
+
if (ctrl == nullptr) {
|
1143
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1144
|
+
std::string(operation) + " called on end() iterator.");
|
1145
|
+
}
|
1146
|
+
if (ctrl == EmptyGroup()) {
|
1147
|
+
ABSL_INTERNAL_LOG(FATAL, std::string(operation) +
|
1148
|
+
" called on default-constructed iterator.");
|
1149
|
+
}
|
1150
|
+
if (SwisstableGenerationsEnabled()) {
|
1151
|
+
if (generation != *generation_ptr) {
|
1152
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1153
|
+
std::string(operation) +
|
1154
|
+
" called on invalid iterator. The table could have "
|
1155
|
+
"rehashed since this iterator was initialized.");
|
1156
|
+
}
|
1157
|
+
if (!IsFull(*ctrl)) {
|
1158
|
+
ABSL_INTERNAL_LOG(
|
1159
|
+
FATAL,
|
1160
|
+
std::string(operation) +
|
1161
|
+
" called on invalid iterator. The element was likely erased.");
|
1162
|
+
}
|
1163
|
+
} else {
|
1164
|
+
if (!IsFull(*ctrl)) {
|
1165
|
+
ABSL_INTERNAL_LOG(
|
1166
|
+
FATAL,
|
1167
|
+
std::string(operation) +
|
1168
|
+
" called on invalid iterator. The element might have been erased "
|
1169
|
+
"or the table might have rehashed. Consider running with "
|
1170
|
+
"--config=asan to diagnose rehashing issues.");
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
}
|
1040
1174
|
|
1041
1175
|
// Note that for comparisons, null/end iterators are valid.
|
1042
1176
|
inline void AssertIsValidForComparison(const ctrl_t* ctrl,
|
1043
1177
|
GenerationType generation,
|
1044
1178
|
const GenerationType* generation_ptr) {
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
if (SwisstableGenerationsEnabled()
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1179
|
+
if (!SwisstableDebugEnabled()) return;
|
1180
|
+
const bool ctrl_is_valid_for_comparison =
|
1181
|
+
ctrl == nullptr || ctrl == EmptyGroup() || IsFull(*ctrl);
|
1182
|
+
if (SwisstableGenerationsEnabled()) {
|
1183
|
+
if (generation != *generation_ptr) {
|
1184
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1185
|
+
"Invalid iterator comparison. The table could have "
|
1186
|
+
"rehashed since this iterator was initialized.");
|
1187
|
+
}
|
1188
|
+
if (!ctrl_is_valid_for_comparison) {
|
1189
|
+
ABSL_INTERNAL_LOG(
|
1190
|
+
FATAL, "Invalid iterator comparison. The element was likely erased.");
|
1191
|
+
}
|
1192
|
+
} else {
|
1193
|
+
ABSL_HARDENING_ASSERT(
|
1194
|
+
ctrl_is_valid_for_comparison &&
|
1195
|
+
"Invalid iterator comparison. The element might have been erased or "
|
1196
|
+
"the table might have rehashed. Consider running with --config=asan to "
|
1197
|
+
"diagnose rehashing issues.");
|
1052
1198
|
}
|
1053
1199
|
}
|
1054
1200
|
|
@@ -1074,16 +1220,54 @@ inline bool AreItersFromSameContainer(const ctrl_t* ctrl_a,
|
|
1074
1220
|
// Asserts that two iterators come from the same container.
|
1075
1221
|
// Note: we take slots by reference so that it's not UB if they're uninitialized
|
1076
1222
|
// as long as we don't read them (when ctrl is null).
|
1077
|
-
// TODO(b/254649633): when generations are enabled, we can detect more cases of
|
1078
|
-
// different containers by comparing the pointers to the generations - this
|
1079
|
-
// can cover cases of end iterators that we would otherwise miss.
|
1080
1223
|
inline void AssertSameContainer(const ctrl_t* ctrl_a, const ctrl_t* ctrl_b,
|
1081
1224
|
const void* const& slot_a,
|
1082
|
-
const void* const& slot_b
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1225
|
+
const void* const& slot_b,
|
1226
|
+
const GenerationType* generation_ptr_a,
|
1227
|
+
const GenerationType* generation_ptr_b) {
|
1228
|
+
if (!SwisstableDebugEnabled()) return;
|
1229
|
+
const bool a_is_default = ctrl_a == EmptyGroup();
|
1230
|
+
const bool b_is_default = ctrl_b == EmptyGroup();
|
1231
|
+
if (a_is_default != b_is_default) {
|
1232
|
+
ABSL_INTERNAL_LOG(
|
1233
|
+
FATAL,
|
1234
|
+
"Invalid iterator comparison. Comparing default-constructed iterator "
|
1235
|
+
"with non-default-constructed iterator.");
|
1236
|
+
}
|
1237
|
+
if (a_is_default && b_is_default) return;
|
1238
|
+
|
1239
|
+
if (SwisstableGenerationsEnabled()) {
|
1240
|
+
if (generation_ptr_a == generation_ptr_b) return;
|
1241
|
+
const bool a_is_empty = IsEmptyGeneration(generation_ptr_a);
|
1242
|
+
const bool b_is_empty = IsEmptyGeneration(generation_ptr_b);
|
1243
|
+
if (a_is_empty != b_is_empty) {
|
1244
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1245
|
+
"Invalid iterator comparison. Comparing iterator from "
|
1246
|
+
"a non-empty hashtable with an iterator from an empty "
|
1247
|
+
"hashtable.");
|
1248
|
+
}
|
1249
|
+
if (a_is_empty && b_is_empty) {
|
1250
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1251
|
+
"Invalid iterator comparison. Comparing iterators from "
|
1252
|
+
"different empty hashtables.");
|
1253
|
+
}
|
1254
|
+
const bool a_is_end = ctrl_a == nullptr;
|
1255
|
+
const bool b_is_end = ctrl_b == nullptr;
|
1256
|
+
if (a_is_end || b_is_end) {
|
1257
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1258
|
+
"Invalid iterator comparison. Comparing iterator with "
|
1259
|
+
"an end() iterator from a different hashtable.");
|
1260
|
+
}
|
1261
|
+
ABSL_INTERNAL_LOG(FATAL,
|
1262
|
+
"Invalid iterator comparison. Comparing non-end() "
|
1263
|
+
"iterators from different hashtables.");
|
1264
|
+
} else {
|
1265
|
+
ABSL_HARDENING_ASSERT(
|
1266
|
+
AreItersFromSameContainer(ctrl_a, ctrl_b, slot_a, slot_b) &&
|
1267
|
+
"Invalid iterator comparison. The iterators may be from different "
|
1268
|
+
"containers or the container might have rehashed. Consider running "
|
1269
|
+
"with --config=asan to diagnose rehashing issues.");
|
1270
|
+
}
|
1087
1271
|
}
|
1088
1272
|
|
1089
1273
|
struct FindInfo {
|
@@ -1106,11 +1290,13 @@ struct FindInfo {
|
|
1106
1290
|
inline bool is_small(size_t capacity) { return capacity < Group::kWidth - 1; }
|
1107
1291
|
|
1108
1292
|
// Begins a probing operation on `common.control`, using `hash`.
|
1109
|
-
inline probe_seq<Group::kWidth> probe(const
|
1110
|
-
|
1111
|
-
const size_t capacity = common.capacity_;
|
1293
|
+
inline probe_seq<Group::kWidth> probe(const ctrl_t* ctrl, const size_t capacity,
|
1294
|
+
size_t hash) {
|
1112
1295
|
return probe_seq<Group::kWidth>(H1(hash, ctrl), capacity);
|
1113
1296
|
}
|
1297
|
+
inline probe_seq<Group::kWidth> probe(const CommonFields& common, size_t hash) {
|
1298
|
+
return probe(common.control(), common.capacity(), hash);
|
1299
|
+
}
|
1114
1300
|
|
1115
1301
|
// Probes an array of control bits using a probe sequence derived from `hash`,
|
1116
1302
|
// and returns the offset corresponding to the first deleted or empty slot.
|
@@ -1122,7 +1308,7 @@ inline probe_seq<Group::kWidth> probe(const CommonFields& common, size_t hash) {
|
|
1122
1308
|
template <typename = void>
|
1123
1309
|
inline FindInfo find_first_non_full(const CommonFields& common, size_t hash) {
|
1124
1310
|
auto seq = probe(common, hash);
|
1125
|
-
const ctrl_t* ctrl = common.
|
1311
|
+
const ctrl_t* ctrl = common.control();
|
1126
1312
|
while (true) {
|
1127
1313
|
Group g{ctrl + seq.offset()};
|
1128
1314
|
auto mask = g.MaskEmptyOrDeleted();
|
@@ -1132,14 +1318,14 @@ inline FindInfo find_first_non_full(const CommonFields& common, size_t hash) {
|
|
1132
1318
|
// In debug build we will randomly insert in either the front or back of
|
1133
1319
|
// the group.
|
1134
1320
|
// TODO(kfm,sbenza): revisit after we do unconditional mixing
|
1135
|
-
if (!is_small(common.
|
1321
|
+
if (!is_small(common.capacity()) && ShouldInsertBackwards(hash, ctrl)) {
|
1136
1322
|
return {seq.offset(mask.HighestBitSet()), seq.index()};
|
1137
1323
|
}
|
1138
1324
|
#endif
|
1139
1325
|
return {seq.offset(mask.LowestBitSet()), seq.index()};
|
1140
1326
|
}
|
1141
1327
|
seq.next();
|
1142
|
-
assert(seq.index() <= common.
|
1328
|
+
assert(seq.index() <= common.capacity() && "full table!");
|
1143
1329
|
}
|
1144
1330
|
}
|
1145
1331
|
|
@@ -1153,18 +1339,18 @@ extern template FindInfo find_first_non_full(const CommonFields&, size_t);
|
|
1153
1339
|
FindInfo find_first_non_full_outofline(const CommonFields&, size_t);
|
1154
1340
|
|
1155
1341
|
inline void ResetGrowthLeft(CommonFields& common) {
|
1156
|
-
common.
|
1342
|
+
common.set_growth_left(CapacityToGrowth(common.capacity()) - common.size());
|
1157
1343
|
}
|
1158
1344
|
|
1159
1345
|
// Sets `ctrl` to `{kEmpty, kSentinel, ..., kEmpty}`, marking the entire
|
1160
1346
|
// array as marked as empty.
|
1161
1347
|
inline void ResetCtrl(CommonFields& common, size_t slot_size) {
|
1162
|
-
const size_t capacity = common.
|
1163
|
-
ctrl_t* ctrl = common.
|
1348
|
+
const size_t capacity = common.capacity();
|
1349
|
+
ctrl_t* ctrl = common.control();
|
1164
1350
|
std::memset(ctrl, static_cast<int8_t>(ctrl_t::kEmpty),
|
1165
1351
|
capacity + 1 + NumClonedBytes());
|
1166
1352
|
ctrl[capacity] = ctrl_t::kSentinel;
|
1167
|
-
SanitizerPoisonMemoryRegion(common.
|
1353
|
+
SanitizerPoisonMemoryRegion(common.slot_array(), slot_size * capacity);
|
1168
1354
|
ResetGrowthLeft(common);
|
1169
1355
|
}
|
1170
1356
|
|
@@ -1174,17 +1360,17 @@ inline void ResetCtrl(CommonFields& common, size_t slot_size) {
|
|
1174
1360
|
// mirror the value to the cloned tail if necessary.
|
1175
1361
|
inline void SetCtrl(const CommonFields& common, size_t i, ctrl_t h,
|
1176
1362
|
size_t slot_size) {
|
1177
|
-
const size_t capacity = common.
|
1363
|
+
const size_t capacity = common.capacity();
|
1178
1364
|
assert(i < capacity);
|
1179
1365
|
|
1180
|
-
auto* slot_i = static_cast<const char*>(common.
|
1366
|
+
auto* slot_i = static_cast<const char*>(common.slot_array()) + i * slot_size;
|
1181
1367
|
if (IsFull(h)) {
|
1182
1368
|
SanitizerUnpoisonMemoryRegion(slot_i, slot_size);
|
1183
1369
|
} else {
|
1184
1370
|
SanitizerPoisonMemoryRegion(slot_i, slot_size);
|
1185
1371
|
}
|
1186
1372
|
|
1187
|
-
ctrl_t* ctrl = common.
|
1373
|
+
ctrl_t* ctrl = common.control();
|
1188
1374
|
ctrl[i] = h;
|
1189
1375
|
ctrl[((i - NumClonedBytes()) & capacity) + (NumClonedBytes() & capacity)] = h;
|
1190
1376
|
}
|
@@ -1195,56 +1381,41 @@ inline void SetCtrl(const CommonFields& common, size_t i, h2_t h,
|
|
1195
1381
|
SetCtrl(common, i, static_cast<ctrl_t>(h), slot_size);
|
1196
1382
|
}
|
1197
1383
|
|
1198
|
-
//
|
1199
|
-
|
1200
|
-
|
1201
|
-
assert(IsValidCapacity(capacity));
|
1202
|
-
const size_t num_control_bytes = capacity + 1 + NumClonedBytes();
|
1203
|
-
return num_control_bytes;
|
1204
|
-
}
|
1205
|
-
|
1206
|
-
// Given the capacity of a table, computes the offset (from the start of the
|
1207
|
-
// backing allocation) at which the slots begin.
|
1208
|
-
inline size_t SlotOffset(size_t capacity, size_t slot_align) {
|
1209
|
-
assert(IsValidCapacity(capacity));
|
1210
|
-
const size_t num_control_bytes = capacity + 1 + NumClonedBytes();
|
1211
|
-
return (num_control_bytes + NumGenerationBytes() + slot_align - 1) &
|
1212
|
-
(~slot_align + 1);
|
1213
|
-
}
|
1214
|
-
|
1215
|
-
// Given the capacity of a table, computes the total size of the backing
|
1216
|
-
// array.
|
1217
|
-
inline size_t AllocSize(size_t capacity, size_t slot_size, size_t slot_align) {
|
1218
|
-
return SlotOffset(capacity, slot_align) + capacity * slot_size;
|
1384
|
+
// growth_left (which is a size_t) is stored with the backing array.
|
1385
|
+
constexpr size_t BackingArrayAlignment(size_t align_of_slot) {
|
1386
|
+
return (std::max)(align_of_slot, alignof(size_t));
|
1219
1387
|
}
|
1220
1388
|
|
1221
1389
|
template <typename Alloc, size_t SizeOfSlot, size_t AlignOfSlot>
|
1222
1390
|
ABSL_ATTRIBUTE_NOINLINE void InitializeSlots(CommonFields& c, Alloc alloc) {
|
1223
|
-
assert(c.
|
1391
|
+
assert(c.capacity());
|
1224
1392
|
// Folks with custom allocators often make unwarranted assumptions about the
|
1225
1393
|
// behavior of their classes vis-a-vis trivial destructability and what
|
1226
1394
|
// calls they will or won't make. Avoid sampling for people with custom
|
1227
1395
|
// allocators to get us out of this mess. This is not a hard guarantee but
|
1228
1396
|
// a workaround while we plan the exact guarantee we want to provide.
|
1229
1397
|
const size_t sample_size =
|
1230
|
-
(std::is_same<Alloc, std::allocator<char>>::value &&
|
1398
|
+
(std::is_same<Alloc, std::allocator<char>>::value &&
|
1399
|
+
c.slot_array() == nullptr)
|
1231
1400
|
? SizeOfSlot
|
1232
1401
|
: 0;
|
1233
1402
|
|
1234
|
-
const size_t cap = c.
|
1403
|
+
const size_t cap = c.capacity();
|
1404
|
+
const size_t alloc_size = AllocSize(cap, SizeOfSlot, AlignOfSlot);
|
1405
|
+
// growth_left (which is a size_t) is stored with the backing array.
|
1235
1406
|
char* mem = static_cast<char*>(
|
1236
|
-
Allocate<AlignOfSlot>(&alloc,
|
1407
|
+
Allocate<BackingArrayAlignment(AlignOfSlot)>(&alloc, alloc_size));
|
1237
1408
|
const GenerationType old_generation = c.generation();
|
1238
1409
|
c.set_generation_ptr(
|
1239
1410
|
reinterpret_cast<GenerationType*>(mem + GenerationOffset(cap)));
|
1240
|
-
c.set_generation(old_generation
|
1241
|
-
c.
|
1242
|
-
c.
|
1411
|
+
c.set_generation(NextGeneration(old_generation));
|
1412
|
+
c.set_control(reinterpret_cast<ctrl_t*>(mem + ControlOffset()));
|
1413
|
+
c.set_slots(mem + SlotOffset(cap, AlignOfSlot));
|
1243
1414
|
ResetCtrl(c, SizeOfSlot);
|
1244
1415
|
if (sample_size) {
|
1245
1416
|
c.infoz() = Sample(sample_size);
|
1246
1417
|
}
|
1247
|
-
c.infoz().RecordStorageChanged(c.
|
1418
|
+
c.infoz().RecordStorageChanged(c.size(), cap);
|
1248
1419
|
}
|
1249
1420
|
|
1250
1421
|
// PolicyFunctions bundles together some information for a particular
|
@@ -1254,15 +1425,14 @@ ABSL_ATTRIBUTE_NOINLINE void InitializeSlots(CommonFields& c, Alloc alloc) {
|
|
1254
1425
|
struct PolicyFunctions {
|
1255
1426
|
size_t slot_size;
|
1256
1427
|
|
1257
|
-
//
|
1428
|
+
// Returns the hash of the pointed-to slot.
|
1258
1429
|
size_t (*hash_slot)(void* set, void* slot);
|
1259
1430
|
|
1260
1431
|
// Transfer the contents of src_slot to dst_slot.
|
1261
1432
|
void (*transfer)(void* set, void* dst_slot, void* src_slot);
|
1262
1433
|
|
1263
|
-
// Deallocate the
|
1264
|
-
void (*dealloc)(
|
1265
|
-
void* slot_array, size_t n);
|
1434
|
+
// Deallocate the backing store from common.
|
1435
|
+
void (*dealloc)(CommonFields& common, const PolicyFunctions& policy);
|
1266
1436
|
};
|
1267
1437
|
|
1268
1438
|
// ClearBackingArray clears the backing array, either modifying it in place,
|
@@ -1279,16 +1449,16 @@ void EraseMetaOnly(CommonFields& c, ctrl_t* it, size_t slot_size);
|
|
1279
1449
|
// function body for raw_hash_set instantiations that have the
|
1280
1450
|
// same slot alignment.
|
1281
1451
|
template <size_t AlignOfSlot>
|
1282
|
-
ABSL_ATTRIBUTE_NOINLINE void DeallocateStandard(
|
1283
|
-
const PolicyFunctions& policy
|
1284
|
-
ctrl_t* ctrl, void* slot_array,
|
1285
|
-
size_t n) {
|
1452
|
+
ABSL_ATTRIBUTE_NOINLINE void DeallocateStandard(CommonFields& common,
|
1453
|
+
const PolicyFunctions& policy) {
|
1286
1454
|
// Unpoison before returning the memory to the allocator.
|
1287
|
-
SanitizerUnpoisonMemoryRegion(slot_array,
|
1455
|
+
SanitizerUnpoisonMemoryRegion(common.slot_array(),
|
1456
|
+
policy.slot_size * common.capacity());
|
1288
1457
|
|
1289
1458
|
std::allocator<char> alloc;
|
1290
|
-
Deallocate<AlignOfSlot>(
|
1291
|
-
|
1459
|
+
Deallocate<BackingArrayAlignment(AlignOfSlot)>(
|
1460
|
+
&alloc, common.backing_array_start(),
|
1461
|
+
common.alloc_size(policy.slot_size, AlignOfSlot));
|
1292
1462
|
}
|
1293
1463
|
|
1294
1464
|
// For trivially relocatable types we use memcpy directly. This allows us to
|
@@ -1419,22 +1589,19 @@ class raw_hash_set {
|
|
1419
1589
|
|
1420
1590
|
// PRECONDITION: not an end() iterator.
|
1421
1591
|
reference operator*() const {
|
1422
|
-
|
1423
|
-
"operator*()");
|
1592
|
+
AssertIsFull(ctrl_, generation(), generation_ptr(), "operator*()");
|
1424
1593
|
return PolicyTraits::element(slot_);
|
1425
1594
|
}
|
1426
1595
|
|
1427
1596
|
// PRECONDITION: not an end() iterator.
|
1428
1597
|
pointer operator->() const {
|
1429
|
-
|
1430
|
-
"operator->");
|
1598
|
+
AssertIsFull(ctrl_, generation(), generation_ptr(), "operator->");
|
1431
1599
|
return &operator*();
|
1432
1600
|
}
|
1433
1601
|
|
1434
1602
|
// PRECONDITION: not an end() iterator.
|
1435
1603
|
iterator& operator++() {
|
1436
|
-
|
1437
|
-
"operator++");
|
1604
|
+
AssertIsFull(ctrl_, generation(), generation_ptr(), "operator++");
|
1438
1605
|
++ctrl_;
|
1439
1606
|
++slot_;
|
1440
1607
|
skip_empty_or_deleted();
|
@@ -1448,9 +1615,10 @@ class raw_hash_set {
|
|
1448
1615
|
}
|
1449
1616
|
|
1450
1617
|
friend bool operator==(const iterator& a, const iterator& b) {
|
1451
|
-
AssertSameContainer(a.ctrl_, b.ctrl_, a.slot_, b.slot_);
|
1452
1618
|
AssertIsValidForComparison(a.ctrl_, a.generation(), a.generation_ptr());
|
1453
1619
|
AssertIsValidForComparison(b.ctrl_, b.generation(), b.generation_ptr());
|
1620
|
+
AssertSameContainer(a.ctrl_, b.ctrl_, a.slot_, b.slot_,
|
1621
|
+
a.generation_ptr(), b.generation_ptr());
|
1454
1622
|
return a.ctrl_ == b.ctrl_;
|
1455
1623
|
}
|
1456
1624
|
friend bool operator!=(const iterator& a, const iterator& b) {
|
@@ -1469,7 +1637,7 @@ class raw_hash_set {
|
|
1469
1637
|
}
|
1470
1638
|
// For end() iterators.
|
1471
1639
|
explicit iterator(const GenerationType* generation_ptr)
|
1472
|
-
: HashSetIteratorGenerationInfo(generation_ptr) {}
|
1640
|
+
: HashSetIteratorGenerationInfo(generation_ptr), ctrl_(nullptr) {}
|
1473
1641
|
|
1474
1642
|
// Fixes up `ctrl_` to point to a full by advancing it and `slot_` until
|
1475
1643
|
// they reach one.
|
@@ -1484,7 +1652,9 @@ class raw_hash_set {
|
|
1484
1652
|
if (ABSL_PREDICT_FALSE(*ctrl_ == ctrl_t::kSentinel)) ctrl_ = nullptr;
|
1485
1653
|
}
|
1486
1654
|
|
1487
|
-
|
1655
|
+
// We use EmptyGroup() for default-constructed iterators so that they can
|
1656
|
+
// be distinguished from end iterators, which have nullptr ctrl_.
|
1657
|
+
ctrl_t* ctrl_ = EmptyGroup();
|
1488
1658
|
// To avoid uninitialized member warnings, put slot_ in an anonymous union.
|
1489
1659
|
// The member is not initialized on singleton and end iterators.
|
1490
1660
|
union {
|
@@ -1537,9 +1707,9 @@ class raw_hash_set {
|
|
1537
1707
|
// Note: can't use `= default` due to non-default noexcept (causes
|
1538
1708
|
// problems for some compilers). NOLINTNEXTLINE
|
1539
1709
|
raw_hash_set() noexcept(
|
1540
|
-
std::is_nothrow_default_constructible<hasher>::value&&
|
1541
|
-
|
1542
|
-
|
1710
|
+
std::is_nothrow_default_constructible<hasher>::value &&
|
1711
|
+
std::is_nothrow_default_constructible<key_equal>::value &&
|
1712
|
+
std::is_nothrow_default_constructible<allocator_type>::value) {}
|
1543
1713
|
|
1544
1714
|
ABSL_ATTRIBUTE_NOINLINE explicit raw_hash_set(
|
1545
1715
|
size_t bucket_count, const hasher& hash = hasher(),
|
@@ -1547,7 +1717,7 @@ class raw_hash_set {
|
|
1547
1717
|
const allocator_type& alloc = allocator_type())
|
1548
1718
|
: settings_(CommonFields{}, hash, eq, alloc) {
|
1549
1719
|
if (bucket_count) {
|
1550
|
-
common().
|
1720
|
+
common().set_capacity(NormalizeCapacity(bucket_count));
|
1551
1721
|
initialize_slots();
|
1552
1722
|
}
|
1553
1723
|
}
|
@@ -1649,7 +1819,9 @@ class raw_hash_set {
|
|
1649
1819
|
|
1650
1820
|
raw_hash_set(const raw_hash_set& that, const allocator_type& a)
|
1651
1821
|
: raw_hash_set(0, that.hash_ref(), that.eq_ref(), a) {
|
1652
|
-
|
1822
|
+
const size_t size = that.size();
|
1823
|
+
if (size == 0) return;
|
1824
|
+
reserve(size);
|
1653
1825
|
// Because the table is guaranteed to be empty, we can do something faster
|
1654
1826
|
// than a full `insert`.
|
1655
1827
|
for (const auto& v : that) {
|
@@ -1660,14 +1832,14 @@ class raw_hash_set {
|
|
1660
1832
|
common().maybe_increment_generation_on_insert();
|
1661
1833
|
infoz().RecordInsert(hash, target.probe_length);
|
1662
1834
|
}
|
1663
|
-
common().
|
1664
|
-
growth_left()
|
1835
|
+
common().set_size(size);
|
1836
|
+
set_growth_left(growth_left() - size);
|
1665
1837
|
}
|
1666
1838
|
|
1667
1839
|
ABSL_ATTRIBUTE_NOINLINE raw_hash_set(raw_hash_set&& that) noexcept(
|
1668
|
-
std::is_nothrow_copy_constructible<hasher>::value&&
|
1669
|
-
|
1670
|
-
|
1840
|
+
std::is_nothrow_copy_constructible<hasher>::value &&
|
1841
|
+
std::is_nothrow_copy_constructible<key_equal>::value &&
|
1842
|
+
std::is_nothrow_copy_constructible<allocator_type>::value)
|
1671
1843
|
: // Hash, equality and allocator are copied instead of moved because
|
1672
1844
|
// `that` must be left valid. If Hash is std::function<Key>, moving it
|
1673
1845
|
// would create a nullptr functor that cannot be called.
|
@@ -1696,9 +1868,9 @@ class raw_hash_set {
|
|
1696
1868
|
}
|
1697
1869
|
|
1698
1870
|
raw_hash_set& operator=(raw_hash_set&& that) noexcept(
|
1699
|
-
absl::allocator_traits<allocator_type>::is_always_equal::value&&
|
1700
|
-
|
1701
|
-
|
1871
|
+
absl::allocator_traits<allocator_type>::is_always_equal::value &&
|
1872
|
+
std::is_nothrow_move_assignable<hasher>::value &&
|
1873
|
+
std::is_nothrow_move_assignable<key_equal>::value) {
|
1702
1874
|
// TODO(sbenza): We should only use the operations from the noexcept clause
|
1703
1875
|
// to make sure we actually adhere to that contract.
|
1704
1876
|
// NOLINTNEXTLINE: not returning *this for performance.
|
@@ -1714,30 +1886,36 @@ class raw_hash_set {
|
|
1714
1886
|
|
1715
1887
|
// Unpoison before returning the memory to the allocator.
|
1716
1888
|
SanitizerUnpoisonMemoryRegion(slot_array(), sizeof(slot_type) * cap);
|
1717
|
-
Deallocate<alignof(slot_type)>(
|
1718
|
-
&alloc_ref(),
|
1889
|
+
Deallocate<BackingArrayAlignment(alignof(slot_type))>(
|
1890
|
+
&alloc_ref(), common().backing_array_start(),
|
1719
1891
|
AllocSize(cap, sizeof(slot_type), alignof(slot_type)));
|
1720
1892
|
|
1721
1893
|
infoz().Unregister();
|
1722
1894
|
}
|
1723
1895
|
|
1724
|
-
iterator begin() {
|
1896
|
+
iterator begin() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1725
1897
|
auto it = iterator_at(0);
|
1726
1898
|
it.skip_empty_or_deleted();
|
1727
1899
|
return it;
|
1728
1900
|
}
|
1729
|
-
iterator end() {
|
1901
|
+
iterator end() ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1902
|
+
return iterator(common().generation_ptr());
|
1903
|
+
}
|
1730
1904
|
|
1731
|
-
const_iterator begin() const {
|
1905
|
+
const_iterator begin() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1732
1906
|
return const_cast<raw_hash_set*>(this)->begin();
|
1733
1907
|
}
|
1734
|
-
const_iterator end() const {
|
1735
|
-
|
1736
|
-
|
1908
|
+
const_iterator end() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1909
|
+
return iterator(common().generation_ptr());
|
1910
|
+
}
|
1911
|
+
const_iterator cbegin() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1912
|
+
return begin();
|
1913
|
+
}
|
1914
|
+
const_iterator cend() const ABSL_ATTRIBUTE_LIFETIME_BOUND { return end(); }
|
1737
1915
|
|
1738
1916
|
bool empty() const { return !size(); }
|
1739
|
-
size_t size() const { return common().
|
1740
|
-
size_t capacity() const { return common().
|
1917
|
+
size_t size() const { return common().size(); }
|
1918
|
+
size_t capacity() const { return common().capacity(); }
|
1741
1919
|
size_t max_size() const { return (std::numeric_limits<size_t>::max)(); }
|
1742
1920
|
|
1743
1921
|
ABSL_ATTRIBUTE_REINITIALIZES void clear() {
|
@@ -1753,10 +1931,10 @@ class raw_hash_set {
|
|
1753
1931
|
// Already guaranteed to be empty; so nothing to do.
|
1754
1932
|
} else {
|
1755
1933
|
destroy_slots();
|
1756
|
-
ClearBackingArray(common(), GetPolicyFunctions(),
|
1757
|
-
/*reuse=*/cap < 128);
|
1934
|
+
ClearBackingArray(common(), GetPolicyFunctions(), /*reuse=*/cap < 128);
|
1758
1935
|
}
|
1759
1936
|
common().set_reserved_growth(0);
|
1937
|
+
common().set_reservation_size(0);
|
1760
1938
|
}
|
1761
1939
|
|
1762
1940
|
inline void destroy_slots() {
|
@@ -1780,7 +1958,7 @@ class raw_hash_set {
|
|
1780
1958
|
template <class T, RequiresInsertable<T> = 0, class T2 = T,
|
1781
1959
|
typename std::enable_if<IsDecomposable<T2>::value, int>::type = 0,
|
1782
1960
|
T* = nullptr>
|
1783
|
-
std::pair<iterator, bool> insert(T&& value) {
|
1961
|
+
std::pair<iterator, bool> insert(T&& value) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1784
1962
|
return emplace(std::forward<T>(value));
|
1785
1963
|
}
|
1786
1964
|
|
@@ -1795,13 +1973,11 @@ class raw_hash_set {
|
|
1795
1973
|
// const char* p = "hello";
|
1796
1974
|
// s.insert(p);
|
1797
1975
|
//
|
1798
|
-
// TODO(romanp): Once we stop supporting gcc 5.1 and below, replace
|
1799
|
-
// RequiresInsertable<T> with RequiresInsertable<const T&>.
|
1800
|
-
// We are hitting this bug: https://godbolt.org/g/1Vht4f.
|
1801
1976
|
template <
|
1802
|
-
class T, RequiresInsertable<T
|
1977
|
+
class T, RequiresInsertable<const T&> = 0,
|
1803
1978
|
typename std::enable_if<IsDecomposable<const T&>::value, int>::type = 0>
|
1804
|
-
std::pair<iterator, bool> insert(const T& value)
|
1979
|
+
std::pair<iterator, bool> insert(const T& value)
|
1980
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1805
1981
|
return emplace(value);
|
1806
1982
|
}
|
1807
1983
|
|
@@ -1810,7 +1986,8 @@ class raw_hash_set {
|
|
1810
1986
|
//
|
1811
1987
|
// flat_hash_map<std::string, int> s;
|
1812
1988
|
// s.insert({"abc", 42});
|
1813
|
-
std::pair<iterator, bool> insert(init_type&& value)
|
1989
|
+
std::pair<iterator, bool> insert(init_type&& value)
|
1990
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1814
1991
|
return emplace(std::move(value));
|
1815
1992
|
}
|
1816
1993
|
|
@@ -1819,21 +1996,20 @@ class raw_hash_set {
|
|
1819
1996
|
template <class T, RequiresInsertable<T> = 0, class T2 = T,
|
1820
1997
|
typename std::enable_if<IsDecomposable<T2>::value, int>::type = 0,
|
1821
1998
|
T* = nullptr>
|
1822
|
-
iterator insert(const_iterator, T&& value) {
|
1999
|
+
iterator insert(const_iterator, T&& value) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1823
2000
|
return insert(std::forward<T>(value)).first;
|
1824
2001
|
}
|
1825
2002
|
|
1826
|
-
// TODO(romanp): Once we stop supporting gcc 5.1 and below, replace
|
1827
|
-
// RequiresInsertable<T> with RequiresInsertable<const T&>.
|
1828
|
-
// We are hitting this bug: https://godbolt.org/g/1Vht4f.
|
1829
2003
|
template <
|
1830
|
-
class T, RequiresInsertable<T
|
2004
|
+
class T, RequiresInsertable<const T&> = 0,
|
1831
2005
|
typename std::enable_if<IsDecomposable<const T&>::value, int>::type = 0>
|
1832
|
-
iterator insert(const_iterator,
|
2006
|
+
iterator insert(const_iterator,
|
2007
|
+
const T& value) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1833
2008
|
return insert(value).first;
|
1834
2009
|
}
|
1835
2010
|
|
1836
|
-
iterator insert(const_iterator,
|
2011
|
+
iterator insert(const_iterator,
|
2012
|
+
init_type&& value) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1837
2013
|
return insert(std::move(value)).first;
|
1838
2014
|
}
|
1839
2015
|
|
@@ -1851,7 +2027,7 @@ class raw_hash_set {
|
|
1851
2027
|
insert(ilist.begin(), ilist.end());
|
1852
2028
|
}
|
1853
2029
|
|
1854
|
-
insert_return_type insert(node_type&& node) {
|
2030
|
+
insert_return_type insert(node_type&& node) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1855
2031
|
if (!node) return {end(), false, node_type()};
|
1856
2032
|
const auto& elem = PolicyTraits::element(CommonAccess::GetSlot(node));
|
1857
2033
|
auto res = PolicyTraits::apply(
|
@@ -1865,7 +2041,8 @@ class raw_hash_set {
|
|
1865
2041
|
}
|
1866
2042
|
}
|
1867
2043
|
|
1868
|
-
iterator insert(const_iterator,
|
2044
|
+
iterator insert(const_iterator,
|
2045
|
+
node_type&& node) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1869
2046
|
auto res = insert(std::move(node));
|
1870
2047
|
node = std::move(res.node);
|
1871
2048
|
return res.position;
|
@@ -1882,7 +2059,8 @@ class raw_hash_set {
|
|
1882
2059
|
// m.emplace("abc", "xyz");
|
1883
2060
|
template <class... Args, typename std::enable_if<
|
1884
2061
|
IsDecomposable<Args...>::value, int>::type = 0>
|
1885
|
-
std::pair<iterator, bool> emplace(Args&&... args)
|
2062
|
+
std::pair<iterator, bool> emplace(Args&&... args)
|
2063
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1886
2064
|
return PolicyTraits::apply(EmplaceDecomposable{*this},
|
1887
2065
|
std::forward<Args>(args)...);
|
1888
2066
|
}
|
@@ -1892,7 +2070,8 @@ class raw_hash_set {
|
|
1892
2070
|
// destroys.
|
1893
2071
|
template <class... Args, typename std::enable_if<
|
1894
2072
|
!IsDecomposable<Args...>::value, int>::type = 0>
|
1895
|
-
std::pair<iterator, bool> emplace(Args&&... args)
|
2073
|
+
std::pair<iterator, bool> emplace(Args&&... args)
|
2074
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1896
2075
|
alignas(slot_type) unsigned char raw[sizeof(slot_type)];
|
1897
2076
|
slot_type* slot = reinterpret_cast<slot_type*>(&raw);
|
1898
2077
|
|
@@ -1902,14 +2081,16 @@ class raw_hash_set {
|
|
1902
2081
|
}
|
1903
2082
|
|
1904
2083
|
template <class... Args>
|
1905
|
-
iterator emplace_hint(const_iterator,
|
2084
|
+
iterator emplace_hint(const_iterator,
|
2085
|
+
Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1906
2086
|
return emplace(std::forward<Args>(args)...).first;
|
1907
2087
|
}
|
1908
2088
|
|
1909
2089
|
// Extension API: support for lazy emplace.
|
1910
2090
|
//
|
1911
2091
|
// Looks up key in the table. If found, returns the iterator to the element.
|
1912
|
-
// Otherwise calls `f` with one argument of type `raw_hash_set::constructor
|
2092
|
+
// Otherwise calls `f` with one argument of type `raw_hash_set::constructor`,
|
2093
|
+
// and returns an iterator to the new element.
|
1913
2094
|
//
|
1914
2095
|
// `f` must abide by several restrictions:
|
1915
2096
|
// - it MUST call `raw_hash_set::constructor` with arguments as if a
|
@@ -1952,7 +2133,8 @@ class raw_hash_set {
|
|
1952
2133
|
};
|
1953
2134
|
|
1954
2135
|
template <class K = key_type, class F>
|
1955
|
-
iterator lazy_emplace(const key_arg<K>& key,
|
2136
|
+
iterator lazy_emplace(const key_arg<K>& key,
|
2137
|
+
F&& f) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
1956
2138
|
auto res = find_or_prepare_insert(key);
|
1957
2139
|
if (res.second) {
|
1958
2140
|
slot_type* slot = slot_array() + res.first;
|
@@ -1997,13 +2179,25 @@ class raw_hash_set {
|
|
1997
2179
|
// This overload is necessary because otherwise erase<K>(const K&) would be
|
1998
2180
|
// a better match if non-const iterator is passed as an argument.
|
1999
2181
|
void erase(iterator it) {
|
2000
|
-
|
2001
|
-
"erase()");
|
2182
|
+
AssertIsFull(it.ctrl_, it.generation(), it.generation_ptr(), "erase()");
|
2002
2183
|
PolicyTraits::destroy(&alloc_ref(), it.slot_);
|
2003
2184
|
erase_meta_only(it);
|
2004
2185
|
}
|
2005
2186
|
|
2006
|
-
iterator erase(const_iterator first,
|
2187
|
+
iterator erase(const_iterator first,
|
2188
|
+
const_iterator last) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2189
|
+
// We check for empty first because ClearBackingArray requires that
|
2190
|
+
// capacity() > 0 as a precondition.
|
2191
|
+
if (empty()) return end();
|
2192
|
+
if (first == begin() && last == end()) {
|
2193
|
+
// TODO(ezb): we access control bytes in destroy_slots so it could make
|
2194
|
+
// sense to combine destroy_slots and ClearBackingArray to avoid cache
|
2195
|
+
// misses when the table is large. Note that we also do this in clear().
|
2196
|
+
destroy_slots();
|
2197
|
+
ClearBackingArray(common(), GetPolicyFunctions(), /*reuse=*/true);
|
2198
|
+
common().set_reserved_growth(common().reservation_size());
|
2199
|
+
return end();
|
2200
|
+
}
|
2007
2201
|
while (first != last) {
|
2008
2202
|
erase(first++);
|
2009
2203
|
}
|
@@ -2032,9 +2226,8 @@ class raw_hash_set {
|
|
2032
2226
|
}
|
2033
2227
|
|
2034
2228
|
node_type extract(const_iterator position) {
|
2035
|
-
|
2036
|
-
|
2037
|
-
position.inner_.generation_ptr(), "extract()");
|
2229
|
+
AssertIsFull(position.inner_.ctrl_, position.inner_.generation(),
|
2230
|
+
position.inner_.generation_ptr(), "extract()");
|
2038
2231
|
auto node =
|
2039
2232
|
CommonAccess::Transfer<node_type>(alloc_ref(), position.inner_.slot_);
|
2040
2233
|
erase_meta_only(position);
|
@@ -2064,8 +2257,7 @@ class raw_hash_set {
|
|
2064
2257
|
void rehash(size_t n) {
|
2065
2258
|
if (n == 0 && capacity() == 0) return;
|
2066
2259
|
if (n == 0 && size() == 0) {
|
2067
|
-
ClearBackingArray(common(), GetPolicyFunctions(),
|
2068
|
-
/*reuse=*/false);
|
2260
|
+
ClearBackingArray(common(), GetPolicyFunctions(), /*reuse=*/false);
|
2069
2261
|
return;
|
2070
2262
|
}
|
2071
2263
|
|
@@ -2092,6 +2284,7 @@ class raw_hash_set {
|
|
2092
2284
|
infoz().RecordReservation(n);
|
2093
2285
|
}
|
2094
2286
|
common().reset_reserved_growth(n);
|
2287
|
+
common().set_reservation_size(n);
|
2095
2288
|
}
|
2096
2289
|
|
2097
2290
|
// Extension API: support for heterogeneous keys.
|
@@ -2117,12 +2310,12 @@ class raw_hash_set {
|
|
2117
2310
|
void prefetch(const key_arg<K>& key) const {
|
2118
2311
|
(void)key;
|
2119
2312
|
// Avoid probing if we won't be able to prefetch the addresses received.
|
2120
|
-
#ifdef
|
2313
|
+
#ifdef ABSL_HAVE_PREFETCH
|
2121
2314
|
prefetch_heap_block();
|
2122
2315
|
auto seq = probe(common(), hash_ref()(key));
|
2123
|
-
|
2124
|
-
|
2125
|
-
#endif //
|
2316
|
+
PrefetchToLocalCache(control() + seq.offset());
|
2317
|
+
PrefetchToLocalCache(slot_array() + seq.offset());
|
2318
|
+
#endif // ABSL_HAVE_PREFETCH
|
2126
2319
|
}
|
2127
2320
|
|
2128
2321
|
// The API of find() has two extensions.
|
@@ -2133,7 +2326,8 @@ class raw_hash_set {
|
|
2133
2326
|
// 2. The type of the key argument doesn't have to be key_type. This is so
|
2134
2327
|
// called heterogeneous key support.
|
2135
2328
|
template <class K = key_type>
|
2136
|
-
iterator find(const key_arg<K>& key,
|
2329
|
+
iterator find(const key_arg<K>& key,
|
2330
|
+
size_t hash) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2137
2331
|
auto seq = probe(common(), hash);
|
2138
2332
|
slot_type* slot_ptr = slot_array();
|
2139
2333
|
const ctrl_t* ctrl = control();
|
@@ -2151,17 +2345,19 @@ class raw_hash_set {
|
|
2151
2345
|
}
|
2152
2346
|
}
|
2153
2347
|
template <class K = key_type>
|
2154
|
-
iterator find(const key_arg<K>& key) {
|
2348
|
+
iterator find(const key_arg<K>& key) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2155
2349
|
prefetch_heap_block();
|
2156
2350
|
return find(key, hash_ref()(key));
|
2157
2351
|
}
|
2158
2352
|
|
2159
2353
|
template <class K = key_type>
|
2160
|
-
const_iterator find(const key_arg<K>& key,
|
2354
|
+
const_iterator find(const key_arg<K>& key,
|
2355
|
+
size_t hash) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2161
2356
|
return const_cast<raw_hash_set*>(this)->find(key, hash);
|
2162
2357
|
}
|
2163
2358
|
template <class K = key_type>
|
2164
|
-
const_iterator find(const key_arg<K>& key) const
|
2359
|
+
const_iterator find(const key_arg<K>& key) const
|
2360
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2165
2361
|
prefetch_heap_block();
|
2166
2362
|
return find(key, hash_ref()(key));
|
2167
2363
|
}
|
@@ -2172,14 +2368,15 @@ class raw_hash_set {
|
|
2172
2368
|
}
|
2173
2369
|
|
2174
2370
|
template <class K = key_type>
|
2175
|
-
std::pair<iterator, iterator> equal_range(const key_arg<K>& key)
|
2371
|
+
std::pair<iterator, iterator> equal_range(const key_arg<K>& key)
|
2372
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2176
2373
|
auto it = find(key);
|
2177
2374
|
if (it != end()) return {it, std::next(it)};
|
2178
2375
|
return {it, it};
|
2179
2376
|
}
|
2180
2377
|
template <class K = key_type>
|
2181
2378
|
std::pair<const_iterator, const_iterator> equal_range(
|
2182
|
-
const key_arg<K>& key) const {
|
2379
|
+
const key_arg<K>& key) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2183
2380
|
auto it = find(key);
|
2184
2381
|
if (it != end()) return {it, std::next(it)};
|
2185
2382
|
return {it, it};
|
@@ -2313,8 +2510,8 @@ class raw_hash_set {
|
|
2313
2510
|
assert(IsValidCapacity(new_capacity));
|
2314
2511
|
auto* old_ctrl = control();
|
2315
2512
|
auto* old_slots = slot_array();
|
2316
|
-
const size_t old_capacity = common().
|
2317
|
-
common().
|
2513
|
+
const size_t old_capacity = common().capacity();
|
2514
|
+
common().set_capacity(new_capacity);
|
2318
2515
|
initialize_slots();
|
2319
2516
|
|
2320
2517
|
auto* new_slots = slot_array();
|
@@ -2333,8 +2530,8 @@ class raw_hash_set {
|
|
2333
2530
|
if (old_capacity) {
|
2334
2531
|
SanitizerUnpoisonMemoryRegion(old_slots,
|
2335
2532
|
sizeof(slot_type) * old_capacity);
|
2336
|
-
Deallocate<alignof(slot_type)>(
|
2337
|
-
&alloc_ref(), old_ctrl,
|
2533
|
+
Deallocate<BackingArrayAlignment(alignof(slot_type))>(
|
2534
|
+
&alloc_ref(), old_ctrl - ControlOffset(),
|
2338
2535
|
AllocSize(old_capacity, sizeof(slot_type), alignof(slot_type)));
|
2339
2536
|
}
|
2340
2537
|
infoz().RecordRehash(total_probe_length);
|
@@ -2357,8 +2554,8 @@ class raw_hash_set {
|
|
2357
2554
|
void rehash_and_grow_if_necessary() {
|
2358
2555
|
const size_t cap = capacity();
|
2359
2556
|
if (cap > Group::kWidth &&
|
2360
|
-
// Do these
|
2361
|
-
size() * uint64_t{32} <= cap* uint64_t{25}) {
|
2557
|
+
// Do these calculations in 64-bit to avoid overflow.
|
2558
|
+
size() * uint64_t{32} <= cap * uint64_t{25}) {
|
2362
2559
|
// Squash DELETED without growing if there is enough capacity.
|
2363
2560
|
//
|
2364
2561
|
// Rehash in place if the current size is <= 25/32 of capacity.
|
@@ -2481,8 +2678,8 @@ class raw_hash_set {
|
|
2481
2678
|
rehash_and_grow_if_necessary();
|
2482
2679
|
target = find_first_non_full(common(), hash);
|
2483
2680
|
}
|
2484
|
-
|
2485
|
-
growth_left()
|
2681
|
+
common().set_size(common().size() + 1);
|
2682
|
+
set_growth_left(growth_left() - IsEmpty(control()[target.offset]));
|
2486
2683
|
SetCtrl(common(), target.offset, H2(hash), sizeof(slot_type));
|
2487
2684
|
common().maybe_increment_generation_on_insert();
|
2488
2685
|
infoz().RecordInsert(hash, target.probe_length);
|
@@ -2507,10 +2704,10 @@ class raw_hash_set {
|
|
2507
2704
|
"constructed value does not match the lookup key");
|
2508
2705
|
}
|
2509
2706
|
|
2510
|
-
iterator iterator_at(size_t i) {
|
2707
|
+
iterator iterator_at(size_t i) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2511
2708
|
return {control() + i, slot_array() + i, common().generation_ptr()};
|
2512
2709
|
}
|
2513
|
-
const_iterator iterator_at(size_t i) const {
|
2710
|
+
const_iterator iterator_at(size_t i) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
2514
2711
|
return {control() + i, slot_array() + i, common().generation_ptr()};
|
2515
2712
|
}
|
2516
2713
|
|
@@ -2527,19 +2724,24 @@ class raw_hash_set {
|
|
2527
2724
|
// side-effect.
|
2528
2725
|
//
|
2529
2726
|
// See `CapacityToGrowth()`.
|
2530
|
-
size_t
|
2531
|
-
|
2532
|
-
|
2533
|
-
//
|
2534
|
-
//
|
2535
|
-
|
2727
|
+
size_t growth_left() const { return common().growth_left(); }
|
2728
|
+
void set_growth_left(size_t gl) { return common().set_growth_left(gl); }
|
2729
|
+
|
2730
|
+
// Prefetch the heap-allocated memory region to resolve potential TLB and
|
2731
|
+
// cache misses. This is intended to overlap with execution of calculating the
|
2732
|
+
// hash for a key.
|
2733
|
+
void prefetch_heap_block() const {
|
2734
|
+
#if ABSL_HAVE_BUILTIN(__builtin_prefetch) || defined(__GNUC__)
|
2735
|
+
__builtin_prefetch(control(), 0, 1);
|
2736
|
+
#endif
|
2737
|
+
}
|
2536
2738
|
|
2537
2739
|
CommonFields& common() { return settings_.template get<0>(); }
|
2538
2740
|
const CommonFields& common() const { return settings_.template get<0>(); }
|
2539
2741
|
|
2540
|
-
ctrl_t* control() const { return common().
|
2742
|
+
ctrl_t* control() const { return common().control(); }
|
2541
2743
|
slot_type* slot_array() const {
|
2542
|
-
return static_cast<slot_type*>(common().
|
2744
|
+
return static_cast<slot_type*>(common().slot_array());
|
2543
2745
|
}
|
2544
2746
|
HashtablezInfoHandle& infoz() { return common().infoz(); }
|
2545
2747
|
|
@@ -2565,16 +2767,16 @@ class raw_hash_set {
|
|
2565
2767
|
static_cast<slot_type*>(src));
|
2566
2768
|
}
|
2567
2769
|
// Note: dealloc_fn will only be used if we have a non-standard allocator.
|
2568
|
-
static void dealloc_fn(
|
2569
|
-
|
2570
|
-
auto* h = static_cast<raw_hash_set*>(set);
|
2770
|
+
static void dealloc_fn(CommonFields& common, const PolicyFunctions&) {
|
2771
|
+
auto* set = reinterpret_cast<raw_hash_set*>(&common);
|
2571
2772
|
|
2572
2773
|
// Unpoison before returning the memory to the allocator.
|
2573
|
-
SanitizerUnpoisonMemoryRegion(
|
2774
|
+
SanitizerUnpoisonMemoryRegion(common.slot_array(),
|
2775
|
+
sizeof(slot_type) * common.capacity());
|
2574
2776
|
|
2575
|
-
Deallocate<alignof(slot_type)>(
|
2576
|
-
&
|
2577
|
-
|
2777
|
+
Deallocate<BackingArrayAlignment(alignof(slot_type))>(
|
2778
|
+
&set->alloc_ref(), common.backing_array_start(),
|
2779
|
+
common.alloc_size(sizeof(slot_type), alignof(slot_type)));
|
2578
2780
|
}
|
2579
2781
|
|
2580
2782
|
static const PolicyFunctions& GetPolicyFunctions() {
|
@@ -2680,6 +2882,5 @@ ABSL_NAMESPACE_END
|
|
2680
2882
|
} // namespace absl
|
2681
2883
|
|
2682
2884
|
#undef ABSL_SWISSTABLE_ENABLE_GENERATIONS
|
2683
|
-
#undef ABSL_INTERNAL_ASSERT_IS_FULL
|
2684
2885
|
|
2685
2886
|
#endif // ABSL_CONTAINER_INTERNAL_RAW_HASH_SET_H_
|