[slice] Remove murmur implementation (#31118)

* [slice] Remove _internal variants of APIs

* Automated change: Fix sanity tests

* fix

* reduce bloat

* fixes

* Automated change: Fix sanity tests

* murmurings

* Automated change: Fix sanity tests

* progress

* Automated change: Fix sanity tests

* fix

* fix

* Automated change: Fix sanity tests

* fix

* Automated change: Fix sanity tests

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/31207/head
Craig Tiller 2 years ago committed by GitHub
parent 6fdbe67946
commit 66c8e098ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      BUILD
  2. 62
      CMakeLists.txt
  3. 4
      Makefile
  4. 56
      build_autogenerated.yaml
  5. 2
      config.m4
  6. 2
      config.w32
  7. 4
      gRPC-C++.podspec
  8. 6
      gRPC-Core.podspec
  9. 4
      grpc.gemspec
  10. 4
      grpc.gyp
  11. 4
      package.xml
  12. 2
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  13. 2
      src/core/lib/event_engine/memory_allocator.cc
  14. 2
      src/core/lib/event_engine/slice.cc
  15. 82
      src/core/lib/gpr/murmur_hash.cc
  16. 30
      src/core/lib/gpr/murmur_hash.h
  17. 1
      src/core/lib/iomgr/ev_poll_posix.cc
  18. 2
      src/core/lib/slice/slice.cc
  19. 2
      src/core/lib/slice/slice.h
  20. 29
      src/core/lib/slice/slice_internal.h
  21. 35
      src/core/lib/slice/slice_refcount.cc
  22. 42
      src/core/lib/slice/slice_refcount.h
  23. 60
      src/core/lib/slice/slice_refcount_base.h
  24. 2
      src/python/grpcio/grpc_core_dependencies.py
  25. 10
      test/core/compression/message_compress_test.cc
  26. 1
      test/core/end2end/fuzzers/api_fuzzer.cc
  27. 2
      test/core/end2end/fuzzers/client_fuzzer.cc
  28. 2
      test/core/end2end/fuzzers/server_fuzzer.cc
  29. 2
      test/core/filters/filter_fuzzer.cc
  30. 13
      test/core/gpr/BUILD
  31. 81
      test/core/gpr/murmur_hash_test.cc
  32. 1
      test/core/transport/binder/end2end/fuzzers/client_fuzzer.cc
  33. 1
      test/core/transport/binder/end2end/fuzzers/server_fuzzer.cc
  34. 2
      test/core/transport/chttp2/hpack_encoder_test.cc
  35. 2
      test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
  36. 4
      tools/doxygen/Doxyfile.c++.internal
  37. 4
      tools/doxygen/Doxyfile.core.internal
  38. 24
      tools/run_tests/generated/tests.json

25
BUILD

@ -992,19 +992,6 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "gpr_murmur_hash",
srcs = [
"src/core/lib/gpr/murmur_hash.cc",
],
hdrs = [
"src/core/lib/gpr/murmur_hash.h",
],
external_deps = ["absl/base:core_headers"],
language = "c++",
deps = ["gpr_platform"],
)
grpc_cc_library(
name = "gpr_spinlock",
srcs = [],
@ -2118,12 +2105,8 @@ grpc_cc_library(
grpc_cc_library(
name = "slice_refcount",
srcs = [
"src/core/lib/slice/slice_refcount.cc",
],
hdrs = [
"src/core/lib/slice/slice_refcount.h",
"src/core/lib/slice/slice_refcount_base.h",
],
public_hdrs = [
"include/grpc/slice.h",
@ -2146,10 +2129,12 @@ grpc_cc_library(
"src/core/lib/slice/slice_internal.h",
"src/core/lib/slice/slice_string_helpers.h",
],
external_deps = ["absl/strings"],
external_deps = [
"absl/hash",
"absl/strings",
],
deps = [
"gpr",
"gpr_murmur_hash",
"grpc_public_hdrs",
"slice_refcount",
],
@ -3416,6 +3401,7 @@ grpc_cc_library(
"absl/container:inlined_vector",
"absl/functional:any_invocable",
"absl/functional:function_ref",
"absl/hash",
"absl/meta:type_traits",
"absl/status",
"absl/status:statusor",
@ -3458,7 +3444,6 @@ grpc_cc_library(
"gpr",
"gpr_atm",
"gpr_manual_constructor",
"gpr_murmur_hash",
"gpr_spinlock",
"grpc_public_hdrs",
"grpc_sockaddr",

62
CMakeLists.txt generated

@ -1058,7 +1058,6 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx mpscq_test)
endif()
add_dependencies(buildtests_cxx murmur_hash_test)
add_dependencies(buildtests_cxx no_destruct_test)
add_dependencies(buildtests_cxx nonblocking_test)
add_dependencies(buildtests_cxx notification_test)
@ -2136,7 +2135,6 @@ add_library(grpc
src/core/lib/event_engine/windows/windows_engine.cc
src/core/lib/experiments/config.cc
src/core/lib/experiments/experiments.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/gprpp/time_averaged_stats.cc
@ -2305,7 +2303,6 @@ add_library(grpc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_buffer.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/surface/api_trace.cc
src/core/lib/surface/builtins.cc
@ -2747,7 +2744,6 @@ add_library(grpc_unsecure
src/core/lib/event_engine/windows/windows_engine.cc
src/core/lib/experiments/config.cc
src/core/lib/experiments/experiments.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/gprpp/time_averaged_stats.cc
@ -2876,7 +2872,6 @@ add_library(grpc_unsecure
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_buffer.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/surface/api_trace.cc
src/core/lib/surface/builtins.cc
@ -7512,7 +7507,6 @@ add_executable(chunked_vector_test
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/experiments/config.cc
src/core/lib/experiments/experiments.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/iomgr/combiner.cc
@ -7529,7 +7523,6 @@ add_executable(chunked_vector_test
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/gprpp/chunked_vector_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -7560,6 +7553,7 @@ target_link_libraries(chunked_vector_test
${_gRPC_ALLTARGETS_LIBRARIES}
absl::any_invocable
absl::function_ref
absl::hash
absl::type_traits
absl::statusor
absl::utility
@ -9635,7 +9629,6 @@ add_executable(exec_ctx_wakeup_scheduler_test
src/core/ext/upb-generated/google/protobuf/any.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/debug/trace.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/iomgr/combiner.cc
@ -9646,7 +9639,6 @@ add_executable(exec_ctx_wakeup_scheduler_test
src/core/lib/promise/activity.cc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/promise/exec_ctx_wakeup_scheduler_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -9676,6 +9668,7 @@ target_link_libraries(exec_ctx_wakeup_scheduler_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::any_invocable
absl::hash
absl::type_traits
absl::statusor
absl::utility
@ -10096,7 +10089,6 @@ add_executable(flow_control_test
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/experiments/config.cc
src/core/lib/experiments/experiments.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/iomgr/combiner.cc
@ -10112,7 +10104,6 @@ add_executable(flow_control_test
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/pid_controller.cc
@ -10145,6 +10136,7 @@ target_link_libraries(flow_control_test
${_gRPC_ALLTARGETS_LIBRARIES}
absl::any_invocable
absl::function_ref
absl::hash
absl::type_traits
absl::statusor
absl::utility
@ -10163,7 +10155,6 @@ add_executable(for_each_test
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/experiments/config.cc
src/core/lib/experiments/experiments.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/iomgr/combiner.cc
@ -10180,7 +10171,6 @@ add_executable(for_each_test
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/promise/for_each_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -13703,41 +13693,6 @@ endif()
endif()
if(gRPC_BUILD_TESTS)
add_executable(murmur_hash_test
test/core/gpr/murmur_hash_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(murmur_hash_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_RE2_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_XXHASH_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
third_party/googletest/googlemock
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(murmur_hash_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(no_destruct_test
test/core/gprpp/no_destruct_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -14322,7 +14277,6 @@ add_executable(periodic_update_test
src/core/ext/upb-generated/google/protobuf/any.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/debug/trace.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/iomgr/combiner.cc
@ -14333,7 +14287,6 @@ add_executable(periodic_update_test
src/core/lib/resource_quota/periodic_update.cc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/resource_quota/periodic_update_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -14364,6 +14317,7 @@ target_link_libraries(periodic_update_test
${_gRPC_ALLTARGETS_LIBRARIES}
absl::any_invocable
absl::function_ref
absl::hash
absl::statusor
gpr
upb
@ -14427,7 +14381,6 @@ add_executable(pipe_test
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/experiments/config.cc
src/core/lib/experiments/experiments.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/time.cc
src/core/lib/iomgr/combiner.cc
@ -14444,7 +14397,6 @@ add_executable(pipe_test
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/percent_encoding.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/promise/pipe_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -14475,6 +14427,7 @@ target_link_libraries(pipe_test
${_gRPC_ALLTARGETS_LIBRARIES}
absl::any_invocable
absl::function_ref
absl::hash
absl::type_traits
absl::statusor
absl::utility
@ -16792,9 +16745,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(slice_string_helpers_test
src/core/lib/gpr/murmur_hash.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/slice/slice_string_helpers_test.cc
third_party/googletest/googletest/src/gtest-all.cc
@ -16823,6 +16774,7 @@ target_include_directories(slice_string_helpers_test
target_link_libraries(slice_string_helpers_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::hash
gpr
)
@ -18015,10 +17967,8 @@ add_executable(test_core_event_engine_slice_buffer_test
src/core/lib/event_engine/resolved_address.cc
src/core/lib/event_engine/slice.cc
src/core/lib/event_engine/slice_buffer.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_buffer.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
test/core/event_engine/slice_buffer_test.cc
third_party/googletest/googletest/src/gtest-all.cc

4
Makefile generated

@ -1409,7 +1409,6 @@ LIBGRPC_SRC = \
src/core/lib/event_engine/windows/windows_engine.cc \
src/core/lib/experiments/config.cc \
src/core/lib/experiments/experiments.cc \
src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gprpp/status_helper.cc \
src/core/lib/gprpp/time.cc \
src/core/lib/gprpp/time_averaged_stats.cc \
@ -1578,7 +1577,6 @@ LIBGRPC_SRC = \
src/core/lib/slice/percent_encoding.cc \
src/core/lib/slice/slice.cc \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/surface/api_trace.cc \
src/core/lib/surface/builtins.cc \
@ -1883,7 +1881,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/event_engine/windows/windows_engine.cc \
src/core/lib/experiments/config.cc \
src/core/lib/experiments/experiments.cc \
src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gprpp/status_helper.cc \
src/core/lib/gprpp/time.cc \
src/core/lib/gprpp/time_averaged_stats.cc \
@ -2012,7 +2009,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/slice/percent_encoding.cc \
src/core/lib/slice/slice.cc \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/surface/api_trace.cc \
src/core/lib/surface/builtins.cc \

@ -753,7 +753,6 @@ libs:
- src/core/lib/event_engine/windows/windows_engine.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -952,7 +951,6 @@ libs:
- src/core/lib/slice/slice_buffer.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/surface/api_trace.h
- src/core/lib/surface/builtins.h
@ -1470,7 +1468,6 @@ libs:
- src/core/lib/event_engine/windows/windows_engine.cc
- src/core/lib/experiments/config.cc
- src/core/lib/experiments/experiments.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/gprpp/time_averaged_stats.cc
@ -1639,7 +1636,6 @@ libs:
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_buffer.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/surface/api_trace.cc
- src/core/lib/surface/builtins.cc
@ -1959,7 +1955,6 @@ libs:
- src/core/lib/event_engine/windows/windows_engine.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -2125,7 +2120,6 @@ libs:
- src/core/lib/slice/slice_buffer.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/surface/api_trace.h
- src/core/lib/surface/builtins.h
@ -2317,7 +2311,6 @@ libs:
- src/core/lib/event_engine/windows/windows_engine.cc
- src/core/lib/experiments/config.cc
- src/core/lib/experiments/experiments.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/gprpp/time_averaged_stats.cc
@ -2446,7 +2439,6 @@ libs:
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_buffer.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/surface/api_trace.cc
- src/core/lib/surface/builtins.cc
@ -4814,7 +4806,6 @@ targets:
- src/core/lib/debug/trace.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -4855,7 +4846,6 @@ targets:
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
src:
- src/core/ext/upb-generated/google/protobuf/any.upb.c
@ -4864,7 +4854,6 @@ targets:
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/experiments/config.cc
- src/core/lib/experiments/experiments.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/iomgr/combiner.cc
@ -4881,12 +4870,12 @@ targets:
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/gprpp/chunked_vector_test.cc
deps:
- absl/functional:any_invocable
- absl/functional:function_ref
- absl/hash:hash
- absl/meta:type_traits
- absl/status:statusor
- absl/utility:utility
@ -5815,7 +5804,6 @@ targets:
- src/core/ext/upb-generated/google/protobuf/any.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/debug/trace.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -5843,13 +5831,11 @@ targets:
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
src:
- src/core/ext/upb-generated/google/protobuf/any.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/debug/trace.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/iomgr/combiner.cc
@ -5860,11 +5846,11 @@ targets:
- src/core/lib/promise/activity.cc
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/promise/exec_ctx_wakeup_scheduler_test.cc
deps:
- absl/functional:any_invocable
- absl/hash:hash
- absl/meta:type_traits
- absl/status:statusor
- absl/utility:utility
@ -6099,7 +6085,6 @@ targets:
- src/core/lib/debug/trace.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -6138,7 +6123,6 @@ targets:
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/http2_errors.h
@ -6152,7 +6136,6 @@ targets:
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/experiments/config.cc
- src/core/lib/experiments/experiments.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/iomgr/combiner.cc
@ -6168,7 +6151,6 @@ targets:
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/pid_controller.cc
@ -6176,6 +6158,7 @@ targets:
deps:
- absl/functional:any_invocable
- absl/functional:function_ref
- absl/hash:hash
- absl/meta:type_traits
- absl/status:statusor
- absl/utility:utility
@ -6192,7 +6175,6 @@ targets:
- src/core/lib/debug/trace.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -6239,7 +6221,6 @@ targets:
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- test/core/promise/test_wakeup_schedulers.h
src:
@ -6249,7 +6230,6 @@ targets:
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/experiments/config.cc
- src/core/lib/experiments/experiments.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/iomgr/combiner.cc
@ -6266,7 +6246,6 @@ targets:
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/promise/for_each_test.cc
deps:
@ -7829,16 +7808,6 @@ targets:
- posix
- mac
uses_polling: false
- name: murmur_hash_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/gpr/murmur_hash_test.cc
deps:
- grpc_test_util
uses_polling: false
- name: no_destruct_test
gtest: true
build: test
@ -8071,7 +8040,6 @@ targets:
- src/core/ext/upb-generated/google/protobuf/any.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/debug/trace.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/debug_location.h
@ -8089,13 +8057,11 @@ targets:
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
src:
- src/core/ext/upb-generated/google/protobuf/any.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/debug/trace.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/iomgr/combiner.cc
@ -8106,12 +8072,12 @@ targets:
- src/core/lib/resource_quota/periodic_update.cc
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/resource_quota/periodic_update_test.cc
deps:
- absl/functional:any_invocable
- absl/functional:function_ref
- absl/hash:hash
- absl/status:statusor
- gpr
- upb
@ -8160,7 +8126,6 @@ targets:
- src/core/lib/debug/trace.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
@ -8205,7 +8170,6 @@ targets:
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- test/core/promise/test_wakeup_schedulers.h
src:
@ -8215,7 +8179,6 @@ targets:
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/experiments/config.cc
- src/core/lib/experiments/experiments.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/time.cc
- src/core/lib/iomgr/combiner.cc
@ -8232,12 +8195,12 @@ targets:
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/percent_encoding.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/promise/pipe_test.cc
deps:
- absl/functional:any_invocable
- absl/functional:function_ref
- absl/hash:hash
- absl/meta:type_traits
- absl/status:statusor
- absl/utility:utility
@ -9286,19 +9249,16 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
src:
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/slice/slice_string_helpers_test.cc
deps:
- absl/hash:hash
- gpr
uses_polling: false
- name: smoke_test
@ -9885,21 +9845,17 @@ targets:
language: c++
headers:
- src/core/lib/event_engine/handle_containers.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_buffer.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
src:
- src/core/lib/event_engine/resolved_address.cc
- src/core/lib/event_engine/slice.cc
- src/core/lib/event_engine/slice_buffer.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_buffer.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- test/core/event_engine/slice_buffer_test.cc
deps:

2
config.m4 generated

@ -502,7 +502,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/log_linux.cc \
src/core/lib/gpr/log_posix.cc \
src/core/lib/gpr/log_windows.cc \
src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gpr/string.cc \
src/core/lib/gpr/string_posix.cc \
src/core/lib/gpr/string_util_windows.cc \
@ -702,7 +701,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/slice/percent_encoding.cc \
src/core/lib/slice/slice.cc \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/surface/api_trace.cc \
src/core/lib/surface/builtins.cc \

2
config.w32 generated

@ -468,7 +468,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\log_linux.cc " +
"src\\core\\lib\\gpr\\log_posix.cc " +
"src\\core\\lib\\gpr\\log_windows.cc " +
"src\\core\\lib\\gpr\\murmur_hash.cc " +
"src\\core\\lib\\gpr\\string.cc " +
"src\\core\\lib\\gpr\\string_posix.cc " +
"src\\core\\lib\\gpr\\string_util_windows.cc " +
@ -668,7 +667,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\slice\\percent_encoding.cc " +
"src\\core\\lib\\slice\\slice.cc " +
"src\\core\\lib\\slice\\slice_buffer.cc " +
"src\\core\\lib\\slice\\slice_refcount.cc " +
"src\\core\\lib\\slice\\slice_string_helpers.cc " +
"src\\core\\lib\\surface\\api_trace.cc " +
"src\\core\\lib\\surface\\builtins.cc " +

4
gRPC-C++.podspec generated

@ -704,7 +704,6 @@ Pod::Spec.new do |s|
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/time_precise.h',
@ -925,7 +924,6 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_buffer.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_refcount.h',
'src/core/lib/slice/slice_refcount_base.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/builtins.h',
@ -1571,7 +1569,6 @@ Pod::Spec.new do |s|
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/time_precise.h',
@ -1792,7 +1789,6 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_buffer.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_refcount.h',
'src/core/lib/slice/slice_refcount_base.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/builtins.h',

6
gRPC-Core.podspec generated

@ -1103,8 +1103,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/log_linux.cc',
'src/core/lib/gpr/log_posix.cc',
'src/core/lib/gpr/log_windows.cc',
'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string.h',
@ -1523,9 +1521,7 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_buffer.cc',
'src/core/lib/slice/slice_buffer.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_refcount.cc',
'src/core/lib/slice/slice_refcount.h',
'src/core/lib/slice/slice_refcount_base.h',
'src/core/lib/slice/slice_string_helpers.cc',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.cc',
@ -2202,7 +2198,6 @@ Pod::Spec.new do |s|
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/time_precise.h',
@ -2423,7 +2418,6 @@ Pod::Spec.new do |s|
'src/core/lib/slice/slice_buffer.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_refcount.h',
'src/core/lib/slice/slice_refcount_base.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/builtins.h',

4
grpc.gemspec generated

@ -1014,8 +1014,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/log_linux.cc )
s.files += %w( src/core/lib/gpr/log_posix.cc )
s.files += %w( src/core/lib/gpr/log_windows.cc )
s.files += %w( src/core/lib/gpr/murmur_hash.cc )
s.files += %w( src/core/lib/gpr/murmur_hash.h )
s.files += %w( src/core/lib/gpr/spinlock.h )
s.files += %w( src/core/lib/gpr/string.cc )
s.files += %w( src/core/lib/gpr/string.h )
@ -1434,9 +1432,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/slice/slice_buffer.cc )
s.files += %w( src/core/lib/slice/slice_buffer.h )
s.files += %w( src/core/lib/slice/slice_internal.h )
s.files += %w( src/core/lib/slice/slice_refcount.cc )
s.files += %w( src/core/lib/slice/slice_refcount.h )
s.files += %w( src/core/lib/slice/slice_refcount_base.h )
s.files += %w( src/core/lib/slice/slice_string_helpers.cc )
s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/surface/api_trace.cc )

4
grpc.gyp generated

@ -824,7 +824,6 @@
'src/core/lib/event_engine/windows/windows_engine.cc',
'src/core/lib/experiments/config.cc',
'src/core/lib/experiments/experiments.cc',
'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gprpp/status_helper.cc',
'src/core/lib/gprpp/time.cc',
'src/core/lib/gprpp/time_averaged_stats.cc',
@ -993,7 +992,6 @@
'src/core/lib/slice/percent_encoding.cc',
'src/core/lib/slice/slice.cc',
'src/core/lib/slice/slice_buffer.cc',
'src/core/lib/slice/slice_refcount.cc',
'src/core/lib/slice/slice_string_helpers.cc',
'src/core/lib/surface/api_trace.cc',
'src/core/lib/surface/builtins.cc',
@ -1277,7 +1275,6 @@
'src/core/lib/event_engine/windows/windows_engine.cc',
'src/core/lib/experiments/config.cc',
'src/core/lib/experiments/experiments.cc',
'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gprpp/status_helper.cc',
'src/core/lib/gprpp/time.cc',
'src/core/lib/gprpp/time_averaged_stats.cc',
@ -1406,7 +1403,6 @@
'src/core/lib/slice/percent_encoding.cc',
'src/core/lib/slice/slice.cc',
'src/core/lib/slice/slice_buffer.cc',
'src/core/lib/slice/slice_refcount.cc',
'src/core/lib/slice/slice_string_helpers.cc',
'src/core/lib/surface/api_trace.cc',
'src/core/lib/surface/builtins.cc',

4
package.xml generated

@ -996,8 +996,6 @@
<file baseinstalldir="/" name="src/core/lib/gpr/log_linux.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/log_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/log_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/murmur_hash.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/spinlock.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string.h" role="src" />
@ -1416,9 +1414,7 @@
<file baseinstalldir="/" name="src/core/lib/slice/slice_buffer.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_buffer.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_refcount.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_refcount.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_refcount_base.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.cc" role="src" />

@ -52,7 +52,7 @@
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_refcount_base.h"
#include "src/core/lib/slice/slice_refcount.h"
#include "src/core/lib/transport/http2_errors.h"
#include "src/core/lib/transport/parsed_metadata.h"
#include "src/core/lib/transport/transport.h"

@ -25,7 +25,7 @@
#include <grpc/event_engine/memory_request.h>
#include <grpc/slice.h>
#include "src/core/lib/slice/slice_refcount_base.h"
#include "src/core/lib/slice/slice_refcount.h"
namespace grpc_event_engine {
namespace experimental {

@ -26,7 +26,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_refcount_base.h"
#include "src/core/lib/slice/slice_refcount.h"
namespace grpc_event_engine {
namespace experimental {

@ -1,82 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/murmur_hash.h"
#include <string.h>
#include "absl/base/attributes.h"
#define ROTL32(x, r) (((x) << (r)) | ((x) >> (32 - (r))))
#define FMIX32(h) \
(h) ^= (h) >> 16; \
(h) *= 0x85ebca6b; \
(h) ^= (h) >> 13; \
(h) *= 0xc2b2ae35; \
(h) ^= (h) >> 16;
uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed) {
uint32_t h1 = seed;
uint32_t k1;
const uint32_t c1 = 0xcc9e2d51;
const uint32_t c2 = 0x1b873593;
const uint8_t* keyptr = static_cast<const uint8_t*>(key);
const size_t bsize = sizeof(k1);
const size_t nblocks = len / bsize;
/* body */
for (size_t i = 0; i < nblocks; i++, keyptr += bsize) {
memcpy(&k1, keyptr, bsize);
k1 *= c1;
k1 = ROTL32(k1, 15);
k1 *= c2;
h1 ^= k1;
h1 = ROTL32(h1, 13);
h1 = h1 * 5 + 0xe6546b64;
}
k1 = 0;
/* tail */
switch (len & 3) {
case 3:
k1 ^= (static_cast<uint32_t>(keyptr[2])) << 16;
ABSL_FALLTHROUGH_INTENDED;
case 2:
k1 ^= (static_cast<uint32_t>(keyptr[1])) << 8;
ABSL_FALLTHROUGH_INTENDED;
case 1:
k1 ^= keyptr[0];
k1 *= c1;
k1 = ROTL32(k1, 15);
k1 *= c2;
h1 ^= k1;
};
/* finalization */
h1 ^= static_cast<uint32_t>(len);
FMIX32(h1);
return h1;
}

@ -1,30 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_CORE_LIB_GPR_MURMUR_HASH_H
#define GRPC_CORE_LIB_GPR_MURMUR_HASH_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include <stdint.h>
/* compute the hash of key (length len) */
uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed);
#endif /* GRPC_CORE_LIB_GPR_MURMUR_HASH_H */

@ -40,7 +40,6 @@
#include <grpc/support/log.h>
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/murmur_hash.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/block_annotate.h"

@ -30,7 +30,7 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_refcount_base.h"
#include "src/core/lib/slice/slice_refcount.h"
char* grpc_slice_to_c_string(grpc_slice slice) {
char* out = static_cast<char*>(gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1));

@ -30,7 +30,7 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_refcount_base.h"
#include "src/core/lib/slice/slice_refcount.h"
// Herein lies grpc_core::Slice and its team of thin wrappers around grpc_slice.
// They aim to keep you safe by providing strong guarantees around lifetime and

@ -26,14 +26,13 @@
#include <cstddef>
#include <string>
#include "absl/hash/hash.h"
#include "absl/strings/string_view.h"
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/murmur_hash.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/slice/slice_refcount.h"
// Returns a pointer to the first slice in the slice buffer without giving
// ownership to or a reference count on that slice.
@ -49,7 +48,6 @@ void grpc_slice_buffer_remove_first(grpc_slice_buffer* sb);
void grpc_slice_buffer_sub_first(grpc_slice_buffer* sb, size_t begin,
size_t end);
void grpc_test_only_set_slice_hash_seed(uint32_t seed);
// if slice matches a static slice, returns the static slice
// otherwise returns the passed in slice (without reffing it)
// used for surface boundaries where we might receive an un-interned static
@ -59,11 +57,6 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
uint32_t grpc_static_slice_hash(grpc_slice s);
int grpc_static_slice_eq(grpc_slice a, grpc_slice b);
inline uint32_t grpc_slice_hash(const grpc_slice& s) {
return gpr_murmur_hash3(GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s),
grpc_core::g_hash_seed);
}
grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
size_t len);
grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p);
@ -76,14 +69,6 @@ size_t grpc_slice_memory_usage(grpc_slice s);
namespace grpc_core {
struct SliceHash {
std::size_t operator()(const grpc_slice& slice) const {
return grpc_slice_hash(slice);
}
};
extern uint32_t g_hash_seed;
// Converts grpc_slice to absl::string_view.
inline absl::string_view StringViewFromSlice(const grpc_slice& slice) {
return absl::string_view(
@ -93,6 +78,18 @@ inline absl::string_view StringViewFromSlice(const grpc_slice& slice) {
} // namespace grpc_core
inline uint32_t grpc_slice_hash(const grpc_slice& s) {
return absl::HashOf(grpc_core::StringViewFromSlice(s));
}
namespace grpc_core {
struct SliceHash {
std::size_t operator()(const grpc_slice& slice) const {
return grpc_slice_hash(slice);
}
};
} // namespace grpc_core
inline bool operator==(const grpc_slice& s1, const grpc_slice& s2) {
return grpc_slice_eq(s1, s2);
}

@ -1,35 +0,0 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <grpc/support/port_platform.h>
#include "src/core/lib/slice/slice_refcount.h"
#include <chrono>
namespace grpc_core {
uint32_t g_hash_seed = []() {
auto now = std::chrono::system_clock::now();
auto now_since_epoch = now.time_since_epoch();
auto now_ns =
std::chrono::duration_cast<std::chrono::nanoseconds>(now_since_epoch);
return static_cast<uint32_t>(now_ns.count());
}();
} // namespace grpc_core
void grpc_test_only_set_slice_hash_seed(uint32_t seed) {
grpc_core::g_hash_seed = seed;
}

@ -17,12 +17,44 @@
#include <grpc/support/port_platform.h>
#include <stdint.h>
#include <stddef.h>
namespace grpc_core {
#include <atomic>
extern uint32_t g_hash_seed;
// grpc_slice_refcount : A reference count for grpc_slice.
struct grpc_slice_refcount {
public:
typedef void (*DestroyerFn)(grpc_slice_refcount*);
} // namespace grpc_core
static grpc_slice_refcount* NoopRefcount() {
return reinterpret_cast<grpc_slice_refcount*>(1);
}
#endif /* GRPC_CORE_LIB_SLICE_SLICE_REFCOUNT_H */
grpc_slice_refcount() = default;
// Regular constructor for grpc_slice_refcount.
//
// Parameters:
// 1. DestroyerFn destroyer_fn
// Called when the refcount goes to 0, with 'this' as parameter.
explicit grpc_slice_refcount(DestroyerFn destroyer_fn)
: destroyer_fn_(destroyer_fn) {}
void Ref() { ref_.fetch_add(1, std::memory_order_relaxed); }
void Unref() {
if (ref_.fetch_sub(1, std::memory_order_acq_rel) == 1) {
destroyer_fn_(this);
}
}
// Is this the only instance?
// For this to be useful the caller needs to ensure that if this is the only
// instance, no other instance could be created during this call.
bool IsUnique() const { return ref_.load(std::memory_order_relaxed) == 1; }
private:
std::atomic<size_t> ref_{1};
DestroyerFn destroyer_fn_ = nullptr;
};
#endif // GRPC_CORE_LIB_SLICE_SLICE_REFCOUNT_H

@ -1,60 +0,0 @@
// Copyright 2021 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_CORE_LIB_SLICE_SLICE_REFCOUNT_BASE_H
#define GRPC_CORE_LIB_SLICE_SLICE_REFCOUNT_BASE_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include <atomic>
// grpc_slice_refcount : A reference count for grpc_slice.
struct grpc_slice_refcount {
public:
typedef void (*DestroyerFn)(grpc_slice_refcount*);
static grpc_slice_refcount* NoopRefcount() {
return reinterpret_cast<grpc_slice_refcount*>(1);
}
grpc_slice_refcount() = default;
// Regular constructor for grpc_slice_refcount.
//
// Parameters:
// 1. DestroyerFn destroyer_fn
// Called when the refcount goes to 0, with 'this' as parameter.
explicit grpc_slice_refcount(DestroyerFn destroyer_fn)
: destroyer_fn_(destroyer_fn) {}
void Ref() { ref_.fetch_add(1, std::memory_order_relaxed); }
void Unref() {
if (ref_.fetch_sub(1, std::memory_order_acq_rel) == 1) {
destroyer_fn_(this);
}
}
// Is this the only instance?
// For this to be useful the caller needs to ensure that if this is the only
// instance, no other instance could be created during this call.
bool IsUnique() const { return ref_.load(std::memory_order_relaxed) == 1; }
private:
std::atomic<size_t> ref_{1};
DestroyerFn destroyer_fn_ = nullptr;
};
#endif // GRPC_CORE_LIB_SLICE_SLICE_REFCOUNT_BASE_H

@ -477,7 +477,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/gpr/log_linux.cc',
'src/core/lib/gpr/log_posix.cc',
'src/core/lib/gpr/log_windows.cc',
'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string_posix.cc',
'src/core/lib/gpr/string_util_windows.cc',
@ -677,7 +676,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/slice/percent_encoding.cc',
'src/core/lib/slice/slice.cc',
'src/core/lib/slice/slice_buffer.cc',
'src/core/lib/slice/slice_refcount.cc',
'src/core/lib/slice/slice_string_helpers.cc',
'src/core/lib/surface/api_trace.cc',
'src/core/lib/surface/builtins.cc',

@ -28,7 +28,6 @@
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/murmur_hash.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/slice_splitter.h"
@ -58,12 +57,9 @@ static void assert_passthrough(grpc_slice value,
ASSERT_NE(grpc_compression_algorithm_name(algorithm, &algorithm_name), 0);
gpr_log(GPR_INFO,
"assert_passthrough: value_length=%" PRIuPTR
" value_hash=0x%08x "
"algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
GRPC_SLICE_LENGTH(value),
gpr_murmur_hash3(GRPC_SLICE_START_PTR(value),
GRPC_SLICE_LENGTH(value), 0),
algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode),
" algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
GRPC_SLICE_LENGTH(value), algorithm_name,
grpc_slice_split_mode_name(uncompressed_split_mode),
grpc_slice_split_mode_name(compressed_split_mode));
grpc_slice_buffer_init(&input);

@ -814,7 +814,6 @@ static grpc_channel_credentials* ReadChannelCreds(
DEFINE_PROTO_FUZZER(const api_fuzzer::Msg& msg) {
grpc_event_engine::experimental::ResetDefaultEventEngine();
grpc_test_only_set_slice_hash_seed(0);
if (squelch && !grpc_core::GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
}

@ -37,7 +37,6 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/transport_fwd.h"
@ -53,7 +52,6 @@ static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args* /*args*/) {}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
{

@ -35,7 +35,6 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/server.h"
#include "src/core/lib/transport/transport_fwd.h"
#include "test/core/util/mock_endpoint.h"
@ -50,7 +49,6 @@ static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args* /*args*/) {}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
{

@ -78,7 +78,6 @@
#include "src/core/lib/security/security_connector/security_connector.h"
#include "src/core/lib/security/transport/auth_filters.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/call_fragments.h"
#include "src/core/lib/transport/handshaker.h"
@ -656,7 +655,6 @@ DEFINE_PROTO_FUZZER(const filter_fuzzer::Msg& msg) {
return;
}
grpc_test_only_set_slice_hash_seed(0);
if (squelch && !grpc_core::GetEnv("GRPC_TRACE_FUZZER").has_value()) {
gpr_set_log_function(dont_log);
}

@ -72,19 +72,6 @@ grpc_cc_test(
],
)
grpc_cc_test(
name = "murmur_hash_test",
srcs = ["murmur_hash_test.cc"],
external_deps = ["gtest"],
language = "C++",
uses_event_engine = False,
uses_polling = False,
deps = [
"//:gpr",
"//test/core/util:grpc_test_util",
],
)
grpc_cc_test(
name = "spinlock_test",
srcs = ["spinlock_test.cc"],

@ -1,81 +0,0 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "src/core/lib/gpr/murmur_hash.h"
#include <stdlib.h>
#include <string.h>
#include <gtest/gtest.h>
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
typedef uint32_t (*hash_func)(const void* key, size_t len, uint32_t seed);
/* From smhasher:
This should hopefully be a thorough and uambiguous test of whether a hash
is correctly implemented on a given platform */
static void verification_test(hash_func hash, uint32_t expected) {
uint8_t key[256];
uint32_t hashes[256];
uint32_t final = 0;
size_t i;
memset(key, 0, sizeof(key));
memset(hashes, 0, sizeof(hashes));
/* Hash keys of the form {0}, {0,1}, {0,1,2}... up to N=255,using 256-N as
the seed */
for (i = 0; i < 256; i++) {
key[i] = static_cast<uint8_t>(i);
hashes[i] = hash(key, i, static_cast<uint32_t>(256u - i));
}
/* Then hash the result array */
final = hash(hashes, sizeof(hashes), 0);
/* The first four bytes of that hash, interpreted as a little-endian integer,
is our
verification value */
if (expected != final) {
gpr_log(GPR_INFO, "Verification value 0x%08X : Failed! (Expected 0x%08x)",
final, expected);
abort();
} else {
gpr_log(GPR_INFO, "Verification value 0x%08X : Passed!", final);
}
}
TEST(MurmurHashTest, MainTest) {
/* basic tests to verify that things don't crash */
gpr_murmur_hash3("", 0, 0);
gpr_murmur_hash3("xyz", 3, 0);
verification_test(gpr_murmur_hash3, 0xB0F57EE3);
}
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(&argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

@ -36,7 +36,6 @@ static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args*) {}
DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
{

@ -31,7 +31,6 @@ static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const binder_transport_fuzzer::Input& input) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
{

@ -37,7 +37,6 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
@ -344,6 +343,5 @@ int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(&argc, argv);
::testing::InitGoogleTest(&argc, argv);
grpc::testing::TestGrpcScope grpc_scope;
grpc_test_only_set_slice_hash_seed(0);
return RUN_ALL_TESTS();
}

@ -30,7 +30,6 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/transport/chttp2/hpack_parser_fuzzer.pb.h"
@ -43,7 +42,6 @@ bool leak_check = true;
static void dont_log(gpr_log_func_args* /*args*/) {}
DEFINE_PROTO_FUZZER(const hpack_parser_fuzzer::Msg& msg) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
auto memory_allocator = grpc_core::ResourceQuota::Default()

@ -1999,8 +1999,6 @@ src/core/lib/gpr/log_android.cc \
src/core/lib/gpr/log_linux.cc \
src/core/lib/gpr/log_posix.cc \
src/core/lib/gpr/log_windows.cc \
src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gpr/murmur_hash.h \
src/core/lib/gpr/spinlock.h \
src/core/lib/gpr/string.cc \
src/core/lib/gpr/string.h \
@ -2419,9 +2417,7 @@ src/core/lib/slice/slice.h \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_buffer.h \
src/core/lib/slice/slice_internal.h \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_refcount.h \
src/core/lib/slice/slice_refcount_base.h \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/slice/slice_string_helpers.h \
src/core/lib/surface/api_trace.cc \

@ -1788,8 +1788,6 @@ src/core/lib/gpr/log_android.cc \
src/core/lib/gpr/log_linux.cc \
src/core/lib/gpr/log_posix.cc \
src/core/lib/gpr/log_windows.cc \
src/core/lib/gpr/murmur_hash.cc \
src/core/lib/gpr/murmur_hash.h \
src/core/lib/gpr/spinlock.h \
src/core/lib/gpr/string.cc \
src/core/lib/gpr/string.h \
@ -2210,9 +2208,7 @@ src/core/lib/slice/slice.h \
src/core/lib/slice/slice_buffer.cc \
src/core/lib/slice/slice_buffer.h \
src/core/lib/slice/slice_internal.h \
src/core/lib/slice/slice_refcount.cc \
src/core/lib/slice/slice_refcount.h \
src/core/lib/slice/slice_refcount_base.h \
src/core/lib/slice/slice_string_helpers.cc \
src/core/lib/slice/slice_string_helpers.h \
src/core/lib/surface/README.md \

@ -4763,30 +4763,6 @@
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
"flaky": false,
"gtest": true,
"language": "c++",
"name": "murmur_hash_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
],
"uses_polling": false
},
{
"args": [],
"benchmark": false,

Loading…
Cancel
Save