grpc 1.36.0 → 1.38.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +126 -92
- data/include/grpc/event_engine/README.md +38 -0
- data/include/grpc/event_engine/channel_args.h +28 -0
- data/include/grpc/event_engine/event_engine.h +336 -0
- data/include/grpc/event_engine/port.h +39 -0
- data/include/grpc/event_engine/slice_allocator.h +81 -0
- data/include/grpc/grpc.h +15 -1
- data/include/grpc/grpc_security_constants.h +14 -0
- data/include/grpc/impl/codegen/grpc_types.h +11 -0
- data/include/grpc/impl/codegen/port_platform.h +7 -0
- data/include/grpc/module.modulemap +14 -14
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -3
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +177 -202
- data/src/core/ext/filters/client_channel/client_channel.cc +715 -3166
- data/src/core/ext/filters/client_channel/client_channel.h +489 -55
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +4 -1
- data/src/core/ext/filters/client_channel/config_selector.h +9 -1
- data/src/core/ext/filters/client_channel/connector.h +1 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +18 -14
- data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -142
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -10
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +26 -27
- data/src/core/ext/filters/client_channel/health/health_check_client.h +27 -26
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +24 -21
- data/src/core/ext/filters/client_channel/lb_policy.cc +4 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +4 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +6 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +46 -43
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +5 -5
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +14 -12
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +23 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +27 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +4 -4
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +15 -15
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +36 -30
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +29 -44
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +32 -47
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +86 -63
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -4
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
- data/src/core/ext/filters/client_channel/resolver.cc +3 -0
- data/src/core/ext/filters/client_channel/resolver.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +23 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +17 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +38 -33
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +17 -9
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +20 -28
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +7 -5
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +31 -14
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +334 -114
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +32 -239
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +20 -49
- data/src/core/ext/filters/client_channel/retry_filter.cc +2188 -0
- data/src/core/ext/filters/client_channel/retry_filter.h +30 -0
- data/src/core/ext/filters/client_channel/retry_service_config.cc +287 -0
- data/src/core/ext/filters/client_channel/retry_service_config.h +90 -0
- data/src/core/ext/filters/client_channel/server_address.cc +4 -1
- data/src/core/ext/filters/client_channel/service_config.cc +15 -14
- data/src/core/ext/filters/client_channel/service_config.h +7 -6
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +5 -4
- data/src/core/ext/filters/client_channel/service_config_parser.cc +6 -6
- data/src/core/ext/filters/client_channel/service_config_parser.h +7 -4
- data/src/core/ext/filters/client_channel/subchannel.cc +86 -162
- data/src/core/ext/filters/client_channel/subchannel.h +68 -99
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +16 -2
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +10 -8
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +17 -16
- data/src/core/ext/filters/deadline/deadline_filter.cc +10 -10
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +501 -0
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +189 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +28 -21
- data/src/core/ext/filters/http/client_authority_filter.cc +3 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +23 -22
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +21 -21
- data/src/core/ext/filters/http/server/http_server_filter.cc +27 -23
- data/src/core/ext/filters/max_age/max_age_filter.cc +12 -10
- data/src/core/ext/filters/message_size/message_size_filter.cc +14 -11
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +5 -4
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +8 -8
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +7 -7
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +5 -4
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +6 -5
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +485 -199
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +3 -4
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -3
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +167 -122
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -1
- data/src/core/ext/transport/chttp2/transport/context_list.cc +4 -5
- data/src/core/ext/transport/chttp2/transport/context_list.h +4 -4
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +8 -8
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +13 -9
- data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -10
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +6 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +7 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +6 -6
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +6 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +4 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +237 -208
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +10 -10
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +4 -4
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +2 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +32 -27
- data/src/core/ext/transport/chttp2/transport/parsing.cc +63 -56
- data/src/core/ext/transport/chttp2/transport/writing.cc +7 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +30 -29
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1459 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +350 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1348 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +6 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +25 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +488 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +141 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +452 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +15 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +44 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +268 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +78 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +281 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +113 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +6 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +13 -9
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +93 -0
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +323 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +90 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +124 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +33 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +77 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +383 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +115 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +10 -7
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +13 -7
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +120 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +76 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +21 -20
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +130 -0
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +44 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +35 -0
- data/src/core/ext/xds/certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/certificate_provider_store.h +3 -3
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +3 -3
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +2 -2
- data/src/core/ext/xds/xds_api.cc +1649 -329
- data/src/core/ext/xds/xds_api.h +284 -44
- data/src/core/ext/xds/xds_bootstrap.cc +110 -156
- data/src/core/ext/xds/xds_bootstrap.h +24 -25
- data/src/core/ext/xds/xds_certificate_provider.cc +4 -4
- data/src/core/ext/xds/xds_certificate_provider.h +4 -4
- data/src/core/ext/xds/xds_channel_args.h +5 -2
- data/src/core/ext/xds/xds_client.cc +454 -177
- data/src/core/ext/xds/xds_client.h +62 -22
- data/src/core/ext/xds/xds_client_stats.h +5 -4
- data/src/core/ext/xds/xds_http_fault_filter.cc +226 -0
- data/src/core/ext/xds/xds_http_fault_filter.h +63 -0
- data/src/core/ext/xds/xds_http_filters.cc +114 -0
- data/src/core/ext/xds/xds_http_filters.h +130 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +410 -131
- data/src/core/lib/{iomgr → address_utils}/parse_address.cc +17 -17
- data/src/core/lib/{iomgr → address_utils}/parse_address.h +7 -7
- data/src/core/lib/{iomgr → address_utils}/sockaddr_utils.cc +107 -4
- data/src/core/lib/{iomgr → address_utils}/sockaddr_utils.h +26 -6
- data/src/core/lib/channel/channel_stack.cc +22 -9
- data/src/core/lib/channel/channel_stack.h +17 -9
- data/src/core/lib/channel/channel_stack_builder.cc +2 -2
- data/src/core/lib/channel/channel_stack_builder.h +1 -1
- data/src/core/lib/channel/channelz.cc +108 -12
- data/src/core/lib/channel/channelz.h +30 -1
- data/src/core/lib/channel/channelz_registry.cc +14 -0
- data/src/core/lib/channel/connected_channel.cc +4 -4
- data/src/core/lib/channel/handshaker.cc +7 -45
- data/src/core/lib/channel/handshaker.h +5 -22
- data/src/core/lib/channel/status_util.cc +12 -2
- data/src/core/lib/channel/status_util.h +5 -0
- data/src/core/lib/event_engine/slice_allocator.cc +59 -0
- data/src/core/lib/event_engine/sockaddr.cc +38 -0
- data/src/core/lib/gpr/sync_abseil.cc +3 -6
- data/src/core/lib/gpr/sync_windows.cc +2 -2
- data/src/core/lib/gprpp/atomic.h +3 -3
- data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +28 -14
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
- data/src/core/lib/gprpp/status_helper.cc +407 -0
- data/src/core/lib/gprpp/status_helper.h +180 -0
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/http/httpcli.cc +11 -11
- data/src/core/lib/http/httpcli_security_connector.cc +11 -7
- data/src/core/lib/http/parser.cc +16 -16
- data/src/core/lib/http/parser.h +4 -4
- data/src/core/lib/iomgr/buffer_list.cc +7 -9
- data/src/core/lib/iomgr/buffer_list.h +5 -6
- data/src/core/lib/iomgr/call_combiner.cc +15 -12
- data/src/core/lib/iomgr/call_combiner.h +12 -14
- data/src/core/lib/iomgr/cfstream_handle.cc +5 -5
- data/src/core/lib/iomgr/cfstream_handle.h +1 -1
- data/src/core/lib/iomgr/closure.h +7 -6
- data/src/core/lib/iomgr/combiner.cc +14 -12
- data/src/core/lib/iomgr/combiner.h +2 -2
- data/src/core/lib/iomgr/endpoint.cc +1 -1
- data/src/core/lib/iomgr/endpoint.h +2 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +11 -13
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +1 -1
- data/src/core/lib/iomgr/error.cc +167 -61
- data/src/core/lib/iomgr/error.h +218 -107
- data/src/core/lib/iomgr/error_cfstream.cc +3 -2
- data/src/core/lib/iomgr/error_cfstream.h +2 -2
- data/src/core/lib/iomgr/error_internal.h +5 -1
- data/src/core/lib/iomgr/ev_apple.cc +6 -6
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +22 -22
- data/src/core/lib/iomgr/ev_epollex_linux.cc +48 -45
- data/src/core/lib/iomgr/ev_poll_posix.cc +26 -23
- data/src/core/lib/iomgr/ev_posix.cc +12 -11
- data/src/core/lib/iomgr/ev_posix.h +9 -9
- data/src/core/lib/iomgr/exec_ctx.cc +10 -6
- data/src/core/lib/iomgr/exec_ctx.h +1 -1
- data/src/core/lib/iomgr/executor.cc +8 -8
- data/src/core/lib/iomgr/executor.h +2 -2
- data/src/core/lib/iomgr/iomgr.cc +1 -1
- data/src/core/lib/iomgr/iomgr.h +1 -1
- data/src/core/lib/iomgr/iomgr_custom.cc +1 -1
- data/src/core/lib/iomgr/iomgr_internal.cc +2 -2
- data/src/core/lib/iomgr/iomgr_internal.h +3 -3
- data/src/core/lib/iomgr/iomgr_posix.cc +1 -1
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
- data/src/core/lib/iomgr/iomgr_windows.cc +1 -1
- data/src/core/lib/iomgr/load_file.cc +4 -4
- data/src/core/lib/iomgr/load_file.h +2 -2
- data/src/core/lib/iomgr/lockfree_event.cc +5 -5
- data/src/core/lib/iomgr/lockfree_event.h +1 -1
- data/src/core/lib/iomgr/pollset.cc +5 -5
- data/src/core/lib/iomgr/pollset.h +9 -9
- data/src/core/lib/iomgr/pollset_custom.cc +5 -5
- data/src/core/lib/iomgr/pollset_windows.cc +5 -5
- data/src/core/lib/iomgr/port.h +1 -1
- data/src/core/lib/iomgr/python_util.h +1 -1
- data/src/core/lib/iomgr/resolve_address.cc +3 -3
- data/src/core/lib/iomgr/resolve_address.h +6 -6
- data/src/core/lib/iomgr/resolve_address_custom.cc +10 -9
- data/src/core/lib/iomgr/resolve_address_custom.h +3 -3
- data/src/core/lib/iomgr/resolve_address_posix.cc +3 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +4 -4
- data/src/core/lib/iomgr/resource_quota.cc +12 -11
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +22 -20
- data/src/core/lib/iomgr/socket_utils_posix.h +20 -20
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_custom.cc +5 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +15 -17
- data/src/core/lib/iomgr/tcp_client_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +5 -5
- data/src/core/lib/iomgr/tcp_custom.cc +14 -16
- data/src/core/lib/iomgr/tcp_custom.h +13 -12
- data/src/core/lib/iomgr/tcp_posix.cc +37 -38
- data/src/core/lib/iomgr/tcp_server.cc +6 -6
- data/src/core/lib/iomgr/tcp_server.h +12 -11
- data/src/core/lib/iomgr/tcp_server_custom.cc +23 -21
- data/src/core/lib/iomgr/tcp_server_posix.cc +22 -21
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +19 -17
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +9 -9
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +4 -4
- data/src/core/lib/iomgr/tcp_server_windows.cc +26 -25
- data/src/core/lib/iomgr/tcp_uv.cc +27 -25
- data/src/core/lib/iomgr/tcp_windows.cc +13 -13
- data/src/core/lib/iomgr/tcp_windows.h +2 -2
- data/src/core/lib/iomgr/timer_custom.cc +2 -1
- data/src/core/lib/iomgr/timer_custom.h +1 -1
- data/src/core/lib/iomgr/timer_generic.cc +8 -8
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/iomgr/udp_server.cc +21 -20
- data/src/core/lib/iomgr/unix_sockets_posix.cc +3 -3
- data/src/core/lib/iomgr/unix_sockets_posix.h +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +10 -7
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +3 -3
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +4 -4
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +3 -3
- data/src/core/lib/iomgr/wakeup_fd_posix.h +8 -6
- data/src/core/lib/iomgr/work_serializer.h +17 -1
- data/src/core/lib/json/json.h +1 -1
- data/src/core/lib/json/json_reader.cc +4 -4
- data/src/core/lib/{security/authorization → matchers}/matchers.cc +47 -47
- data/src/core/lib/{security/authorization → matchers}/matchers.h +42 -40
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +4 -4
- data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -2
- data/src/core/lib/security/credentials/credentials.h +2 -2
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +17 -13
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +13 -11
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +2 -1
- data/src/core/lib/security/credentials/external/aws_request_signer.h +1 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +15 -12
- data/src/core/lib/security/credentials/external/external_account_credentials.h +9 -8
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +5 -4
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +4 -3
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +8 -8
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +9 -7
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +9 -9
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +2 -2
- data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -2
- data/src/core/lib/security/credentials/jwt/json_token.cc +2 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +3 -3
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +7 -5
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +21 -19
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +5 -5
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +5 -5
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +8 -7
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +9 -9
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +19 -13
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +4 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +3 -3
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +13 -3
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +13 -3
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +2 -2
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +12 -2
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +1 -1
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +14 -4
- data/src/core/lib/security/security_connector/security_connector.h +9 -4
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +16 -6
- data/src/core/lib/security/security_connector/ssl_utils.cc +28 -8
- data/src/core/lib/security/security_connector/ssl_utils.h +4 -4
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +62 -60
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +66 -48
- data/src/core/lib/security/transport/client_auth_filter.cc +18 -10
- data/src/core/lib/security/transport/secure_endpoint.cc +4 -4
- data/src/core/lib/security/transport/security_handshaker.cc +65 -34
- data/src/core/lib/security/transport/server_auth_filter.cc +24 -11
- data/src/core/lib/security/transport/tsi_error.cc +2 -1
- data/src/core/lib/security/transport/tsi_error.h +2 -1
- data/src/core/lib/security/util/json_util.cc +2 -2
- data/src/core/lib/security/util/json_util.h +1 -1
- data/src/core/lib/slice/slice_intern.cc +6 -7
- data/src/core/lib/surface/call.cc +46 -45
- data/src/core/lib/surface/call.h +2 -2
- data/src/core/lib/surface/channel.cc +6 -6
- data/src/core/lib/surface/channel.h +6 -5
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +46 -47
- data/src/core/lib/surface/completion_queue.h +2 -1
- data/src/core/lib/surface/lame_client.cc +43 -24
- data/src/core/lib/surface/lame_client.h +4 -3
- data/src/core/lib/surface/server.cc +68 -55
- data/src/core/lib/surface/server.h +89 -29
- data/src/core/lib/surface/validate_metadata.cc +7 -7
- data/src/core/lib/surface/validate_metadata.h +3 -2
- data/src/core/lib/surface/version.cc +4 -2
- data/src/core/lib/transport/byte_stream.cc +5 -5
- data/src/core/lib/transport/byte_stream.h +8 -8
- data/src/core/lib/transport/connectivity_state.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +19 -8
- data/src/core/lib/transport/error_utils.h +11 -5
- data/src/core/lib/transport/metadata_batch.cc +64 -37
- data/src/core/lib/transport/metadata_batch.h +33 -18
- data/src/core/lib/transport/transport.cc +4 -3
- data/src/core/lib/transport/transport.h +4 -4
- data/src/core/lib/transport/transport_op_string.cc +5 -5
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
- data/src/core/tsi/alts/crypt/gsec.h +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +6 -8
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +7 -6
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +2 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -3
- data/src/core/tsi/fake_transport_security.cc +10 -1
- data/src/core/tsi/ssl_transport_security.cc +32 -14
- data/src/core/tsi/ssl_transport_security.h +3 -4
- data/src/ruby/bin/math_services_pb.rb +1 -1
- data/src/ruby/ext/grpc/extconf.rb +9 -1
- data/src/ruby/ext/grpc/rb_channel.c +10 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
- data/src/ruby/ext/grpc/rb_server.c +13 -1
- data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
- data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +6 -6
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +32 -0
- data/src/ruby/spec/channel_spec.rb +17 -6
- data/src/ruby/spec/client_auth_spec.rb +27 -1
- data/src/ruby/spec/errors_spec.rb +1 -1
- data/src/ruby/spec/generic/active_call_spec.rb +2 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +25 -0
- data/src/ruby/spec/server_spec.rb +22 -0
- data/third_party/abseil-cpp/absl/algorithm/container.h +3 -3
- data/third_party/abseil-cpp/absl/base/attributes.h +24 -4
- data/third_party/abseil-cpp/absl/base/call_once.h +2 -9
- data/third_party/abseil-cpp/absl/base/config.h +37 -9
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +24 -10
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +4 -1
- data/third_party/abseil-cpp/absl/base/internal/endian.h +61 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +2 -3
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +34 -32
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +16 -6
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +11 -2
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +14 -5
- data/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +3 -3
- data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +11 -11
- data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +5 -5
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +1 -1
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +5 -2
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +43 -42
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +111 -7
- data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +0 -76
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +1 -3
- data/third_party/abseil-cpp/absl/base/log_severity.h +4 -4
- data/third_party/abseil-cpp/absl/base/macros.h +11 -0
- data/third_party/abseil-cpp/absl/base/optimization.h +10 -7
- data/third_party/abseil-cpp/absl/base/options.h +1 -1
- data/third_party/abseil-cpp/absl/base/port.h +0 -1
- data/third_party/abseil-cpp/absl/base/thread_annotations.h +1 -1
- data/third_party/abseil-cpp/absl/container/fixed_array.h +2 -2
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +5 -3
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +1 -1
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +5 -1
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +2 -1
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +2 -1
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +141 -66
- data/third_party/abseil-cpp/absl/container/internal/layout.h +4 -4
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +14 -1
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +136 -136
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +16 -12
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +5 -2
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +3 -12
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +6 -1
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +3 -5
- data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +2 -2
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +2 -2
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +15 -12
- data/third_party/abseil-cpp/absl/hash/internal/city.h +1 -19
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +25 -10
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +86 -37
- data/third_party/abseil-cpp/absl/hash/internal/wyhash.cc +111 -0
- data/third_party/abseil-cpp/absl/hash/internal/wyhash.h +48 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +16 -2
- data/third_party/abseil-cpp/absl/numeric/bits.h +177 -0
- data/third_party/abseil-cpp/absl/numeric/int128.cc +3 -3
- data/third_party/abseil-cpp/absl/numeric/internal/bits.h +358 -0
- data/third_party/abseil-cpp/absl/numeric/internal/representation.h +55 -0
- data/third_party/abseil-cpp/absl/status/internal/status_internal.h +18 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +4 -7
- data/third_party/abseil-cpp/absl/status/status.cc +29 -22
- data/third_party/abseil-cpp/absl/status/status.h +81 -20
- data/third_party/abseil-cpp/absl/status/statusor.h +3 -3
- data/third_party/abseil-cpp/absl/strings/charconv.cc +5 -5
- data/third_party/abseil-cpp/absl/strings/cord.cc +326 -371
- data/third_party/abseil-cpp/absl/strings/cord.h +182 -64
- data/third_party/abseil-cpp/absl/strings/escaping.cc +4 -4
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +6 -6
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +83 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +387 -17
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +146 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +897 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +589 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +114 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +14 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +14 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +15 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +19 -4
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +14 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +36 -18
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +14 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +14 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +14 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +15 -40
- data/third_party/abseil-cpp/absl/strings/internal/string_constant.h +64 -0
- data/third_party/abseil-cpp/absl/strings/match.cc +6 -3
- data/third_party/abseil-cpp/absl/strings/match.h +16 -6
- data/third_party/abseil-cpp/absl/strings/numbers.cc +132 -4
- data/third_party/abseil-cpp/absl/strings/numbers.h +10 -10
- data/third_party/abseil-cpp/absl/strings/str_join.h +1 -1
- data/third_party/abseil-cpp/absl/strings/str_split.h +38 -4
- data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +154 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -1
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +2 -2
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +4 -4
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +1 -65
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +2 -6
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +71 -59
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +79 -62
- data/third_party/abseil-cpp/absl/time/clock.cc +146 -130
- data/third_party/abseil-cpp/absl/time/clock.h +2 -2
- data/third_party/abseil-cpp/absl/time/duration.cc +3 -2
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +7 -11
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +7 -1
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +4 -4
- data/third_party/abseil-cpp/absl/time/time.cc +4 -3
- data/third_party/abseil-cpp/absl/time/time.h +26 -24
- data/third_party/abseil-cpp/absl/types/internal/variant.h +1 -1
- data/third_party/abseil-cpp/absl/types/variant.h +9 -4
- data/third_party/boringssl-with-bazel/err_data.c +478 -462
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +18 -8
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +1 -88
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +14 -3
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +119 -273
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +87 -80
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +32 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +25 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +10 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +4 -43
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +0 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +104 -93
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +39 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +43 -46
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +43 -46
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +33 -22
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cfb.c +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +9 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +17 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +1 -22
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +26 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/fips.c +79 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +14 -9
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +45 -48
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +38 -43
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +37 -45
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +103 -42
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +58 -37
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +65 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +14 -0
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +95 -48
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +0 -28
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +19 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_req.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +19 -25
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +3 -30
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +39 -89
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +9 -16
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +21 -17
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +21 -34
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +25 -22
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +0 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +120 -41
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +9 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +0 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +24 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +5 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +19 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +3 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +1 -38
- data/third_party/boringssl-with-bazel/src/{crypto/x509/x509_r2x.c → include/openssl/evp_errors.h} +41 -58
- data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +24 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +9 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +210 -26
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +416 -122
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +2 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +5 -0
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +444 -0
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +244 -1
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +43 -12
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +149 -8
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +220 -46
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +7 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -6
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +23 -26
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +74 -15
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +131 -83
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +34 -4
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +205 -100
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +4 -2
- data/third_party/xxhash/xxhash.h +5443 -0
- metadata +128 -61
- data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +0 -88
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +0 -88
- data/src/core/lib/security/authorization/authorization_engine.cc +0 -177
- data/src/core/lib/security/authorization/authorization_engine.h +0 -84
- data/src/core/lib/security/authorization/evaluate_args.cc +0 -148
- data/src/core/lib/security/authorization/evaluate_args.h +0 -59
- data/src/core/lib/security/authorization/mock_cel/activation.h +0 -57
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +0 -44
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +0 -69
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +0 -99
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +0 -67
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +0 -57
- data/third_party/abseil-cpp/absl/base/internal/bits.h +0 -219
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -504
- data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +0 -249
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/is_fips.c +0 -29
- data/third_party/upb/upb/json_decode.c +0 -1443
- data/third_party/upb/upb/json_decode.h +0 -23
- data/third_party/upb/upb/json_encode.c +0 -713
- data/third_party/upb/upb/json_encode.h +0 -36
@@ -72,6 +72,7 @@ void HashtablezInfo::PrepareForSampling() {
|
|
72
72
|
total_probe_length.store(0, std::memory_order_relaxed);
|
73
73
|
hashes_bitwise_or.store(0, std::memory_order_relaxed);
|
74
74
|
hashes_bitwise_and.store(~size_t{}, std::memory_order_relaxed);
|
75
|
+
hashes_bitwise_xor.store(0, std::memory_order_relaxed);
|
75
76
|
|
76
77
|
create_time = absl::Now();
|
77
78
|
// The inliner makes hardcoded skip_count difficult (especially when combined
|
@@ -180,7 +181,9 @@ static bool ShouldForceSampling() {
|
|
180
181
|
if (ABSL_PREDICT_TRUE(state == kDontForce)) return false;
|
181
182
|
|
182
183
|
if (state == kUninitialized) {
|
183
|
-
state = AbslContainerInternalSampleEverything()
|
184
|
+
state = ABSL_INTERNAL_C_SYMBOL(AbslContainerInternalSampleEverything)()
|
185
|
+
? kForce
|
186
|
+
: kDontForce;
|
184
187
|
global_state.store(state, std::memory_order_relaxed);
|
185
188
|
}
|
186
189
|
return state == kForce;
|
@@ -235,6 +238,7 @@ void RecordInsertSlow(HashtablezInfo* info, size_t hash,
|
|
235
238
|
|
236
239
|
info->hashes_bitwise_and.fetch_and(hash, std::memory_order_relaxed);
|
237
240
|
info->hashes_bitwise_or.fetch_or(hash, std::memory_order_relaxed);
|
241
|
+
info->hashes_bitwise_xor.fetch_xor(hash, std::memory_order_relaxed);
|
238
242
|
info->max_probe_length.store(
|
239
243
|
std::max(info->max_probe_length.load(std::memory_order_relaxed),
|
240
244
|
probe_length),
|
@@ -78,6 +78,7 @@ struct HashtablezInfo {
|
|
78
78
|
std::atomic<size_t> total_probe_length;
|
79
79
|
std::atomic<size_t> hashes_bitwise_or;
|
80
80
|
std::atomic<size_t> hashes_bitwise_and;
|
81
|
+
std::atomic<size_t> hashes_bitwise_xor;
|
81
82
|
|
82
83
|
// `HashtablezSampler` maintains intrusive linked lists for all samples. See
|
83
84
|
// comments on `HashtablezSampler::all_` for details on these. `init_mu`
|
@@ -312,7 +313,7 @@ void SetHashtablezMaxSamples(int32_t max);
|
|
312
313
|
// initialization of static storage duration objects.
|
313
314
|
// The definition of this constant is weak, which allows us to inject a
|
314
315
|
// different value for it at link time.
|
315
|
-
extern "C" bool AbslContainerInternalSampleEverything();
|
316
|
+
extern "C" bool ABSL_INTERNAL_C_SYMBOL(AbslContainerInternalSampleEverything)();
|
316
317
|
|
317
318
|
} // namespace container_internal
|
318
319
|
ABSL_NAMESPACE_END
|
data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc
CHANGED
@@ -21,7 +21,8 @@ ABSL_NAMESPACE_BEGIN
|
|
21
21
|
namespace container_internal {
|
22
22
|
|
23
23
|
// See hashtablez_sampler.h for details.
|
24
|
-
extern "C" ABSL_ATTRIBUTE_WEAK bool
|
24
|
+
extern "C" ABSL_ATTRIBUTE_WEAK bool ABSL_INTERNAL_C_SYMBOL(
|
25
|
+
AbslContainerInternalSampleEverything)() {
|
25
26
|
return false;
|
26
27
|
}
|
27
28
|
|
@@ -33,6 +33,12 @@ namespace absl {
|
|
33
33
|
ABSL_NAMESPACE_BEGIN
|
34
34
|
namespace inlined_vector_internal {
|
35
35
|
|
36
|
+
// GCC does not deal very well with the below code
|
37
|
+
#if !defined(__clang__) && defined(__GNUC__)
|
38
|
+
#pragma GCC diagnostic push
|
39
|
+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
40
|
+
#endif
|
41
|
+
|
36
42
|
template <typename Iterator>
|
37
43
|
using IsAtLeastForwardIterator = std::is_convertible<
|
38
44
|
typename std::iterator_traits<Iterator>::iterator_category,
|
@@ -75,6 +81,23 @@ void DestroyElements(AllocatorType* alloc_ptr, Pointer destroy_first,
|
|
75
81
|
}
|
76
82
|
}
|
77
83
|
|
84
|
+
// If kUseMemcpy is true, memcpy(dst, src, n); else do nothing.
|
85
|
+
// Useful to avoid compiler warnings when memcpy() is used for T values
|
86
|
+
// that are not trivially copyable in non-reachable code.
|
87
|
+
template <bool kUseMemcpy>
|
88
|
+
inline void MemcpyIfAllowed(void* dst, const void* src, size_t n);
|
89
|
+
|
90
|
+
// memcpy when allowed.
|
91
|
+
template <>
|
92
|
+
inline void MemcpyIfAllowed<true>(void* dst, const void* src, size_t n) {
|
93
|
+
memcpy(dst, src, n);
|
94
|
+
}
|
95
|
+
|
96
|
+
// Do nothing for types that are not memcpy-able. This function is only
|
97
|
+
// called from non-reachable branches.
|
98
|
+
template <>
|
99
|
+
inline void MemcpyIfAllowed<false>(void*, const void*, size_t) {}
|
100
|
+
|
78
101
|
template <typename AllocatorType, typename Pointer, typename ValueAdapter,
|
79
102
|
typename SizeType>
|
80
103
|
void ConstructElements(AllocatorType* alloc_ptr, Pointer construct_first,
|
@@ -298,14 +321,20 @@ class Storage {
|
|
298
321
|
// Storage Constructors and Destructor
|
299
322
|
// ---------------------------------------------------------------------------
|
300
323
|
|
301
|
-
Storage() : metadata_() {}
|
324
|
+
Storage() : metadata_(allocator_type(), /* size and is_allocated */ 0) {}
|
302
325
|
|
303
|
-
explicit Storage(const allocator_type& alloc)
|
326
|
+
explicit Storage(const allocator_type& alloc)
|
327
|
+
: metadata_(alloc, /* size and is_allocated */ 0) {}
|
304
328
|
|
305
329
|
~Storage() {
|
306
|
-
|
307
|
-
|
308
|
-
|
330
|
+
if (GetSizeAndIsAllocated() == 0) {
|
331
|
+
// Empty and not allocated; nothing to do.
|
332
|
+
} else if (IsMemcpyOk::value) {
|
333
|
+
// No destructors need to be run; just deallocate if necessary.
|
334
|
+
DeallocateIfAllocated();
|
335
|
+
} else {
|
336
|
+
DestroyContents();
|
337
|
+
}
|
309
338
|
}
|
310
339
|
|
311
340
|
// ---------------------------------------------------------------------------
|
@@ -363,6 +392,8 @@ class Storage {
|
|
363
392
|
// Storage Member Mutators
|
364
393
|
// ---------------------------------------------------------------------------
|
365
394
|
|
395
|
+
ABSL_ATTRIBUTE_NOINLINE void InitFrom(const Storage& other);
|
396
|
+
|
366
397
|
template <typename ValueAdapter>
|
367
398
|
void Initialize(ValueAdapter values, size_type new_size);
|
368
399
|
|
@@ -445,6 +476,8 @@ class Storage {
|
|
445
476
|
}
|
446
477
|
|
447
478
|
private:
|
479
|
+
ABSL_ATTRIBUTE_NOINLINE void DestroyContents();
|
480
|
+
|
448
481
|
using Metadata =
|
449
482
|
container_internal::CompressedTuple<allocator_type, size_type>;
|
450
483
|
|
@@ -462,10 +495,47 @@ class Storage {
|
|
462
495
|
Inlined inlined;
|
463
496
|
};
|
464
497
|
|
498
|
+
template <typename... Args>
|
499
|
+
ABSL_ATTRIBUTE_NOINLINE reference EmplaceBackSlow(Args&&... args);
|
500
|
+
|
465
501
|
Metadata metadata_;
|
466
502
|
Data data_;
|
467
503
|
};
|
468
504
|
|
505
|
+
template <typename T, size_t N, typename A>
|
506
|
+
void Storage<T, N, A>::DestroyContents() {
|
507
|
+
pointer data = GetIsAllocated() ? GetAllocatedData() : GetInlinedData();
|
508
|
+
inlined_vector_internal::DestroyElements(GetAllocPtr(), data, GetSize());
|
509
|
+
DeallocateIfAllocated();
|
510
|
+
}
|
511
|
+
|
512
|
+
template <typename T, size_t N, typename A>
|
513
|
+
void Storage<T, N, A>::InitFrom(const Storage& other) {
|
514
|
+
const auto n = other.GetSize();
|
515
|
+
assert(n > 0); // Empty sources handled handled in caller.
|
516
|
+
const_pointer src;
|
517
|
+
pointer dst;
|
518
|
+
if (!other.GetIsAllocated()) {
|
519
|
+
dst = GetInlinedData();
|
520
|
+
src = other.GetInlinedData();
|
521
|
+
} else {
|
522
|
+
// Because this is only called from the `InlinedVector` constructors, it's
|
523
|
+
// safe to take on the allocation with size `0`. If `ConstructElements(...)`
|
524
|
+
// throws, deallocation will be automatically handled by `~Storage()`.
|
525
|
+
size_type new_capacity = ComputeCapacity(GetInlinedCapacity(), n);
|
526
|
+
dst = AllocatorTraits::allocate(*GetAllocPtr(), new_capacity);
|
527
|
+
SetAllocatedData(dst, new_capacity);
|
528
|
+
src = other.GetAllocatedData();
|
529
|
+
}
|
530
|
+
if (IsMemcpyOk::value) {
|
531
|
+
MemcpyIfAllowed<IsMemcpyOk::value>(dst, src, sizeof(dst[0]) * n);
|
532
|
+
} else {
|
533
|
+
auto values = IteratorValueAdapter<const_pointer>(src);
|
534
|
+
inlined_vector_internal::ConstructElements(GetAllocPtr(), dst, &values, n);
|
535
|
+
}
|
536
|
+
GetSizeAndIsAllocated() = other.GetSizeAndIsAllocated();
|
537
|
+
}
|
538
|
+
|
469
539
|
template <typename T, size_t N, typename A>
|
470
540
|
template <typename ValueAdapter>
|
471
541
|
auto Storage<T, N, A>::Initialize(ValueAdapter values, size_type new_size)
|
@@ -542,48 +612,42 @@ template <typename T, size_t N, typename A>
|
|
542
612
|
template <typename ValueAdapter>
|
543
613
|
auto Storage<T, N, A>::Resize(ValueAdapter values, size_type new_size) -> void {
|
544
614
|
StorageView storage_view = MakeStorageView();
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
615
|
+
auto* const base = storage_view.data;
|
616
|
+
const size_type size = storage_view.size;
|
617
|
+
auto* alloc = GetAllocPtr();
|
618
|
+
if (new_size <= size) {
|
619
|
+
// Destroy extra old elements.
|
620
|
+
inlined_vector_internal::DestroyElements(alloc, base + new_size,
|
621
|
+
size - new_size);
|
622
|
+
} else if (new_size <= storage_view.capacity) {
|
623
|
+
// Construct new elements in place.
|
624
|
+
inlined_vector_internal::ConstructElements(alloc, base + size, &values,
|
625
|
+
new_size - size);
|
626
|
+
} else {
|
627
|
+
// Steps:
|
628
|
+
// a. Allocate new backing store.
|
629
|
+
// b. Construct new elements in new backing store.
|
630
|
+
// c. Move existing elements from old backing store to now.
|
631
|
+
// d. Destroy all elements in old backing store.
|
632
|
+
// Use transactional wrappers for the first two steps so we can roll
|
633
|
+
// back if necessary due to exceptions.
|
634
|
+
AllocationTransaction allocation_tx(alloc);
|
557
635
|
size_type new_capacity = ComputeCapacity(storage_view.capacity, new_size);
|
558
636
|
pointer new_data = allocation_tx.Allocate(new_capacity);
|
559
|
-
construct_loop = {new_data + storage_view.size,
|
560
|
-
new_size - storage_view.size};
|
561
|
-
move_construct_loop = {new_data, storage_view.size};
|
562
|
-
destroy_loop = {storage_view.data, storage_view.size};
|
563
|
-
} else if (new_size > storage_view.size) {
|
564
|
-
construct_loop = {storage_view.data + storage_view.size,
|
565
|
-
new_size - storage_view.size};
|
566
|
-
} else {
|
567
|
-
destroy_loop = {storage_view.data + new_size, storage_view.size - new_size};
|
568
|
-
}
|
569
637
|
|
570
|
-
|
571
|
-
|
638
|
+
ConstructionTransaction construction_tx(alloc);
|
639
|
+
construction_tx.Construct(new_data + size, &values, new_size - size);
|
572
640
|
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
inlined_vector_internal::DestroyElements(GetAllocPtr(), destroy_loop.data(),
|
578
|
-
destroy_loop.size());
|
641
|
+
IteratorValueAdapter<MoveIterator> move_values((MoveIterator(base)));
|
642
|
+
inlined_vector_internal::ConstructElements(alloc, new_data, &move_values,
|
643
|
+
size);
|
579
644
|
|
580
|
-
|
581
|
-
|
645
|
+
inlined_vector_internal::DestroyElements(alloc, base, size);
|
646
|
+
construction_tx.Commit();
|
582
647
|
DeallocateIfAllocated();
|
583
648
|
AcquireAllocatedData(&allocation_tx);
|
584
649
|
SetIsAllocated();
|
585
650
|
}
|
586
|
-
|
587
651
|
SetSize(new_size);
|
588
652
|
}
|
589
653
|
|
@@ -684,44 +748,50 @@ template <typename T, size_t N, typename A>
|
|
684
748
|
template <typename... Args>
|
685
749
|
auto Storage<T, N, A>::EmplaceBack(Args&&... args) -> reference {
|
686
750
|
StorageView storage_view = MakeStorageView();
|
751
|
+
const auto n = storage_view.size;
|
752
|
+
if (ABSL_PREDICT_TRUE(n != storage_view.capacity)) {
|
753
|
+
// Fast path; new element fits.
|
754
|
+
pointer last_ptr = storage_view.data + n;
|
755
|
+
AllocatorTraits::construct(*GetAllocPtr(), last_ptr,
|
756
|
+
std::forward<Args>(args)...);
|
757
|
+
AddSize(1);
|
758
|
+
return *last_ptr;
|
759
|
+
}
|
760
|
+
// TODO(b/173712035): Annotate with musttail attribute to prevent regression.
|
761
|
+
return EmplaceBackSlow(std::forward<Args>(args)...);
|
762
|
+
}
|
687
763
|
|
764
|
+
template <typename T, size_t N, typename A>
|
765
|
+
template <typename... Args>
|
766
|
+
auto Storage<T, N, A>::EmplaceBackSlow(Args&&... args) -> reference {
|
767
|
+
StorageView storage_view = MakeStorageView();
|
688
768
|
AllocationTransaction allocation_tx(GetAllocPtr());
|
689
|
-
|
690
769
|
IteratorValueAdapter<MoveIterator> move_values(
|
691
770
|
MoveIterator(storage_view.data));
|
692
|
-
|
693
|
-
pointer construct_data;
|
694
|
-
if (storage_view.size == storage_view.capacity) {
|
695
|
-
size_type new_capacity = NextCapacity(storage_view.capacity);
|
696
|
-
construct_data = allocation_tx.Allocate(new_capacity);
|
697
|
-
} else {
|
698
|
-
construct_data = storage_view.data;
|
699
|
-
}
|
700
|
-
|
771
|
+
size_type new_capacity = NextCapacity(storage_view.capacity);
|
772
|
+
pointer construct_data = allocation_tx.Allocate(new_capacity);
|
701
773
|
pointer last_ptr = construct_data + storage_view.size;
|
702
774
|
|
775
|
+
// Construct new element.
|
703
776
|
AllocatorTraits::construct(*GetAllocPtr(), last_ptr,
|
704
777
|
std::forward<Args>(args)...);
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
ABSL_INTERNAL_RETHROW;
|
715
|
-
}
|
716
|
-
|
717
|
-
inlined_vector_internal::DestroyElements(GetAllocPtr(), storage_view.data,
|
718
|
-
storage_view.size);
|
719
|
-
|
720
|
-
DeallocateIfAllocated();
|
721
|
-
AcquireAllocatedData(&allocation_tx);
|
722
|
-
SetIsAllocated();
|
778
|
+
// Move elements from old backing store to new backing store.
|
779
|
+
ABSL_INTERNAL_TRY {
|
780
|
+
inlined_vector_internal::ConstructElements(
|
781
|
+
GetAllocPtr(), allocation_tx.GetData(), &move_values,
|
782
|
+
storage_view.size);
|
783
|
+
}
|
784
|
+
ABSL_INTERNAL_CATCH_ANY {
|
785
|
+
AllocatorTraits::destroy(*GetAllocPtr(), last_ptr);
|
786
|
+
ABSL_INTERNAL_RETHROW;
|
723
787
|
}
|
788
|
+
// Destroy elements in old backing store.
|
789
|
+
inlined_vector_internal::DestroyElements(GetAllocPtr(), storage_view.data,
|
790
|
+
storage_view.size);
|
724
791
|
|
792
|
+
DeallocateIfAllocated();
|
793
|
+
AcquireAllocatedData(&allocation_tx);
|
794
|
+
SetIsAllocated();
|
725
795
|
AddSize(1);
|
726
796
|
return *last_ptr;
|
727
797
|
}
|
@@ -885,6 +955,11 @@ auto Storage<T, N, A>::Swap(Storage* other_storage_ptr) -> void {
|
|
885
955
|
swap(*GetAllocPtr(), *other_storage_ptr->GetAllocPtr());
|
886
956
|
}
|
887
957
|
|
958
|
+
// End ignore "maybe-uninitialized"
|
959
|
+
#if !defined(__clang__) && defined(__GNUC__)
|
960
|
+
#pragma GCC diagnostic pop
|
961
|
+
#endif
|
962
|
+
|
888
963
|
} // namespace inlined_vector_internal
|
889
964
|
ABSL_NAMESPACE_END
|
890
965
|
} // namespace absl
|
@@ -404,7 +404,7 @@ class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>,
|
|
404
404
|
constexpr size_t Offset() const {
|
405
405
|
static_assert(N < NumOffsets, "Index out of bounds");
|
406
406
|
return adl_barrier::Align(
|
407
|
-
Offset<N - 1>() + SizeOf<ElementType<N - 1
|
407
|
+
Offset<N - 1>() + SizeOf<ElementType<N - 1>>::value * size_[N - 1],
|
408
408
|
ElementAlignment<N>::value);
|
409
409
|
}
|
410
410
|
|
@@ -597,7 +597,7 @@ class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>,
|
|
597
597
|
constexpr size_t AllocSize() const {
|
598
598
|
static_assert(NumTypes == NumSizes, "You must specify sizes of all fields");
|
599
599
|
return Offset<NumTypes - 1>() +
|
600
|
-
|
600
|
+
SizeOf<ElementType<NumTypes - 1>>::value * size_[NumTypes - 1];
|
601
601
|
}
|
602
602
|
|
603
603
|
// If built with --config=asan, poisons padding bytes (if any) in the
|
@@ -621,7 +621,7 @@ class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>,
|
|
621
621
|
// The `if` is an optimization. It doesn't affect the observable behaviour.
|
622
622
|
if (ElementAlignment<N - 1>::value % ElementAlignment<N>::value) {
|
623
623
|
size_t start =
|
624
|
-
Offset<N - 1>() + SizeOf<ElementType<N - 1
|
624
|
+
Offset<N - 1>() + SizeOf<ElementType<N - 1>>::value * size_[N - 1];
|
625
625
|
ASAN_POISON_MEMORY_REGION(p + start, Offset<N>() - start);
|
626
626
|
}
|
627
627
|
#endif
|
@@ -645,7 +645,7 @@ class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>,
|
|
645
645
|
// produce "unsigned*" where another produces "unsigned int *".
|
646
646
|
std::string DebugString() const {
|
647
647
|
const auto offsets = Offsets();
|
648
|
-
const size_t sizes[] = {SizeOf<ElementType<OffsetSeq
|
648
|
+
const size_t sizes[] = {SizeOf<ElementType<OffsetSeq>>::value...};
|
649
649
|
const std::string types[] = {
|
650
650
|
adl_barrier::TypeName<ElementType<OffsetSeq>>()...};
|
651
651
|
std::string res = absl::StrCat("@0", types[0], "(", sizes[0], ")");
|
@@ -27,7 +27,7 @@ constexpr size_t Group::kWidth;
|
|
27
27
|
|
28
28
|
// Returns "random" seed.
|
29
29
|
inline size_t RandomSeed() {
|
30
|
-
#
|
30
|
+
#ifdef ABSL_HAVE_THREAD_LOCAL
|
31
31
|
static thread_local size_t counter = 0;
|
32
32
|
size_t value = ++counter;
|
33
33
|
#else // ABSL_HAVE_THREAD_LOCAL
|
@@ -43,6 +43,19 @@ bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl) {
|
|
43
43
|
return (H1(hash, ctrl) ^ RandomSeed()) % 13 > 6;
|
44
44
|
}
|
45
45
|
|
46
|
+
void ConvertDeletedToEmptyAndFullToDeleted(
|
47
|
+
ctrl_t* ctrl, size_t capacity) {
|
48
|
+
assert(ctrl[capacity] == kSentinel);
|
49
|
+
assert(IsValidCapacity(capacity));
|
50
|
+
for (ctrl_t* pos = ctrl; pos != ctrl + capacity + 1; pos += Group::kWidth) {
|
51
|
+
Group{pos}.ConvertSpecialToEmptyAndFullToDeleted(pos);
|
52
|
+
}
|
53
|
+
// Copy the cloned ctrl bytes.
|
54
|
+
std::memcpy(ctrl + capacity + 1, ctrl, Group::kWidth);
|
55
|
+
ctrl[capacity] = kSentinel;
|
56
|
+
}
|
57
|
+
|
58
|
+
|
46
59
|
} // namespace container_internal
|
47
60
|
ABSL_NAMESPACE_END
|
48
61
|
} // namespace absl
|
@@ -102,7 +102,6 @@
|
|
102
102
|
#include <type_traits>
|
103
103
|
#include <utility>
|
104
104
|
|
105
|
-
#include "absl/base/internal/bits.h"
|
106
105
|
#include "absl/base/internal/endian.h"
|
107
106
|
#include "absl/base/optimization.h"
|
108
107
|
#include "absl/base/port.h"
|
@@ -116,6 +115,7 @@
|
|
116
115
|
#include "absl/container/internal/layout.h"
|
117
116
|
#include "absl/memory/memory.h"
|
118
117
|
#include "absl/meta/type_traits.h"
|
118
|
+
#include "absl/numeric/bits.h"
|
119
119
|
#include "absl/utility/utility.h"
|
120
120
|
|
121
121
|
namespace absl {
|
@@ -189,18 +189,9 @@ constexpr bool IsNoThrowSwappable(std::false_type /* is_swappable */) {
|
|
189
189
|
}
|
190
190
|
|
191
191
|
template <typename T>
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
: base_internal::CountTrailingZerosNonZero32(
|
196
|
-
static_cast<uint32_t>(x));
|
197
|
-
}
|
198
|
-
|
199
|
-
template <typename T>
|
200
|
-
int LeadingZeros(T x) {
|
201
|
-
return sizeof(T) == 8
|
202
|
-
? base_internal::CountLeadingZeros64(static_cast<uint64_t>(x))
|
203
|
-
: base_internal::CountLeadingZeros32(static_cast<uint32_t>(x));
|
192
|
+
uint32_t TrailingZeros(T x) {
|
193
|
+
ABSL_INTERNAL_ASSUME(x != 0);
|
194
|
+
return countr_zero(x);
|
204
195
|
}
|
205
196
|
|
206
197
|
// An abstraction over a bitmask. It provides an easy way to iterate through the
|
@@ -230,26 +221,24 @@ class BitMask {
|
|
230
221
|
}
|
231
222
|
explicit operator bool() const { return mask_ != 0; }
|
232
223
|
int operator*() const { return LowestBitSet(); }
|
233
|
-
|
224
|
+
uint32_t LowestBitSet() const {
|
234
225
|
return container_internal::TrailingZeros(mask_) >> Shift;
|
235
226
|
}
|
236
|
-
|
237
|
-
return (
|
238
|
-
1) >>
|
239
|
-
Shift;
|
227
|
+
uint32_t HighestBitSet() const {
|
228
|
+
return static_cast<uint32_t>((bit_width(mask_) - 1) >> Shift);
|
240
229
|
}
|
241
230
|
|
242
231
|
BitMask begin() const { return *this; }
|
243
232
|
BitMask end() const { return BitMask(0); }
|
244
233
|
|
245
|
-
|
234
|
+
uint32_t TrailingZeros() const {
|
246
235
|
return container_internal::TrailingZeros(mask_) >> Shift;
|
247
236
|
}
|
248
237
|
|
249
|
-
|
238
|
+
uint32_t LeadingZeros() const {
|
250
239
|
constexpr int total_significant_bits = SignificantBits << Shift;
|
251
240
|
constexpr int extra_bits = sizeof(T) * 8 - total_significant_bits;
|
252
|
-
return
|
241
|
+
return countl_zero(mask_ << extra_bits) >> Shift;
|
253
242
|
}
|
254
243
|
|
255
244
|
private:
|
@@ -380,8 +369,8 @@ struct GroupSse2Impl {
|
|
380
369
|
// Returns the number of trailing empty or deleted elements in the group.
|
381
370
|
uint32_t CountLeadingEmptyOrDeleted() const {
|
382
371
|
auto special = _mm_set1_epi8(kSentinel);
|
383
|
-
return TrailingZeros(
|
384
|
-
_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1);
|
372
|
+
return TrailingZeros(static_cast<uint32_t>(
|
373
|
+
_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1));
|
385
374
|
}
|
386
375
|
|
387
376
|
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
|
@@ -472,25 +461,23 @@ inline bool IsValidCapacity(size_t n) { return ((n + 1) & n) == 0 && n > 0; }
|
|
472
461
|
// DELETED -> EMPTY
|
473
462
|
// EMPTY -> EMPTY
|
474
463
|
// FULL -> DELETED
|
475
|
-
|
476
|
-
ctrl_t* ctrl, size_t capacity) {
|
477
|
-
assert(ctrl[capacity] == kSentinel);
|
478
|
-
assert(IsValidCapacity(capacity));
|
479
|
-
for (ctrl_t* pos = ctrl; pos != ctrl + capacity + 1; pos += Group::kWidth) {
|
480
|
-
Group{pos}.ConvertSpecialToEmptyAndFullToDeleted(pos);
|
481
|
-
}
|
482
|
-
// Copy the cloned ctrl bytes.
|
483
|
-
std::memcpy(ctrl + capacity + 1, ctrl, Group::kWidth);
|
484
|
-
ctrl[capacity] = kSentinel;
|
485
|
-
}
|
464
|
+
void ConvertDeletedToEmptyAndFullToDeleted(ctrl_t* ctrl, size_t capacity);
|
486
465
|
|
487
466
|
// Rounds up the capacity to the next power of 2 minus 1, with a minimum of 1.
|
488
467
|
inline size_t NormalizeCapacity(size_t n) {
|
489
|
-
return n ? ~size_t{} >>
|
468
|
+
return n ? ~size_t{} >> countl_zero(n) : 1;
|
490
469
|
}
|
491
470
|
|
492
|
-
//
|
493
|
-
// For 16-wide groups, that gives an
|
471
|
+
// General notes on capacity/growth methods below:
|
472
|
+
// - We use 7/8th as maximum load factor. For 16-wide groups, that gives an
|
473
|
+
// average of two empty slots per group.
|
474
|
+
// - For (capacity+1) >= Group::kWidth, growth is 7/8*capacity.
|
475
|
+
// - For (capacity+1) < Group::kWidth, growth == capacity. In this case, we
|
476
|
+
// never need to probe (the whole table fits in one group) so we don't need a
|
477
|
+
// load factor less than 1.
|
478
|
+
|
479
|
+
// Given `capacity` of the table, returns the size (i.e. number of full slots)
|
480
|
+
// at which we should grow the capacity.
|
494
481
|
inline size_t CapacityToGrowth(size_t capacity) {
|
495
482
|
assert(IsValidCapacity(capacity));
|
496
483
|
// `capacity*7/8`
|
@@ -501,7 +488,7 @@ inline size_t CapacityToGrowth(size_t capacity) {
|
|
501
488
|
return capacity - capacity / 8;
|
502
489
|
}
|
503
490
|
// From desired "growth" to a lowerbound of the necessary capacity.
|
504
|
-
// Might not be a valid one and
|
491
|
+
// Might not be a valid one and requires NormalizeCapacity().
|
505
492
|
inline size_t GrowthToLowerboundCapacity(size_t growth) {
|
506
493
|
// `growth*8/7`
|
507
494
|
if (Group::kWidth == 8 && growth == 7) {
|
@@ -523,6 +510,64 @@ inline void AssertIsValid(ctrl_t* ctrl) {
|
|
523
510
|
"been erased, or the table might have rehashed.");
|
524
511
|
}
|
525
512
|
|
513
|
+
struct FindInfo {
|
514
|
+
size_t offset;
|
515
|
+
size_t probe_length;
|
516
|
+
};
|
517
|
+
|
518
|
+
// The representation of the object has two modes:
|
519
|
+
// - small: For capacities < kWidth-1
|
520
|
+
// - large: For the rest.
|
521
|
+
//
|
522
|
+
// Differences:
|
523
|
+
// - In small mode we are able to use the whole capacity. The extra control
|
524
|
+
// bytes give us at least one "empty" control byte to stop the iteration.
|
525
|
+
// This is important to make 1 a valid capacity.
|
526
|
+
//
|
527
|
+
// - In small mode only the first `capacity()` control bytes after the
|
528
|
+
// sentinel are valid. The rest contain dummy kEmpty values that do not
|
529
|
+
// represent a real slot. This is important to take into account on
|
530
|
+
// find_first_non_full(), where we never try ShouldInsertBackwards() for
|
531
|
+
// small tables.
|
532
|
+
inline bool is_small(size_t capacity) { return capacity < Group::kWidth - 1; }
|
533
|
+
|
534
|
+
inline probe_seq<Group::kWidth> probe(ctrl_t* ctrl, size_t hash,
|
535
|
+
size_t capacity) {
|
536
|
+
return probe_seq<Group::kWidth>(H1(hash, ctrl), capacity);
|
537
|
+
}
|
538
|
+
|
539
|
+
// Probes the raw_hash_set with the probe sequence for hash and returns the
|
540
|
+
// pointer to the first empty or deleted slot.
|
541
|
+
// NOTE: this function must work with tables having both kEmpty and kDelete
|
542
|
+
// in one group. Such tables appears during drop_deletes_without_resize.
|
543
|
+
//
|
544
|
+
// This function is very useful when insertions happen and:
|
545
|
+
// - the input is already a set
|
546
|
+
// - there are enough slots
|
547
|
+
// - the element with the hash is not in the table
|
548
|
+
inline FindInfo find_first_non_full(ctrl_t* ctrl, size_t hash,
|
549
|
+
size_t capacity) {
|
550
|
+
auto seq = probe(ctrl, hash, capacity);
|
551
|
+
while (true) {
|
552
|
+
Group g{ctrl + seq.offset()};
|
553
|
+
auto mask = g.MatchEmptyOrDeleted();
|
554
|
+
if (mask) {
|
555
|
+
#if !defined(NDEBUG)
|
556
|
+
// We want to add entropy even when ASLR is not enabled.
|
557
|
+
// In debug build we will randomly insert in either the front or back of
|
558
|
+
// the group.
|
559
|
+
// TODO(kfm,sbenza): revisit after we do unconditional mixing
|
560
|
+
if (!is_small(capacity) && ShouldInsertBackwards(hash, ctrl)) {
|
561
|
+
return {seq.offset(mask.HighestBitSet()), seq.index()};
|
562
|
+
}
|
563
|
+
#endif
|
564
|
+
return {seq.offset(mask.LowestBitSet()), seq.index()};
|
565
|
+
}
|
566
|
+
seq.next();
|
567
|
+
assert(seq.index() < capacity && "full table!");
|
568
|
+
}
|
569
|
+
}
|
570
|
+
|
526
571
|
// Policy: a policy defines how to perform different operations on
|
527
572
|
// the slots of the hashtable (see hash_policy_traits.h for the full interface
|
528
573
|
// of policy).
|
@@ -747,10 +792,10 @@ class raw_hash_set {
|
|
747
792
|
explicit raw_hash_set(size_t bucket_count, const hasher& hash = hasher(),
|
748
793
|
const key_equal& eq = key_equal(),
|
749
794
|
const allocator_type& alloc = allocator_type())
|
750
|
-
: ctrl_(EmptyGroup()),
|
795
|
+
: ctrl_(EmptyGroup()),
|
796
|
+
settings_(0, HashtablezInfoHandle(), hash, eq, alloc) {
|
751
797
|
if (bucket_count) {
|
752
798
|
capacity_ = NormalizeCapacity(bucket_count);
|
753
|
-
reset_growth_left();
|
754
799
|
initialize_slots();
|
755
800
|
}
|
756
801
|
}
|
@@ -856,10 +901,10 @@ class raw_hash_set {
|
|
856
901
|
// than a full `insert`.
|
857
902
|
for (const auto& v : that) {
|
858
903
|
const size_t hash = PolicyTraits::apply(HashElement{hash_ref()}, v);
|
859
|
-
auto target = find_first_non_full(hash);
|
904
|
+
auto target = find_first_non_full(ctrl_, hash, capacity_);
|
860
905
|
set_ctrl(target.offset, H2(hash));
|
861
906
|
emplace_at(target.offset, v);
|
862
|
-
|
907
|
+
infoz().RecordInsert(hash, target.probe_length);
|
863
908
|
}
|
864
909
|
size_ = that.size();
|
865
910
|
growth_left() -= that.size();
|
@@ -873,28 +918,27 @@ class raw_hash_set {
|
|
873
918
|
slots_(absl::exchange(that.slots_, nullptr)),
|
874
919
|
size_(absl::exchange(that.size_, 0)),
|
875
920
|
capacity_(absl::exchange(that.capacity_, 0)),
|
876
|
-
infoz_(absl::exchange(that.infoz_, HashtablezInfoHandle())),
|
877
921
|
// Hash, equality and allocator are copied instead of moved because
|
878
922
|
// `that` must be left valid. If Hash is std::function<Key>, moving it
|
879
923
|
// would create a nullptr functor that cannot be called.
|
880
|
-
settings_(that.
|
881
|
-
|
882
|
-
|
883
|
-
}
|
924
|
+
settings_(absl::exchange(that.growth_left(), 0),
|
925
|
+
absl::exchange(that.infoz(), HashtablezInfoHandle()),
|
926
|
+
that.hash_ref(), that.eq_ref(), that.alloc_ref()) {}
|
884
927
|
|
885
928
|
raw_hash_set(raw_hash_set&& that, const allocator_type& a)
|
886
929
|
: ctrl_(EmptyGroup()),
|
887
930
|
slots_(nullptr),
|
888
931
|
size_(0),
|
889
932
|
capacity_(0),
|
890
|
-
settings_(0, that.hash_ref(), that.eq_ref(),
|
933
|
+
settings_(0, HashtablezInfoHandle(), that.hash_ref(), that.eq_ref(),
|
934
|
+
a) {
|
891
935
|
if (a == that.alloc_ref()) {
|
892
936
|
std::swap(ctrl_, that.ctrl_);
|
893
937
|
std::swap(slots_, that.slots_);
|
894
938
|
std::swap(size_, that.size_);
|
895
939
|
std::swap(capacity_, that.capacity_);
|
896
940
|
std::swap(growth_left(), that.growth_left());
|
897
|
-
std::swap(
|
941
|
+
std::swap(infoz(), that.infoz());
|
898
942
|
} else {
|
899
943
|
reserve(that.size());
|
900
944
|
// Note: this will copy elements of dense_set and unordered_set instead of
|
@@ -965,7 +1009,7 @@ class raw_hash_set {
|
|
965
1009
|
reset_growth_left();
|
966
1010
|
}
|
967
1011
|
assert(empty());
|
968
|
-
|
1012
|
+
infoz().RecordStorageChanged(0, capacity_);
|
969
1013
|
}
|
970
1014
|
|
971
1015
|
// This overload kicks in when the argument is an rvalue of insertable and
|
@@ -1038,7 +1082,7 @@ class raw_hash_set {
|
|
1038
1082
|
|
1039
1083
|
template <class InputIt>
|
1040
1084
|
void insert(InputIt first, InputIt last) {
|
1041
|
-
for (; first != last; ++first)
|
1085
|
+
for (; first != last; ++first) emplace(*first);
|
1042
1086
|
}
|
1043
1087
|
|
1044
1088
|
template <class T, RequiresNotInit<T> = 0, RequiresInsertable<const T&> = 0>
|
@@ -1065,7 +1109,9 @@ class raw_hash_set {
|
|
1065
1109
|
}
|
1066
1110
|
|
1067
1111
|
iterator insert(const_iterator, node_type&& node) {
|
1068
|
-
|
1112
|
+
auto res = insert(std::move(node));
|
1113
|
+
node = std::move(res.node);
|
1114
|
+
return res.position;
|
1069
1115
|
}
|
1070
1116
|
|
1071
1117
|
// This overload kicks in if we can deduce the key from args. This enables us
|
@@ -1255,7 +1301,7 @@ class raw_hash_set {
|
|
1255
1301
|
swap(growth_left(), that.growth_left());
|
1256
1302
|
swap(hash_ref(), that.hash_ref());
|
1257
1303
|
swap(eq_ref(), that.eq_ref());
|
1258
|
-
swap(
|
1304
|
+
swap(infoz(), that.infoz());
|
1259
1305
|
SwapAlloc(alloc_ref(), that.alloc_ref(),
|
1260
1306
|
typename AllocTraits::propagate_on_container_swap{});
|
1261
1307
|
}
|
@@ -1264,7 +1310,7 @@ class raw_hash_set {
|
|
1264
1310
|
if (n == 0 && capacity_ == 0) return;
|
1265
1311
|
if (n == 0 && size_ == 0) {
|
1266
1312
|
destroy_slots();
|
1267
|
-
|
1313
|
+
infoz().RecordStorageChanged(0, 0);
|
1268
1314
|
return;
|
1269
1315
|
}
|
1270
1316
|
// bitor is a faster way of doing `max` here. We will round up to the next
|
@@ -1276,7 +1322,12 @@ class raw_hash_set {
|
|
1276
1322
|
}
|
1277
1323
|
}
|
1278
1324
|
|
1279
|
-
void reserve(size_t n) {
|
1325
|
+
void reserve(size_t n) {
|
1326
|
+
size_t m = GrowthToLowerboundCapacity(n);
|
1327
|
+
if (m > capacity_) {
|
1328
|
+
resize(NormalizeCapacity(m));
|
1329
|
+
}
|
1330
|
+
}
|
1280
1331
|
|
1281
1332
|
// Extension API: support for heterogeneous keys.
|
1282
1333
|
//
|
@@ -1301,7 +1352,7 @@ class raw_hash_set {
|
|
1301
1352
|
void prefetch(const key_arg<K>& key) const {
|
1302
1353
|
(void)key;
|
1303
1354
|
#if defined(__GNUC__)
|
1304
|
-
auto seq = probe(hash_ref()(key));
|
1355
|
+
auto seq = probe(ctrl_, hash_ref()(key), capacity_);
|
1305
1356
|
__builtin_prefetch(static_cast<const void*>(ctrl_ + seq.offset()));
|
1306
1357
|
__builtin_prefetch(static_cast<const void*>(slots_ + seq.offset()));
|
1307
1358
|
#endif // __GNUC__
|
@@ -1316,7 +1367,7 @@ class raw_hash_set {
|
|
1316
1367
|
// called heterogeneous key support.
|
1317
1368
|
template <class K = key_type>
|
1318
1369
|
iterator find(const key_arg<K>& key, size_t hash) {
|
1319
|
-
auto seq = probe(hash);
|
1370
|
+
auto seq = probe(ctrl_, hash, capacity_);
|
1320
1371
|
while (true) {
|
1321
1372
|
Group g{ctrl_ + seq.offset()};
|
1322
1373
|
for (int i : g.Match(H2(hash))) {
|
@@ -1477,7 +1528,7 @@ class raw_hash_set {
|
|
1477
1528
|
|
1478
1529
|
set_ctrl(index, was_never_full ? kEmpty : kDeleted);
|
1479
1530
|
growth_left() += was_never_full;
|
1480
|
-
|
1531
|
+
infoz().RecordErase();
|
1481
1532
|
}
|
1482
1533
|
|
1483
1534
|
void initialize_slots() {
|
@@ -1494,7 +1545,7 @@ class raw_hash_set {
|
|
1494
1545
|
// bound more carefully.
|
1495
1546
|
if (std::is_same<SlotAlloc, std::allocator<slot_type>>::value &&
|
1496
1547
|
slots_ == nullptr) {
|
1497
|
-
|
1548
|
+
infoz() = Sample();
|
1498
1549
|
}
|
1499
1550
|
|
1500
1551
|
auto layout = MakeLayout(capacity_);
|
@@ -1504,7 +1555,7 @@ class raw_hash_set {
|
|
1504
1555
|
slots_ = layout.template Pointer<1>(mem);
|
1505
1556
|
reset_ctrl();
|
1506
1557
|
reset_growth_left();
|
1507
|
-
|
1558
|
+
infoz().RecordStorageChanged(size_, capacity_);
|
1508
1559
|
}
|
1509
1560
|
|
1510
1561
|
void destroy_slots() {
|
@@ -1538,7 +1589,7 @@ class raw_hash_set {
|
|
1538
1589
|
if (IsFull(old_ctrl[i])) {
|
1539
1590
|
size_t hash = PolicyTraits::apply(HashElement{hash_ref()},
|
1540
1591
|
PolicyTraits::element(old_slots + i));
|
1541
|
-
auto target = find_first_non_full(hash);
|
1592
|
+
auto target = find_first_non_full(ctrl_, hash, capacity_);
|
1542
1593
|
size_t new_i = target.offset;
|
1543
1594
|
total_probe_length += target.probe_length;
|
1544
1595
|
set_ctrl(new_i, H2(hash));
|
@@ -1552,12 +1603,12 @@ class raw_hash_set {
|
|
1552
1603
|
Deallocate<Layout::Alignment()>(&alloc_ref(), old_ctrl,
|
1553
1604
|
layout.AllocSize());
|
1554
1605
|
}
|
1555
|
-
|
1606
|
+
infoz().RecordRehash(total_probe_length);
|
1556
1607
|
}
|
1557
1608
|
|
1558
1609
|
void drop_deletes_without_resize() ABSL_ATTRIBUTE_NOINLINE {
|
1559
1610
|
assert(IsValidCapacity(capacity_));
|
1560
|
-
assert(!is_small());
|
1611
|
+
assert(!is_small(capacity_));
|
1561
1612
|
// Algorithm:
|
1562
1613
|
// - mark all DELETED slots as EMPTY
|
1563
1614
|
// - mark all FULL slots as DELETED
|
@@ -1582,7 +1633,7 @@ class raw_hash_set {
|
|
1582
1633
|
if (!IsDeleted(ctrl_[i])) continue;
|
1583
1634
|
size_t hash = PolicyTraits::apply(HashElement{hash_ref()},
|
1584
1635
|
PolicyTraits::element(slots_ + i));
|
1585
|
-
auto target = find_first_non_full(hash);
|
1636
|
+
auto target = find_first_non_full(ctrl_, hash, capacity_);
|
1586
1637
|
size_t new_i = target.offset;
|
1587
1638
|
total_probe_length += target.probe_length;
|
1588
1639
|
|
@@ -1590,7 +1641,8 @@ class raw_hash_set {
|
|
1590
1641
|
// If they do, we don't need to move the object as it falls already in the
|
1591
1642
|
// best probe we can.
|
1592
1643
|
const auto probe_index = [&](size_t pos) {
|
1593
|
-
return ((pos - probe(hash).offset()) & capacity_) /
|
1644
|
+
return ((pos - probe(ctrl_, hash, capacity_).offset()) & capacity_) /
|
1645
|
+
Group::kWidth;
|
1594
1646
|
};
|
1595
1647
|
|
1596
1648
|
// Element doesn't move.
|
@@ -1617,7 +1669,7 @@ class raw_hash_set {
|
|
1617
1669
|
}
|
1618
1670
|
}
|
1619
1671
|
reset_growth_left();
|
1620
|
-
|
1672
|
+
infoz().RecordRehash(total_probe_length);
|
1621
1673
|
}
|
1622
1674
|
|
1623
1675
|
void rehash_and_grow_if_necessary() {
|
@@ -1634,7 +1686,7 @@ class raw_hash_set {
|
|
1634
1686
|
|
1635
1687
|
bool has_element(const value_type& elem) const {
|
1636
1688
|
size_t hash = PolicyTraits::apply(HashElement{hash_ref()}, elem);
|
1637
|
-
auto seq = probe(hash);
|
1689
|
+
auto seq = probe(ctrl_, hash, capacity_);
|
1638
1690
|
while (true) {
|
1639
1691
|
Group g{ctrl_ + seq.offset()};
|
1640
1692
|
for (int i : g.Match(H2(hash))) {
|
@@ -1649,41 +1701,6 @@ class raw_hash_set {
|
|
1649
1701
|
return false;
|
1650
1702
|
}
|
1651
1703
|
|
1652
|
-
// Probes the raw_hash_set with the probe sequence for hash and returns the
|
1653
|
-
// pointer to the first empty or deleted slot.
|
1654
|
-
// NOTE: this function must work with tables having both kEmpty and kDelete
|
1655
|
-
// in one group. Such tables appears during drop_deletes_without_resize.
|
1656
|
-
//
|
1657
|
-
// This function is very useful when insertions happen and:
|
1658
|
-
// - the input is already a set
|
1659
|
-
// - there are enough slots
|
1660
|
-
// - the element with the hash is not in the table
|
1661
|
-
struct FindInfo {
|
1662
|
-
size_t offset;
|
1663
|
-
size_t probe_length;
|
1664
|
-
};
|
1665
|
-
FindInfo find_first_non_full(size_t hash) {
|
1666
|
-
auto seq = probe(hash);
|
1667
|
-
while (true) {
|
1668
|
-
Group g{ctrl_ + seq.offset()};
|
1669
|
-
auto mask = g.MatchEmptyOrDeleted();
|
1670
|
-
if (mask) {
|
1671
|
-
#if !defined(NDEBUG)
|
1672
|
-
// We want to add entropy even when ASLR is not enabled.
|
1673
|
-
// In debug build we will randomly insert in either the front or back of
|
1674
|
-
// the group.
|
1675
|
-
// TODO(kfm,sbenza): revisit after we do unconditional mixing
|
1676
|
-
if (!is_small() && ShouldInsertBackwards(hash, ctrl_)) {
|
1677
|
-
return {seq.offset(mask.HighestBitSet()), seq.index()};
|
1678
|
-
}
|
1679
|
-
#endif
|
1680
|
-
return {seq.offset(mask.LowestBitSet()), seq.index()};
|
1681
|
-
}
|
1682
|
-
seq.next();
|
1683
|
-
assert(seq.index() < capacity_ && "full table!");
|
1684
|
-
}
|
1685
|
-
}
|
1686
|
-
|
1687
1704
|
// TODO(alkis): Optimize this assuming *this and that don't overlap.
|
1688
1705
|
raw_hash_set& move_assign(raw_hash_set&& that, std::true_type) {
|
1689
1706
|
raw_hash_set tmp(std::move(that));
|
@@ -1700,7 +1717,7 @@ class raw_hash_set {
|
|
1700
1717
|
template <class K>
|
1701
1718
|
std::pair<size_t, bool> find_or_prepare_insert(const K& key) {
|
1702
1719
|
auto hash = hash_ref()(key);
|
1703
|
-
auto seq = probe(hash);
|
1720
|
+
auto seq = probe(ctrl_, hash, capacity_);
|
1704
1721
|
while (true) {
|
1705
1722
|
Group g{ctrl_ + seq.offset()};
|
1706
1723
|
for (int i : g.Match(H2(hash))) {
|
@@ -1717,16 +1734,16 @@ class raw_hash_set {
|
|
1717
1734
|
}
|
1718
1735
|
|
1719
1736
|
size_t prepare_insert(size_t hash) ABSL_ATTRIBUTE_NOINLINE {
|
1720
|
-
auto target = find_first_non_full(hash);
|
1737
|
+
auto target = find_first_non_full(ctrl_, hash, capacity_);
|
1721
1738
|
if (ABSL_PREDICT_FALSE(growth_left() == 0 &&
|
1722
1739
|
!IsDeleted(ctrl_[target.offset]))) {
|
1723
1740
|
rehash_and_grow_if_necessary();
|
1724
|
-
target = find_first_non_full(hash);
|
1741
|
+
target = find_first_non_full(ctrl_, hash, capacity_);
|
1725
1742
|
}
|
1726
1743
|
++size_;
|
1727
1744
|
growth_left() -= IsEmpty(ctrl_[target.offset]);
|
1728
1745
|
set_ctrl(target.offset, H2(hash));
|
1729
|
-
|
1746
|
+
infoz().RecordInsert(hash, target.probe_length);
|
1730
1747
|
return target.offset;
|
1731
1748
|
}
|
1732
1749
|
|
@@ -1754,10 +1771,6 @@ class raw_hash_set {
|
|
1754
1771
|
private:
|
1755
1772
|
friend struct RawHashSetTestOnlyAccess;
|
1756
1773
|
|
1757
|
-
probe_seq<Group::kWidth> probe(size_t hash) const {
|
1758
|
-
return probe_seq<Group::kWidth>(H1(hash, ctrl_), capacity_);
|
1759
|
-
}
|
1760
|
-
|
1761
1774
|
// Reset all ctrl bytes back to kEmpty, except the sentinel.
|
1762
1775
|
void reset_ctrl() {
|
1763
1776
|
std::memset(ctrl_, kEmpty, capacity_ + Group::kWidth);
|
@@ -1787,29 +1800,15 @@ class raw_hash_set {
|
|
1787
1800
|
|
1788
1801
|
size_t& growth_left() { return settings_.template get<0>(); }
|
1789
1802
|
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
// This is important to make 1 a valid capacity.
|
1798
|
-
//
|
1799
|
-
// - In small mode only the first `capacity()` control bytes after the
|
1800
|
-
// sentinel are valid. The rest contain dummy kEmpty values that do not
|
1801
|
-
// represent a real slot. This is important to take into account on
|
1802
|
-
// find_first_non_full(), where we never try ShouldInsertBackwards() for
|
1803
|
-
// small tables.
|
1804
|
-
bool is_small() const { return capacity_ < Group::kWidth - 1; }
|
1805
|
-
|
1806
|
-
hasher& hash_ref() { return settings_.template get<1>(); }
|
1807
|
-
const hasher& hash_ref() const { return settings_.template get<1>(); }
|
1808
|
-
key_equal& eq_ref() { return settings_.template get<2>(); }
|
1809
|
-
const key_equal& eq_ref() const { return settings_.template get<2>(); }
|
1810
|
-
allocator_type& alloc_ref() { return settings_.template get<3>(); }
|
1803
|
+
HashtablezInfoHandle& infoz() { return settings_.template get<1>(); }
|
1804
|
+
|
1805
|
+
hasher& hash_ref() { return settings_.template get<2>(); }
|
1806
|
+
const hasher& hash_ref() const { return settings_.template get<2>(); }
|
1807
|
+
key_equal& eq_ref() { return settings_.template get<3>(); }
|
1808
|
+
const key_equal& eq_ref() const { return settings_.template get<3>(); }
|
1809
|
+
allocator_type& alloc_ref() { return settings_.template get<4>(); }
|
1811
1810
|
const allocator_type& alloc_ref() const {
|
1812
|
-
return settings_.template get<
|
1811
|
+
return settings_.template get<4>();
|
1813
1812
|
}
|
1814
1813
|
|
1815
1814
|
// TODO(alkis): Investigate removing some of these fields:
|
@@ -1819,10 +1818,11 @@ class raw_hash_set {
|
|
1819
1818
|
slot_type* slots_ = nullptr; // [capacity * slot_type]
|
1820
1819
|
size_t size_ = 0; // number of full slots
|
1821
1820
|
size_t capacity_ = 0; // total number of slots
|
1822
|
-
|
1823
|
-
|
1821
|
+
absl::container_internal::CompressedTuple<size_t /* growth_left */,
|
1822
|
+
HashtablezInfoHandle, hasher,
|
1824
1823
|
key_equal, allocator_type>
|
1825
|
-
settings_{0,
|
1824
|
+
settings_{0, HashtablezInfoHandle{}, hasher{}, key_equal{},
|
1825
|
+
allocator_type{}};
|
1826
1826
|
};
|
1827
1827
|
|
1828
1828
|
// Erases all elements that satisfy the predicate `pred` from the container `c`.
|
@@ -1846,7 +1846,7 @@ struct HashtableDebugAccess<Set, absl::void_t<typename Set::raw_hash_set>> {
|
|
1846
1846
|
const typename Set::key_type& key) {
|
1847
1847
|
size_t num_probes = 0;
|
1848
1848
|
size_t hash = set.hash_ref()(key);
|
1849
|
-
auto seq = set.
|
1849
|
+
auto seq = probe(set.ctrl_, hash, set.capacity_);
|
1850
1850
|
while (true) {
|
1851
1851
|
container_internal::Group g{set.ctrl_ + seq.offset()};
|
1852
1852
|
for (int i : g.Match(container_internal::H2(hash))) {
|