grpc 1.57.0 → 1.58.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +534 -284
- data/include/grpc/event_engine/event_engine.h +0 -1
- data/include/grpc/event_engine/memory_allocator.h +2 -2
- data/include/grpc/impl/channel_arg_names.h +371 -0
- data/include/grpc/impl/grpc_types.h +1 -353
- data/include/grpc/module.modulemap +1 -0
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -1
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +2 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +7 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +10 -5
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +5 -3
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +115 -109
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +0 -5
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +7 -2
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +11 -3
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +6 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +8 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
- 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 +9 -4
- 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 +41 -14
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +3 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/retry_filter.h +1 -0
- data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +9 -5
- data/src/core/ext/filters/client_channel/subchannel.h +8 -2
- 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 +1 -0
- 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_service_config_parser.cc +4 -7
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -12
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +357 -358
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -18
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +63 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +7 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +30 -57
- data/src/core/ext/transport/chttp2/transport/parsing.cc +16 -7
- 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 +81 -89
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -0
- data/src/core/ext/xds/xds_client_grpc.cc +1 -0
- data/src/core/ext/xds/xds_http_fault_filter.cc +1 -2
- data/src/core/ext/xds/xds_http_fault_filter.h +1 -2
- data/src/core/ext/xds/xds_http_filters.h +2 -4
- data/src/core/ext/xds/xds_http_rbac_filter.cc +3 -8
- data/src/core/ext/xds/xds_http_rbac_filter.h +1 -2
- data/src/core/ext/xds/xds_http_stateful_session_filter.cc +1 -2
- data/src/core/ext/xds/xds_http_stateful_session_filter.h +1 -2
- data/src/core/ext/xds/xds_lb_policy_registry.cc +3 -6
- data/src/core/ext/xds/xds_routing.cc +2 -2
- data/src/core/ext/xds/xds_transport_grpc.cc +1 -0
- data/src/core/lib/avl/avl.h +10 -173
- 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 +84 -79
- data/src/core/lib/channel/channel_args.h +29 -17
- data/src/core/lib/channel/connected_channel.cc +0 -1
- data/src/core/lib/channel/promise_based_filter.cc +4 -1
- data/src/core/lib/compression/compression_internal.cc +8 -4
- data/src/core/lib/debug/stats_data.cc +93 -21
- data/src/core/lib/debug/stats_data.h +41 -0
- 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 +9 -3
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +2 -2
- 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/forkable.cc +15 -1
- 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/posix_engine/ev_poll_posix.cc +25 -3
- 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/posix_endpoint.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +47 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +12 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -0
- data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +2 -0
- 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/thread_pool/thread_pool_factory.cc +7 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +86 -111
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +15 -61
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +3 -4
- data/src/core/lib/experiments/config.cc +14 -0
- data/src/core/lib/experiments/experiments.cc +141 -304
- data/src/core/lib/experiments/experiments.h +16 -17
- data/src/core/lib/gprpp/ref_counted.h +3 -1
- 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/time.h +2 -2
- 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_security_connector.cc +1 -0
- data/src/core/lib/iomgr/buffer_list.cc +2 -0
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +7 -22
- data/src/core/lib/iomgr/tcp_posix.cc +3 -3
- data/src/core/lib/promise/detail/basic_seq.h +1 -372
- data/src/core/lib/promise/detail/seq_state.h +2076 -0
- data/src/core/lib/promise/seq.h +19 -2
- data/src/core/lib/promise/sleep.h +5 -10
- data/src/core/lib/promise/try_seq.h +34 -2
- 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 +0 -1
- data/src/core/lib/resource_quota/resource_quota.h +1 -0
- data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
- data/src/core/lib/security/authorization/rbac_policy.h +1 -1
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +8 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +17 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +4 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +42 -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/tls_credentials.cc +1 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +1 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +1 -0
- 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/surface/call.cc +32 -8
- data/src/core/lib/surface/channel.cc +1 -0
- data/src/core/lib/surface/completion_queue.cc +10 -0
- 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/version.cc +2 -2
- data/src/core/tsi/alts/crypt/aes_gcm.cc +27 -2
- data/src/core/tsi/ssl_transport_security.cc +11 -0
- data/src/ruby/lib/grpc/generic/active_call.rb +9 -14
- data/src/ruby/lib/grpc/version.rb +1 -1
- 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 +15 -14
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strex.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +7 -3
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/bio/errno.c +92 -0
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +4 -48
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +11 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +16 -6
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +9 -0
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +0 -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_openbsd.c +0 -1
- 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/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/ec_extra/hash_to_curve.c +9 -14
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +4 -6
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +10 -11
- 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 +38 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +39 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/service_indicator.c +4 -7
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +13 -21
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +6 -23
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +0 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.c +1 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +2 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +9 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +11 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +7 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +6 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +22 -20
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +20 -12
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +50 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +4 -4
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -0
- metadata +41 -33
- 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/cpu_aarch64_freebsd.c +0 -62
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm.c +0 -38
- data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +0 -31
- 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
@@ -76,13 +76,6 @@ using IsAtLeastForwardIterator = std::is_convertible<
|
|
76
76
|
typename std::iterator_traits<Iterator>::iterator_category,
|
77
77
|
std::forward_iterator_tag>;
|
78
78
|
|
79
|
-
template <typename A>
|
80
|
-
using IsMemcpyOk =
|
81
|
-
absl::conjunction<std::is_same<A, std::allocator<ValueType<A>>>,
|
82
|
-
absl::is_trivially_copy_constructible<ValueType<A>>,
|
83
|
-
absl::is_trivially_copy_assignable<ValueType<A>>,
|
84
|
-
absl::is_trivially_destructible<ValueType<A>>>;
|
85
|
-
|
86
79
|
template <typename A>
|
87
80
|
using IsMoveAssignOk = std::is_move_assignable<ValueType<A>>;
|
88
81
|
template <typename A>
|
@@ -308,11 +301,36 @@ class Storage {
|
|
308
301
|
struct ElementwiseConstructPolicy {};
|
309
302
|
|
310
303
|
using MoveAssignmentPolicy = absl::conditional_t<
|
311
|
-
|
304
|
+
// Fast path: if the value type can be trivially move assigned and
|
305
|
+
// destroyed, and we know the allocator doesn't do anything fancy, then
|
306
|
+
// it's safe for us to simply adopt the contents of the storage for
|
307
|
+
// `other` and remove its own reference to them. It's as if we had
|
308
|
+
// individually move-assigned each value and then destroyed the original.
|
309
|
+
absl::conjunction<absl::is_trivially_move_assignable<ValueType<A>>,
|
310
|
+
absl::is_trivially_destructible<ValueType<A>>,
|
311
|
+
std::is_same<A, std::allocator<ValueType<A>>>>::value,
|
312
|
+
MemcpyPolicy,
|
313
|
+
// Otherwise we use move assignment if possible. If not, we simulate
|
314
|
+
// move assignment using move construction.
|
315
|
+
//
|
316
|
+
// Note that this is in contrast to e.g. std::vector and std::optional,
|
317
|
+
// which are themselves not move-assignable when their contained type is
|
318
|
+
// not.
|
312
319
|
absl::conditional_t<IsMoveAssignOk<A>::value, ElementwiseAssignPolicy,
|
313
320
|
ElementwiseConstructPolicy>>;
|
314
|
-
|
315
|
-
|
321
|
+
|
322
|
+
// The policy to be used specifically when swapping inlined elements.
|
323
|
+
using SwapInlinedElementsPolicy = absl::conditional_t<
|
324
|
+
// Fast path: if the value type can be trivially move constructed/assigned
|
325
|
+
// and destroyed, and we know the allocator doesn't do anything fancy,
|
326
|
+
// then it's safe for us to simply swap the bytes in the inline storage.
|
327
|
+
// It's as if we had move-constructed a temporary vector, move-assigned
|
328
|
+
// one to the other, then move-assigned the first from the temporary.
|
329
|
+
absl::conjunction<absl::is_trivially_move_constructible<ValueType<A>>,
|
330
|
+
absl::is_trivially_move_assignable<ValueType<A>>,
|
331
|
+
absl::is_trivially_destructible<ValueType<A>>,
|
332
|
+
std::is_same<A, std::allocator<ValueType<A>>>>::value,
|
333
|
+
MemcpyPolicy,
|
316
334
|
absl::conditional_t<IsSwapOk<A>::value, ElementwiseSwapPolicy,
|
317
335
|
ElementwiseConstructPolicy>>;
|
318
336
|
|
@@ -335,14 +353,21 @@ class Storage {
|
|
335
353
|
: metadata_(allocator, /* size and is_allocated */ 0u) {}
|
336
354
|
|
337
355
|
~Storage() {
|
356
|
+
// Fast path: if we are empty and not allocated, there's nothing to do.
|
338
357
|
if (GetSizeAndIsAllocated() == 0) {
|
339
|
-
|
340
|
-
}
|
341
|
-
|
358
|
+
return;
|
359
|
+
}
|
360
|
+
|
361
|
+
// Fast path: if no destructors need to be run and we know the allocator
|
362
|
+
// doesn't do anything fancy, then all we need to do is deallocate (and
|
363
|
+
// maybe not even that).
|
364
|
+
if (absl::is_trivially_destructible<ValueType<A>>::value &&
|
365
|
+
std::is_same<A, std::allocator<ValueType<A>>>::value) {
|
342
366
|
DeallocateIfAllocated();
|
343
|
-
|
344
|
-
DestroyContents();
|
367
|
+
return;
|
345
368
|
}
|
369
|
+
|
370
|
+
DestroyContents();
|
346
371
|
}
|
347
372
|
|
348
373
|
// ---------------------------------------------------------------------------
|
@@ -365,14 +390,18 @@ class Storage {
|
|
365
390
|
return data_.allocated.allocated_data;
|
366
391
|
}
|
367
392
|
|
368
|
-
|
369
|
-
|
370
|
-
|
393
|
+
// ABSL_ATTRIBUTE_NO_SANITIZE_CFI is used because the memory pointed to may be
|
394
|
+
// uninitialized, a common pattern in allocate()+construct() APIs.
|
395
|
+
// https://clang.llvm.org/docs/ControlFlowIntegrity.html#bad-cast-checking
|
396
|
+
// NOTE: When this was written, LLVM documentation did not explicitly
|
397
|
+
// mention that casting `char*` and using `reinterpret_cast` qualifies
|
398
|
+
// as a bad cast.
|
399
|
+
ABSL_ATTRIBUTE_NO_SANITIZE_CFI Pointer<A> GetInlinedData() {
|
400
|
+
return reinterpret_cast<Pointer<A>>(data_.inlined.inlined_data);
|
371
401
|
}
|
372
402
|
|
373
|
-
ConstPointer<A> GetInlinedData() const {
|
374
|
-
return reinterpret_cast<ConstPointer<A>>(
|
375
|
-
std::addressof(data_.inlined.inlined_data[0]));
|
403
|
+
ABSL_ATTRIBUTE_NO_SANITIZE_CFI ConstPointer<A> GetInlinedData() const {
|
404
|
+
return reinterpret_cast<ConstPointer<A>>(data_.inlined.inlined_data);
|
376
405
|
}
|
377
406
|
|
378
407
|
SizeType<A> GetAllocatedCapacity() const {
|
@@ -461,8 +490,32 @@ class Storage {
|
|
461
490
|
}
|
462
491
|
|
463
492
|
void MemcpyFrom(const Storage& other_storage) {
|
464
|
-
|
465
|
-
|
493
|
+
// Assumption check: it doesn't make sense to memcpy inlined elements unless
|
494
|
+
// we know the allocator doesn't do anything fancy, and one of the following
|
495
|
+
// holds:
|
496
|
+
//
|
497
|
+
// * The elements are trivially relocatable.
|
498
|
+
//
|
499
|
+
// * It's possible to trivially assign the elements and then destroy the
|
500
|
+
// source.
|
501
|
+
//
|
502
|
+
// * It's possible to trivially copy construct/assign the elements.
|
503
|
+
//
|
504
|
+
{
|
505
|
+
using V = ValueType<A>;
|
506
|
+
ABSL_HARDENING_ASSERT(
|
507
|
+
other_storage.GetIsAllocated() ||
|
508
|
+
(std::is_same<A, std::allocator<V>>::value &&
|
509
|
+
(
|
510
|
+
// First case above
|
511
|
+
absl::is_trivially_relocatable<V>::value ||
|
512
|
+
// Second case above
|
513
|
+
(absl::is_trivially_move_assignable<V>::value &&
|
514
|
+
absl::is_trivially_destructible<V>::value) ||
|
515
|
+
// Third case above
|
516
|
+
(absl::is_trivially_copy_constructible<V>::value ||
|
517
|
+
absl::is_trivially_copy_assignable<V>::value))));
|
518
|
+
}
|
466
519
|
|
467
520
|
GetSizeAndIsAllocated() = other_storage.GetSizeAndIsAllocated();
|
468
521
|
data_ = other_storage.data_;
|
@@ -542,13 +595,19 @@ void Storage<T, N, A>::InitFrom(const Storage& other) {
|
|
542
595
|
dst = allocation.data;
|
543
596
|
src = other.GetAllocatedData();
|
544
597
|
}
|
545
|
-
|
598
|
+
|
599
|
+
// Fast path: if the value type is trivially copy constructible and we know
|
600
|
+
// the allocator doesn't do anything fancy, then we know it is legal for us to
|
601
|
+
// simply memcpy the other vector's elements.
|
602
|
+
if (absl::is_trivially_copy_constructible<ValueType<A>>::value &&
|
603
|
+
std::is_same<A, std::allocator<ValueType<A>>>::value) {
|
546
604
|
std::memcpy(reinterpret_cast<char*>(dst),
|
547
605
|
reinterpret_cast<const char*>(src), n * sizeof(ValueType<A>));
|
548
606
|
} else {
|
549
607
|
auto values = IteratorValueAdapter<A, ConstPointer<A>>(src);
|
550
608
|
ConstructElements<A>(GetAllocator(), dst, values, n);
|
551
609
|
}
|
610
|
+
|
552
611
|
GetSizeAndIsAllocated() = other.GetSizeAndIsAllocated();
|
553
612
|
}
|
554
613
|
|
@@ -921,7 +980,7 @@ auto Storage<T, N, A>::Swap(Storage* other_storage_ptr) -> void {
|
|
921
980
|
if (GetIsAllocated() && other_storage_ptr->GetIsAllocated()) {
|
922
981
|
swap(data_.allocated, other_storage_ptr->data_.allocated);
|
923
982
|
} else if (!GetIsAllocated() && !other_storage_ptr->GetIsAllocated()) {
|
924
|
-
SwapInlinedElements(
|
983
|
+
SwapInlinedElements(SwapInlinedElementsPolicy{}, other_storage_ptr);
|
925
984
|
} else {
|
926
985
|
Storage* allocated_ptr = this;
|
927
986
|
Storage* inlined_ptr = other_storage_ptr;
|
@@ -995,7 +1054,7 @@ template <typename NotMemcpyPolicy>
|
|
995
1054
|
void Storage<T, N, A>::SwapInlinedElements(NotMemcpyPolicy policy,
|
996
1055
|
Storage* other) {
|
997
1056
|
// Note: `destroy` needs to use pre-swap allocator while `construct` -
|
998
|
-
// post-swap allocator. Allocators will be
|
1057
|
+
// post-swap allocator. Allocators will be swapped later on outside of
|
999
1058
|
// `SwapInlinedElements`.
|
1000
1059
|
Storage* small_ptr = this;
|
1001
1060
|
Storage* large_ptr = other;
|
@@ -71,43 +71,51 @@ class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
|
|
71
71
|
// m.insert_or_assign(n, n);
|
72
72
|
template <class K = key_type, class V = mapped_type, K* = nullptr,
|
73
73
|
V* = nullptr>
|
74
|
-
std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, V&& v)
|
74
|
+
std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, V&& v)
|
75
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
75
76
|
return insert_or_assign_impl(std::forward<K>(k), std::forward<V>(v));
|
76
77
|
}
|
77
78
|
|
78
79
|
template <class K = key_type, class V = mapped_type, K* = nullptr>
|
79
|
-
std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, const V& v)
|
80
|
+
std::pair<iterator, bool> insert_or_assign(key_arg<K>&& k, const V& v)
|
81
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
80
82
|
return insert_or_assign_impl(std::forward<K>(k), v);
|
81
83
|
}
|
82
84
|
|
83
85
|
template <class K = key_type, class V = mapped_type, V* = nullptr>
|
84
|
-
std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, V&& v)
|
86
|
+
std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, V&& v)
|
87
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
85
88
|
return insert_or_assign_impl(k, std::forward<V>(v));
|
86
89
|
}
|
87
90
|
|
88
91
|
template <class K = key_type, class V = mapped_type>
|
89
|
-
std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, const V& v)
|
92
|
+
std::pair<iterator, bool> insert_or_assign(const key_arg<K>& k, const V& v)
|
93
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
90
94
|
return insert_or_assign_impl(k, v);
|
91
95
|
}
|
92
96
|
|
93
97
|
template <class K = key_type, class V = mapped_type, K* = nullptr,
|
94
98
|
V* = nullptr>
|
95
|
-
iterator insert_or_assign(const_iterator, key_arg<K>&& k,
|
99
|
+
iterator insert_or_assign(const_iterator, key_arg<K>&& k,
|
100
|
+
V&& v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
96
101
|
return insert_or_assign(std::forward<K>(k), std::forward<V>(v)).first;
|
97
102
|
}
|
98
103
|
|
99
104
|
template <class K = key_type, class V = mapped_type, K* = nullptr>
|
100
|
-
iterator insert_or_assign(const_iterator, key_arg<K>&& k,
|
105
|
+
iterator insert_or_assign(const_iterator, key_arg<K>&& k,
|
106
|
+
const V& v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
101
107
|
return insert_or_assign(std::forward<K>(k), v).first;
|
102
108
|
}
|
103
109
|
|
104
110
|
template <class K = key_type, class V = mapped_type, V* = nullptr>
|
105
|
-
iterator insert_or_assign(const_iterator, const key_arg<K>& k,
|
111
|
+
iterator insert_or_assign(const_iterator, const key_arg<K>& k,
|
112
|
+
V&& v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
106
113
|
return insert_or_assign(k, std::forward<V>(v)).first;
|
107
114
|
}
|
108
115
|
|
109
116
|
template <class K = key_type, class V = mapped_type>
|
110
|
-
iterator insert_or_assign(const_iterator, const key_arg<K>& k,
|
117
|
+
iterator insert_or_assign(const_iterator, const key_arg<K>& k,
|
118
|
+
const V& v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
111
119
|
return insert_or_assign(k, v).first;
|
112
120
|
}
|
113
121
|
|
@@ -118,29 +126,33 @@ class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
|
|
118
126
|
typename std::enable_if<
|
119
127
|
!std::is_convertible<K, const_iterator>::value, int>::type = 0,
|
120
128
|
K* = nullptr>
|
121
|
-
std::pair<iterator, bool> try_emplace(key_arg<K>&& k, Args&&... args)
|
129
|
+
std::pair<iterator, bool> try_emplace(key_arg<K>&& k, Args&&... args)
|
130
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
122
131
|
return try_emplace_impl(std::forward<K>(k), std::forward<Args>(args)...);
|
123
132
|
}
|
124
133
|
|
125
134
|
template <class K = key_type, class... Args,
|
126
135
|
typename std::enable_if<
|
127
136
|
!std::is_convertible<K, const_iterator>::value, int>::type = 0>
|
128
|
-
std::pair<iterator, bool> try_emplace(const key_arg<K>& k, Args&&... args)
|
137
|
+
std::pair<iterator, bool> try_emplace(const key_arg<K>& k, Args&&... args)
|
138
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
129
139
|
return try_emplace_impl(k, std::forward<Args>(args)...);
|
130
140
|
}
|
131
141
|
|
132
142
|
template <class K = key_type, class... Args, K* = nullptr>
|
133
|
-
iterator try_emplace(const_iterator, key_arg<K>&& k,
|
143
|
+
iterator try_emplace(const_iterator, key_arg<K>&& k,
|
144
|
+
Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
134
145
|
return try_emplace(std::forward<K>(k), std::forward<Args>(args)...).first;
|
135
146
|
}
|
136
147
|
|
137
148
|
template <class K = key_type, class... Args>
|
138
|
-
iterator try_emplace(const_iterator, const key_arg<K>& k,
|
149
|
+
iterator try_emplace(const_iterator, const key_arg<K>& k,
|
150
|
+
Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
139
151
|
return try_emplace(k, std::forward<Args>(args)...).first;
|
140
152
|
}
|
141
153
|
|
142
154
|
template <class K = key_type, class P = Policy>
|
143
|
-
MappedReference<P> at(const key_arg<K>& key) {
|
155
|
+
MappedReference<P> at(const key_arg<K>& key) ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
144
156
|
auto it = this->find(key);
|
145
157
|
if (it == this->end()) {
|
146
158
|
base_internal::ThrowStdOutOfRange(
|
@@ -150,7 +162,8 @@ class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
|
|
150
162
|
}
|
151
163
|
|
152
164
|
template <class K = key_type, class P = Policy>
|
153
|
-
MappedConstReference<P> at(const key_arg<K>& key) const
|
165
|
+
MappedConstReference<P> at(const key_arg<K>& key) const
|
166
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
154
167
|
auto it = this->find(key);
|
155
168
|
if (it == this->end()) {
|
156
169
|
base_internal::ThrowStdOutOfRange(
|
@@ -160,18 +173,21 @@ class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
|
|
160
173
|
}
|
161
174
|
|
162
175
|
template <class K = key_type, class P = Policy, K* = nullptr>
|
163
|
-
MappedReference<P> operator[](key_arg<K>&& key)
|
176
|
+
MappedReference<P> operator[](key_arg<K>&& key)
|
177
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
164
178
|
return Policy::value(&*try_emplace(std::forward<K>(key)).first);
|
165
179
|
}
|
166
180
|
|
167
181
|
template <class K = key_type, class P = Policy>
|
168
|
-
MappedReference<P> operator[](const key_arg<K>& key)
|
182
|
+
MappedReference<P> operator[](const key_arg<K>& key)
|
183
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
169
184
|
return Policy::value(&*try_emplace(key).first);
|
170
185
|
}
|
171
186
|
|
172
187
|
private:
|
173
188
|
template <class K, class V>
|
174
|
-
std::pair<iterator, bool> insert_or_assign_impl(K&& k, V&& v)
|
189
|
+
std::pair<iterator, bool> insert_or_assign_impl(K&& k, V&& v)
|
190
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
175
191
|
auto res = this->find_or_prepare_insert(k);
|
176
192
|
if (res.second)
|
177
193
|
this->emplace_at(res.first, std::forward<K>(k), std::forward<V>(v));
|
@@ -181,7 +197,8 @@ class raw_hash_map : public raw_hash_set<Policy, Hash, Eq, Alloc> {
|
|
181
197
|
}
|
182
198
|
|
183
199
|
template <class K = key_type, class... Args>
|
184
|
-
std::pair<iterator, bool> try_emplace_impl(K&& k, Args&&... args)
|
200
|
+
std::pair<iterator, bool> try_emplace_impl(K&& k, Args&&... args)
|
201
|
+
ABSL_ATTRIBUTE_LIFETIME_BOUND {
|
185
202
|
auto res = this->find_or_prepare_insert(k);
|
186
203
|
if (res.second)
|
187
204
|
this->emplace_at(res.first, std::piecewise_construct,
|
@@ -15,34 +15,50 @@
|
|
15
15
|
#include "absl/container/internal/raw_hash_set.h"
|
16
16
|
|
17
17
|
#include <atomic>
|
18
|
+
#include <cassert>
|
18
19
|
#include <cstddef>
|
19
20
|
#include <cstring>
|
20
21
|
|
22
|
+
#include "absl/base/attributes.h"
|
21
23
|
#include "absl/base/config.h"
|
24
|
+
#include "absl/base/dynamic_annotations.h"
|
25
|
+
#include "absl/hash/hash.h"
|
22
26
|
|
23
27
|
namespace absl {
|
24
28
|
ABSL_NAMESPACE_BEGIN
|
25
29
|
namespace container_internal {
|
26
30
|
|
27
|
-
//
|
28
|
-
//
|
29
|
-
//
|
30
|
-
//
|
31
|
-
|
31
|
+
// We have space for `growth_left` before a single block of control bytes. A
|
32
|
+
// single block of empty control bytes for tables without any slots allocated.
|
33
|
+
// This enables removing a branch in the hot path of find(). In order to ensure
|
34
|
+
// that the control bytes are aligned to 16, we have 16 bytes before the control
|
35
|
+
// bytes even though growth_left only needs 8.
|
36
|
+
constexpr ctrl_t ZeroCtrlT() { return static_cast<ctrl_t>(0); }
|
37
|
+
alignas(16) ABSL_CONST_INIT ABSL_DLL const ctrl_t kEmptyGroup[32] = {
|
38
|
+
ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(),
|
39
|
+
ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(),
|
40
|
+
ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(),
|
41
|
+
ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(), ZeroCtrlT(),
|
32
42
|
ctrl_t::kSentinel, ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty,
|
33
43
|
ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty,
|
34
44
|
ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty,
|
35
|
-
ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty
|
36
|
-
static_cast<ctrl_t>(0)};
|
45
|
+
ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty, ctrl_t::kEmpty};
|
37
46
|
|
38
47
|
#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
|
39
48
|
constexpr size_t Group::kWidth;
|
40
49
|
#endif
|
41
50
|
|
51
|
+
namespace {
|
52
|
+
|
42
53
|
// Returns "random" seed.
|
43
54
|
inline size_t RandomSeed() {
|
44
55
|
#ifdef ABSL_HAVE_THREAD_LOCAL
|
45
56
|
static thread_local size_t counter = 0;
|
57
|
+
// On Linux kernels >= 5.4 the MSAN runtime has a false-positive when
|
58
|
+
// accessing thread local storage data from loaded libraries
|
59
|
+
// (https://github.com/google/sanitizers/issues/1265), for this reason counter
|
60
|
+
// needs to be annotated as initialized.
|
61
|
+
ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&counter, sizeof(size_t));
|
46
62
|
size_t value = ++counter;
|
47
63
|
#else // ABSL_HAVE_THREAD_LOCAL
|
48
64
|
static std::atomic<size_t> counter(0);
|
@@ -51,6 +67,32 @@ inline size_t RandomSeed() {
|
|
51
67
|
return value ^ static_cast<size_t>(reinterpret_cast<uintptr_t>(&counter));
|
52
68
|
}
|
53
69
|
|
70
|
+
} // namespace
|
71
|
+
|
72
|
+
GenerationType* EmptyGeneration() {
|
73
|
+
if (SwisstableGenerationsEnabled()) {
|
74
|
+
constexpr size_t kNumEmptyGenerations = 1024;
|
75
|
+
static constexpr GenerationType kEmptyGenerations[kNumEmptyGenerations]{};
|
76
|
+
return const_cast<GenerationType*>(
|
77
|
+
&kEmptyGenerations[RandomSeed() % kNumEmptyGenerations]);
|
78
|
+
}
|
79
|
+
return nullptr;
|
80
|
+
}
|
81
|
+
|
82
|
+
bool CommonFieldsGenerationInfoEnabled::
|
83
|
+
should_rehash_for_bug_detection_on_insert(const ctrl_t* ctrl,
|
84
|
+
size_t capacity) const {
|
85
|
+
if (reserved_growth_ == kReservedGrowthJustRanOut) return true;
|
86
|
+
if (reserved_growth_ > 0) return false;
|
87
|
+
// Note: we can't use the abseil-random library because abseil-random
|
88
|
+
// depends on swisstable. We want to return true with probability
|
89
|
+
// `min(1, RehashProbabilityConstant() / capacity())`. In order to do this,
|
90
|
+
// we probe based on a random hash and see if the offset is less than
|
91
|
+
// RehashProbabilityConstant().
|
92
|
+
return probe(ctrl, capacity, absl::HashOf(RandomSeed())).offset() <
|
93
|
+
RehashProbabilityConstant();
|
94
|
+
}
|
95
|
+
|
54
96
|
bool ShouldInsertBackwards(size_t hash, const ctrl_t* ctrl) {
|
55
97
|
// To avoid problems with weak hashes and single bit tests, we use % 13.
|
56
98
|
// TODO(kfm,sbenza): revisit after we do unconditional mixing
|
@@ -75,21 +117,22 @@ FindInfo find_first_non_full_outofline(const CommonFields& common,
|
|
75
117
|
return find_first_non_full(common, hash);
|
76
118
|
}
|
77
119
|
|
78
|
-
//
|
120
|
+
// Returns the address of the ith slot in slots where each slot occupies
|
121
|
+
// slot_size.
|
79
122
|
static inline void* SlotAddress(void* slot_array, size_t slot,
|
80
123
|
size_t slot_size) {
|
81
124
|
return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot_array) +
|
82
125
|
(slot * slot_size));
|
83
126
|
}
|
84
127
|
|
85
|
-
//
|
86
|
-
//
|
128
|
+
// Returns the address of the slot just after slot assuming each slot has the
|
129
|
+
// specified size.
|
87
130
|
static inline void* NextSlot(void* slot, size_t slot_size) {
|
88
131
|
return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot) + slot_size);
|
89
132
|
}
|
90
133
|
|
91
|
-
//
|
92
|
-
//
|
134
|
+
// Returns the address of the slot just before slot assuming each slot has the
|
135
|
+
// specified size.
|
93
136
|
static inline void* PrevSlot(void* slot, size_t slot_size) {
|
94
137
|
return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(slot) - slot_size);
|
95
138
|
}
|
@@ -97,8 +140,8 @@ static inline void* PrevSlot(void* slot, size_t slot_size) {
|
|
97
140
|
void DropDeletesWithoutResize(CommonFields& common,
|
98
141
|
const PolicyFunctions& policy, void* tmp_space) {
|
99
142
|
void* set = &common;
|
100
|
-
void* slot_array = common.
|
101
|
-
const size_t capacity = common.
|
143
|
+
void* slot_array = common.slot_array();
|
144
|
+
const size_t capacity = common.capacity();
|
102
145
|
assert(IsValidCapacity(capacity));
|
103
146
|
assert(!is_small(capacity));
|
104
147
|
// Algorithm:
|
@@ -117,7 +160,7 @@ void DropDeletesWithoutResize(CommonFields& common,
|
|
117
160
|
// swap current element with target element
|
118
161
|
// mark target as FULL
|
119
162
|
// repeat procedure for current slot with moved from element (target)
|
120
|
-
ctrl_t* ctrl = common.
|
163
|
+
ctrl_t* ctrl = common.control();
|
121
164
|
ConvertDeletedToEmptyAndFullToDeleted(ctrl, capacity);
|
122
165
|
auto hasher = policy.hash_slot;
|
123
166
|
auto transfer = policy.transfer;
|
@@ -177,11 +220,11 @@ void DropDeletesWithoutResize(CommonFields& common,
|
|
177
220
|
|
178
221
|
void EraseMetaOnly(CommonFields& c, ctrl_t* it, size_t slot_size) {
|
179
222
|
assert(IsFull(*it) && "erasing a dangling iterator");
|
180
|
-
|
181
|
-
const auto index = static_cast<size_t>(it - c.
|
182
|
-
const size_t index_before = (index - Group::kWidth) & c.
|
223
|
+
c.set_size(c.size() - 1);
|
224
|
+
const auto index = static_cast<size_t>(it - c.control());
|
225
|
+
const size_t index_before = (index - Group::kWidth) & c.capacity();
|
183
226
|
const auto empty_after = Group(it).MaskEmpty();
|
184
|
-
const auto empty_before = Group(c.
|
227
|
+
const auto empty_before = Group(c.control() + index_before).MaskEmpty();
|
185
228
|
|
186
229
|
// We count how many consecutive non empties we have to the right and to the
|
187
230
|
// left of `it`. If the sum is >= kWidth then there is at least one probe
|
@@ -193,26 +236,24 @@ void EraseMetaOnly(CommonFields& c, ctrl_t* it, size_t slot_size) {
|
|
193
236
|
|
194
237
|
SetCtrl(c, index, was_never_full ? ctrl_t::kEmpty : ctrl_t::kDeleted,
|
195
238
|
slot_size);
|
196
|
-
c.growth_left()
|
239
|
+
c.set_growth_left(c.growth_left() + (was_never_full ? 1 : 0));
|
197
240
|
c.infoz().RecordErase();
|
198
241
|
}
|
199
242
|
|
200
243
|
void ClearBackingArray(CommonFields& c, const PolicyFunctions& policy,
|
201
244
|
bool reuse) {
|
202
|
-
c.
|
245
|
+
c.set_size(0);
|
203
246
|
if (reuse) {
|
204
247
|
ResetCtrl(c, policy.slot_size);
|
205
|
-
c.infoz().RecordStorageChanged(0, c.
|
248
|
+
c.infoz().RecordStorageChanged(0, c.capacity());
|
206
249
|
} else {
|
207
|
-
|
208
|
-
|
209
|
-
c.control_ = EmptyGroup();
|
250
|
+
(*policy.dealloc)(c, policy);
|
251
|
+
c.set_control(EmptyGroup());
|
210
252
|
c.set_generation_ptr(EmptyGeneration());
|
211
|
-
c.
|
212
|
-
c.
|
213
|
-
c.growth_left() = 0;
|
253
|
+
c.set_slots(nullptr);
|
254
|
+
c.set_capacity(0);
|
214
255
|
c.infoz().RecordClearedReservation();
|
215
|
-
assert(c.
|
256
|
+
assert(c.size() == 0);
|
216
257
|
c.infoz().RecordStorageChanged(0, 0);
|
217
258
|
}
|
218
259
|
}
|