diff options
author | Vijay Pai <vpai@google.com> | 2018-02-08 10:26:25 -0800 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2018-02-08 10:26:25 -0800 |
commit | 25b61fd60e9fd24c3b23eac9396e22745f1cf51d (patch) | |
tree | 5b19761cfcd1e44fefffda9dad02670324f15ee1 /src/core/lib | |
parent | b6cf123717b8f6e405f62dd12cb6c43664e0680a (diff) | |
parent | 7bd5e18fea0201fed3edd74e3c3d7caf9040609c (diff) |
Merge branch 'master' into gpr_review_tls
Diffstat (limited to 'src/core/lib')
42 files changed, 642 insertions, 831 deletions
diff --git a/src/core/lib/compression/compression.cc b/src/core/lib/compression/compression.cc index 99e6014b23..167e90fd26 100644 --- a/src/core/lib/compression/compression.cc +++ b/src/core/lib/compression/compression.cc @@ -29,8 +29,7 @@ int grpc_compression_algorithm_is_message( grpc_compression_algorithm algorithm) { - return (algorithm >= GRPC_COMPRESS_MESSAGE_DEFLATE && - algorithm <= GRPC_COMPRESS_MESSAGE_GZIP) + return (algorithm >= GRPC_COMPRESS_DEFLATE && algorithm <= GRPC_COMPRESS_GZIP) ? 1 : 0; } @@ -44,11 +43,11 @@ int grpc_compression_algorithm_parse(grpc_slice name, if (grpc_slice_eq(name, GRPC_MDSTR_IDENTITY)) { *algorithm = GRPC_COMPRESS_NONE; return 1; - } else if (grpc_slice_eq(name, GRPC_MDSTR_MESSAGE_SLASH_DEFLATE)) { - *algorithm = GRPC_COMPRESS_MESSAGE_DEFLATE; + } else if (grpc_slice_eq(name, GRPC_MDSTR_DEFLATE)) { + *algorithm = GRPC_COMPRESS_DEFLATE; return 1; - } else if (grpc_slice_eq(name, GRPC_MDSTR_MESSAGE_SLASH_GZIP)) { - *algorithm = GRPC_COMPRESS_MESSAGE_GZIP; + } else if (grpc_slice_eq(name, GRPC_MDSTR_GZIP)) { + *algorithm = GRPC_COMPRESS_GZIP; return 1; } else if (grpc_slice_eq(name, GRPC_MDSTR_STREAM_SLASH_GZIP)) { *algorithm = GRPC_COMPRESS_STREAM_GZIP; @@ -67,11 +66,11 @@ int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm, case GRPC_COMPRESS_NONE: *name = "identity"; return 1; - case GRPC_COMPRESS_MESSAGE_DEFLATE: - *name = "message/deflate"; + case GRPC_COMPRESS_DEFLATE: + *name = "deflate"; return 1; - case GRPC_COMPRESS_MESSAGE_GZIP: - *name = "message/gzip"; + case GRPC_COMPRESS_GZIP: + *name = "gzip"; return 1; case GRPC_COMPRESS_STREAM_GZIP: *name = "stream/gzip"; @@ -133,10 +132,10 @@ grpc_slice grpc_compression_algorithm_slice( switch (algorithm) { case GRPC_COMPRESS_NONE: return GRPC_MDSTR_IDENTITY; - case GRPC_COMPRESS_MESSAGE_DEFLATE: - return GRPC_MDSTR_MESSAGE_SLASH_DEFLATE; - case GRPC_COMPRESS_MESSAGE_GZIP: - return GRPC_MDSTR_MESSAGE_SLASH_GZIP; + case GRPC_COMPRESS_DEFLATE: + return GRPC_MDSTR_DEFLATE; + case GRPC_COMPRESS_GZIP: + return GRPC_MDSTR_GZIP; case GRPC_COMPRESS_STREAM_GZIP: return GRPC_MDSTR_STREAM_SLASH_GZIP; case GRPC_COMPRESS_ALGORITHMS_COUNT: @@ -148,10 +147,8 @@ grpc_slice grpc_compression_algorithm_slice( grpc_compression_algorithm grpc_compression_algorithm_from_slice( grpc_slice str) { if (grpc_slice_eq(str, GRPC_MDSTR_IDENTITY)) return GRPC_COMPRESS_NONE; - if (grpc_slice_eq(str, GRPC_MDSTR_MESSAGE_SLASH_DEFLATE)) - return GRPC_COMPRESS_MESSAGE_DEFLATE; - if (grpc_slice_eq(str, GRPC_MDSTR_MESSAGE_SLASH_GZIP)) - return GRPC_COMPRESS_MESSAGE_GZIP; + if (grpc_slice_eq(str, GRPC_MDSTR_DEFLATE)) return GRPC_COMPRESS_DEFLATE; + if (grpc_slice_eq(str, GRPC_MDSTR_GZIP)) return GRPC_COMPRESS_GZIP; if (grpc_slice_eq(str, GRPC_MDSTR_STREAM_SLASH_GZIP)) return GRPC_COMPRESS_STREAM_GZIP; return GRPC_COMPRESS_ALGORITHMS_COUNT; @@ -162,9 +159,9 @@ grpc_mdelem grpc_compression_encoding_mdelem( switch (algorithm) { case GRPC_COMPRESS_NONE: return GRPC_MDELEM_GRPC_ENCODING_IDENTITY; - case GRPC_COMPRESS_MESSAGE_DEFLATE: + case GRPC_COMPRESS_DEFLATE: return GRPC_MDELEM_GRPC_ENCODING_DEFLATE; - case GRPC_COMPRESS_MESSAGE_GZIP: + case GRPC_COMPRESS_GZIP: return GRPC_MDELEM_GRPC_ENCODING_GZIP; case GRPC_COMPRESS_STREAM_GZIP: return GRPC_MDELEM_GRPC_ENCODING_GZIP; diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc index 263cdf06eb..1b7ead3301 100644 --- a/src/core/lib/compression/compression_internal.cc +++ b/src/core/lib/compression/compression_internal.cc @@ -80,9 +80,9 @@ grpc_message_compression_algorithm grpc_compression_algorithm_to_message_compression_algorithm( grpc_compression_algorithm algo) { switch (algo) { - case GRPC_COMPRESS_MESSAGE_DEFLATE: + case GRPC_COMPRESS_DEFLATE: return GRPC_MESSAGE_COMPRESS_DEFLATE; - case GRPC_COMPRESS_MESSAGE_GZIP: + case GRPC_COMPRESS_GZIP: return GRPC_MESSAGE_COMPRESS_GZIP; default: return GRPC_MESSAGE_COMPRESS_NONE; @@ -147,10 +147,10 @@ int grpc_compression_algorithm_from_message_stream_compression_algorithm( *algorithm = GRPC_COMPRESS_NONE; return 1; case GRPC_MESSAGE_COMPRESS_DEFLATE: - *algorithm = GRPC_COMPRESS_MESSAGE_DEFLATE; + *algorithm = GRPC_COMPRESS_DEFLATE; return 1; case GRPC_MESSAGE_COMPRESS_GZIP: - *algorithm = GRPC_COMPRESS_MESSAGE_GZIP; + *algorithm = GRPC_COMPRESS_GZIP; return 1; default: *algorithm = GRPC_COMPRESS_NONE; diff --git a/src/core/lib/compression/compression_ruby.cc b/src/core/lib/compression/compression_ruby.cc deleted file mode 100644 index 293062f5ed..0000000000 --- a/src/core/lib/compression/compression_ruby.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Copyright 2017 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/compression_ruby.h> -#include <grpc/support/useful.h> - -#include "src/core/lib/surface/api_trace.h" -#include "src/core/lib/transport/static_metadata.h" - -int grpc_compression_algorithm_parse_ruby( - grpc_slice name, grpc_compression_algorithm* algorithm) { - if (grpc_slice_eq(name, GRPC_MDSTR_IDENTITY)) { - *algorithm = GRPC_COMPRESS_NONE; - return 1; - } else if (grpc_slice_eq(name, GRPC_MDSTR_DEFLATE)) { - *algorithm = GRPC_COMPRESS_MESSAGE_DEFLATE; - return 1; - } else if (grpc_slice_eq(name, GRPC_MDSTR_GZIP)) { - *algorithm = GRPC_COMPRESS_MESSAGE_GZIP; - return 1; - } else if (grpc_slice_eq(name, GRPC_MDSTR_STREAM_SLASH_GZIP)) { - *algorithm = GRPC_COMPRESS_STREAM_GZIP; - return 1; - } else { - return 0; - } - return 0; -} - -int grpc_compression_algorithm_name_ruby(grpc_compression_algorithm algorithm, - const char** name) { - GRPC_API_TRACE("grpc_compression_algorithm_parse(algorithm=%d, name=%p)", 2, - ((int)algorithm, name)); - switch (algorithm) { - case GRPC_COMPRESS_NONE: - *name = "identity"; - return 1; - case GRPC_COMPRESS_MESSAGE_DEFLATE: - *name = "deflate"; - return 1; - case GRPC_COMPRESS_MESSAGE_GZIP: - *name = "gzip"; - return 1; - case GRPC_COMPRESS_STREAM_GZIP: - *name = "stream/gzip"; - return 1; - case GRPC_COMPRESS_ALGORITHMS_COUNT: - return 0; - } - return 0; -} diff --git a/src/core/lib/gpr/alloc.cc b/src/core/lib/gpr/alloc.cc index 000b7dcb25..b1d1550630 100644 --- a/src/core/lib/gpr/alloc.cc +++ b/src/core/lib/gpr/alloc.cc @@ -50,43 +50,39 @@ void gpr_set_allocation_functions(gpr_allocation_functions functions) { } void* gpr_malloc(size_t size) { + GPR_TIMER_SCOPE("gpr_malloc", 0); void* p; if (size == 0) return nullptr; - GPR_TIMER_BEGIN("gpr_malloc", 0); p = g_alloc_functions.malloc_fn(size); if (!p) { abort(); } - GPR_TIMER_END("gpr_malloc", 0); return p; } void* gpr_zalloc(size_t size) { + GPR_TIMER_SCOPE("gpr_zalloc", 0); void* p; if (size == 0) return nullptr; - GPR_TIMER_BEGIN("gpr_zalloc", 0); p = g_alloc_functions.zalloc_fn(size); if (!p) { abort(); } - GPR_TIMER_END("gpr_zalloc", 0); return p; } void gpr_free(void* p) { - GPR_TIMER_BEGIN("gpr_free", 0); + GPR_TIMER_SCOPE("gpr_free", 0); g_alloc_functions.free_fn(p); - GPR_TIMER_END("gpr_free", 0); } void* gpr_realloc(void* p, size_t size) { + GPR_TIMER_SCOPE("gpr_realloc", 0); if ((size == 0) && (p == nullptr)) return nullptr; - GPR_TIMER_BEGIN("gpr_realloc", 0); p = g_alloc_functions.realloc_fn(p, size); if (!p) { abort(); } - GPR_TIMER_END("gpr_realloc", 0); return p; } diff --git a/src/core/lib/gpr/env.h b/src/core/lib/gpr/env.h index 7f35104be3..b31e20b7d2 100644 --- a/src/core/lib/gpr/env.h +++ b/src/core/lib/gpr/env.h @@ -29,7 +29,7 @@ variable exists). */ char* gpr_getenv(const char* name); -/* Sets the the environment with the specified name to the specified value. */ +/* Sets the environment with the specified name to the specified value. */ void gpr_setenv(const char* name, const char* value); /* This is a version of gpr_getenv that does not produce any output if it has to diff --git a/src/core/lib/gpr/host_port.cc b/src/core/lib/gpr/host_port.cc index 29178279d3..0776727906 100644 --- a/src/core/lib/gpr/host_port.cc +++ b/src/core/lib/gpr/host_port.cc @@ -16,13 +16,14 @@ * */ -#include <grpc/support/host_port.h> +#include "src/core/lib/gpr/host_port.h" #include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> + #include "src/core/lib/gpr/string.h" int gpr_join_host_port(char** out, const char* host, int port) { diff --git a/src/core/lib/gpr/host_port.h b/src/core/lib/gpr/host_port.h new file mode 100644 index 0000000000..0bf0960f82 --- /dev/null +++ b/src/core/lib/gpr/host_port.h @@ -0,0 +1,43 @@ +/* + * + * 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_HOST_PORT_H +#define GRPC_CORE_LIB_GPR_HOST_PORT_H + +#include <grpc/support/port_platform.h> + +/** Given a host and port, creates a newly-allocated string of the form + "host:port" or "[ho:st]:port", depending on whether the host contains colons + like an IPv6 literal. If the host is already bracketed, then additional + brackets will not be added. + + Usage is similar to gpr_asprintf: returns the number of bytes written + (excluding the final '\0'), and *out points to a string which must later be + destroyed using gpr_free(). + + In the unlikely event of an error, returns -1 and sets *out to NULL. */ +int gpr_join_host_port(char** out, const char* host, int port); + +/** Given a name in the form "host:port" or "[ho:st]:port", split into hostname + and port number, into newly allocated strings, which must later be + destroyed using gpr_free(). + Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on + failure. */ +int gpr_split_host_port(const char* name, char** host, char** port); + +#endif /* GRPC_CORE_LIB_GPR_HOST_PORT_H */ diff --git a/src/core/lib/gpr/sync_posix.cc b/src/core/lib/gpr/sync_posix.cc index c3f6b10463..f23a8b2486 100644 --- a/src/core/lib/gpr/sync_posix.cc +++ b/src/core/lib/gpr/sync_posix.cc @@ -43,23 +43,19 @@ void gpr_mu_lock(gpr_mu* mu) { #ifdef GPR_LOW_LEVEL_COUNTERS GPR_ATM_INC_COUNTER(gpr_mu_locks); #endif - GPR_TIMER_BEGIN("gpr_mu_lock", 0); + GPR_TIMER_SCOPE("gpr_mu_lock", 0); GPR_ASSERT(pthread_mutex_lock(mu) == 0); - GPR_TIMER_END("gpr_mu_lock", 0); } void gpr_mu_unlock(gpr_mu* mu) { - GPR_TIMER_BEGIN("gpr_mu_unlock", 0); + GPR_TIMER_SCOPE("gpr_mu_unlock", 0); GPR_ASSERT(pthread_mutex_unlock(mu) == 0); - GPR_TIMER_END("gpr_mu_unlock", 0); } int gpr_mu_trylock(gpr_mu* mu) { - int err; - GPR_TIMER_BEGIN("gpr_mu_trylock", 0); - err = pthread_mutex_trylock(mu); + GPR_TIMER_SCOPE("gpr_mu_trylock", 0); + int err = pthread_mutex_trylock(mu); GPR_ASSERT(err == 0 || err == EBUSY); - GPR_TIMER_END("gpr_mu_trylock", 0); return err == 0; } diff --git a/src/core/lib/gprpp/orphanable.h b/src/core/lib/gprpp/orphanable.h index 50199730c9..78d1b01ff8 100644 --- a/src/core/lib/gprpp/orphanable.h +++ b/src/core/lib/gprpp/orphanable.h @@ -28,6 +28,7 @@ #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/memory.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" namespace grpc_core { @@ -69,6 +70,7 @@ inline OrphanablePtr<T> MakeOrphanable(Args&&... args) { } // A type of Orphanable with internal ref-counting. +template <typename Child> class InternallyRefCounted : public Orphanable { public: // Not copyable nor movable. @@ -78,10 +80,20 @@ class InternallyRefCounted : public Orphanable { GRPC_ABSTRACT_BASE_CLASS protected: + // Allow Delete() to access destructor. + template <typename T> + friend void Delete(T*); + + // Allow RefCountedPtr<> to access Unref() and IncrementRefCount(). + friend class RefCountedPtr<Child>; + InternallyRefCounted() { gpr_ref_init(&refs_, 1); } virtual ~InternallyRefCounted() {} - void Ref() { gpr_ref(&refs_); } + RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT { + IncrementRefCount(); + return RefCountedPtr<Child>(static_cast<Child*>(this)); + } void Unref() { if (gpr_unref(&refs_)) { @@ -89,11 +101,9 @@ class InternallyRefCounted : public Orphanable { } } - // Allow Delete() to access destructor. - template <typename T> - friend void Delete(T*); - private: + void IncrementRefCount() { gpr_ref(&refs_); } + gpr_refcount refs_; }; @@ -103,6 +113,7 @@ class InternallyRefCounted : public Orphanable { // pointers and legacy code that is manually calling Ref() and Unref(). // Once all of our code is converted to idiomatic C++, we may be able to // eliminate this class. +template <typename Child> class InternallyRefCountedWithTracing : public Orphanable { public: // Not copyable nor movable. @@ -118,6 +129,9 @@ class InternallyRefCountedWithTracing : public Orphanable { template <typename T> friend void Delete(T*); + // Allow RefCountedPtr<> to access Unref() and IncrementRefCount(). + friend class RefCountedPtr<Child>; + InternallyRefCountedWithTracing() : InternallyRefCountedWithTracing(static_cast<TraceFlag*>(nullptr)) {} @@ -133,18 +147,27 @@ class InternallyRefCountedWithTracing : public Orphanable { virtual ~InternallyRefCountedWithTracing() {} - void Ref() { gpr_ref(&refs_); } + RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT { + IncrementRefCount(); + return RefCountedPtr<Child>(static_cast<Child*>(this)); + } - void Ref(const DebugLocation& location, const char* reason) { + RefCountedPtr<Child> Ref(const DebugLocation& location, + const char* reason) GRPC_MUST_USE_RESULT { if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s", trace_flag_->name(), this, location.file(), location.line(), old_refs, old_refs + 1, reason); } - Ref(); + return Ref(); } + // TODO(roth): Once all of our code is converted to C++ and can use + // RefCountedPtr<> instead of manual ref-counting, make the Unref() methods + // private, since they will only be used by RefCountedPtr<>, which is a + // friend of this class. + void Unref() { if (gpr_unref(&refs_)) { Delete(this); @@ -162,6 +185,8 @@ class InternallyRefCountedWithTracing : public Orphanable { } private: + void IncrementRefCount() { gpr_ref(&refs_); } + TraceFlag* trace_flag_ = nullptr; gpr_refcount refs_; }; diff --git a/src/core/lib/gprpp/ref_counted.h b/src/core/lib/gprpp/ref_counted.h index c68118a71a..ab589fc01a 100644 --- a/src/core/lib/gprpp/ref_counted.h +++ b/src/core/lib/gprpp/ref_counted.h @@ -26,16 +26,28 @@ #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/memory.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" namespace grpc_core { // A base class for reference-counted objects. // New objects should be created via New() and start with a refcount of 1. // When the refcount reaches 0, the object will be deleted via Delete(). +// +// This will commonly be used by CRTP (curiously-recurring template pattern) +// e.g., class MyClass : public RefCounted<MyClass> +template <typename Child> class RefCounted { public: - void Ref() { gpr_ref(&refs_); } + RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT { + IncrementRefCount(); + return RefCountedPtr<Child>(static_cast<Child*>(this)); + } + // TODO(roth): Once all of our code is converted to C++ and can use + // RefCountedPtr<> instead of manual ref-counting, make this method + // private, since it will only be used by RefCountedPtr<>, which is a + // friend of this class. void Unref() { if (gpr_unref(&refs_)) { Delete(this); @@ -58,6 +70,11 @@ class RefCounted { virtual ~RefCounted() {} private: + // Allow RefCountedPtr<> to access IncrementRefCount(). + friend class RefCountedPtr<Child>; + + void IncrementRefCount() { gpr_ref(&refs_); } + gpr_refcount refs_; }; @@ -67,20 +84,30 @@ class RefCounted { // pointers and legacy code that is manually calling Ref() and Unref(). // Once all of our code is converted to idiomatic C++, we may be able to // eliminate this class. +template <typename Child> class RefCountedWithTracing { public: - void Ref() { gpr_ref(&refs_); } + RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT { + IncrementRefCount(); + return RefCountedPtr<Child>(static_cast<Child*>(this)); + } - void Ref(const DebugLocation& location, const char* reason) { + RefCountedPtr<Child> Ref(const DebugLocation& location, + const char* reason) GRPC_MUST_USE_RESULT { if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) { gpr_atm old_refs = gpr_atm_no_barrier_load(&refs_.count); gpr_log(GPR_DEBUG, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s", trace_flag_->name(), this, location.file(), location.line(), old_refs, old_refs + 1, reason); } - Ref(); + return Ref(); } + // TODO(roth): Once all of our code is converted to C++ and can use + // RefCountedPtr<> instead of manual ref-counting, make the Unref() methods + // private, since they will only be used by RefCountedPtr<>, which is a + // friend of this class. + void Unref() { if (gpr_unref(&refs_)) { Delete(this); @@ -124,6 +151,11 @@ class RefCountedWithTracing { virtual ~RefCountedWithTracing() {} private: + // Allow RefCountedPtr<> to access IncrementRefCount(). + friend class RefCountedPtr<Child>; + + void IncrementRefCount() { gpr_ref(&refs_); } + TraceFlag* trace_flag_ = nullptr; gpr_refcount refs_; }; diff --git a/src/core/lib/gprpp/ref_counted_ptr.h b/src/core/lib/gprpp/ref_counted_ptr.h index dda0f00d79..f82ba50da3 100644 --- a/src/core/lib/gprpp/ref_counted_ptr.h +++ b/src/core/lib/gprpp/ref_counted_ptr.h @@ -25,8 +25,8 @@ namespace grpc_core { -// A smart pointer class for objects that provide Ref() and Unref() methods, -// such as those provided by the RefCounted base class. +// A smart pointer class for objects that provide IncrementRefCount() and +// Unref() methods, such as those provided by the RefCounted base class. template <typename T> class RefCountedPtr { public: @@ -49,13 +49,13 @@ class RefCountedPtr { // Copy support. RefCountedPtr(const RefCountedPtr& other) { - if (other.value_ != nullptr) other.value_->Ref(); + if (other.value_ != nullptr) other.value_->IncrementRefCount(); value_ = other.value_; } RefCountedPtr& operator=(const RefCountedPtr& other) { // Note: Order of reffing and unreffing is important here in case value_ // and other.value_ are the same object. - if (other.value_ != nullptr) other.value_->Ref(); + if (other.value_ != nullptr) other.value_->IncrementRefCount(); if (value_ != nullptr) value_->Unref(); value_ = other.value_; return *this; @@ -71,6 +71,16 @@ class RefCountedPtr { value_ = value; } + // TODO(roth): This method exists solely as a transition mechanism to allow + // us to pass a ref to idiomatic C code that does not use RefCountedPtr<>. + // Once all of our code has been converted to idiomatic C++, this + // method should go away. + T* release() { + T* value = value_; + value_ = nullptr; + return value; + } + T* get() const { return value_; } T& operator*() const { return *value_; } diff --git a/src/core/lib/iomgr/call_combiner.cc b/src/core/lib/iomgr/call_combiner.cc index a9f48fb3c2..0e4c9cb3b3 100644 --- a/src/core/lib/iomgr/call_combiner.cc +++ b/src/core/lib/iomgr/call_combiner.cc @@ -60,7 +60,7 @@ void grpc_call_combiner_start(grpc_call_combiner* call_combiner, grpc_closure* closure, grpc_error* error DEBUG_ARGS, const char* reason) { - GPR_TIMER_BEGIN("call_combiner_start", 0); + GPR_TIMER_SCOPE("call_combiner_start", 0); if (grpc_call_combiner_trace.enabled()) { gpr_log(GPR_DEBUG, "==> grpc_call_combiner_start() [%p] closure=%p [" DEBUG_FMT_STR @@ -92,12 +92,11 @@ void grpc_call_combiner_start(grpc_call_combiner* call_combiner, closure->error_data.error = error; gpr_mpscq_push(&call_combiner->queue, (gpr_mpscq_node*)closure); } - GPR_TIMER_END("call_combiner_start", 0); } void grpc_call_combiner_stop(grpc_call_combiner* call_combiner DEBUG_ARGS, const char* reason) { - GPR_TIMER_BEGIN("call_combiner_stop", 0); + GPR_TIMER_SCOPE("call_combiner_stop", 0); if (grpc_call_combiner_trace.enabled()) { gpr_log(GPR_DEBUG, "==> grpc_call_combiner_stop() [%p] [" DEBUG_FMT_STR "%s]", @@ -136,7 +135,6 @@ void grpc_call_combiner_stop(grpc_call_combiner* call_combiner DEBUG_ARGS, } else if (grpc_call_combiner_trace.enabled()) { gpr_log(GPR_DEBUG, " queue empty"); } - GPR_TIMER_END("call_combiner_stop", 0); } void grpc_call_combiner_set_notify_on_cancel(grpc_call_combiner* call_combiner, diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 249fca6cd6..2bf2578c63 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -247,7 +247,7 @@ inline void grpc_closure_run(const char* file, int line, grpc_closure* c, #else inline void grpc_closure_run(grpc_closure* c, grpc_error* error) { #endif - GPR_TIMER_BEGIN("grpc_closure_run", 0); + GPR_TIMER_SCOPE("grpc_closure_run", 0); if (c != nullptr) { #ifndef NDEBUG c->file_initiated = file; @@ -259,7 +259,6 @@ inline void grpc_closure_run(grpc_closure* c, grpc_error* error) { } else { GRPC_ERROR_UNREF(error); } - GPR_TIMER_END("grpc_closure_run", 0); } /** Run a closure directly. Caller ensures that no locks are being held above. @@ -278,7 +277,7 @@ inline void grpc_closure_sched(const char* file, int line, grpc_closure* c, #else inline void grpc_closure_sched(grpc_closure* c, grpc_error* error) { #endif - GPR_TIMER_BEGIN("grpc_closure_sched", 0); + GPR_TIMER_SCOPE("grpc_closure_sched", 0); if (c != nullptr) { #ifndef NDEBUG if (c->scheduled) { @@ -299,7 +298,6 @@ inline void grpc_closure_sched(grpc_closure* c, grpc_error* error) { } else { GRPC_ERROR_UNREF(error); } - GPR_TIMER_END("grpc_closure_sched", 0); } /** Schedule a closure to be run. Does not need to be run from a safe point. */ diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc index e4d7a6abd8..2965d807c1 100644 --- a/src/core/lib/iomgr/combiner.cc +++ b/src/core/lib/iomgr/combiner.cc @@ -153,8 +153,8 @@ static void push_first_on_exec_ctx(grpc_combiner* lock) { offsetof(grpc_combiner, scheduler_name))) static void combiner_exec(grpc_closure* cl, grpc_error* error) { + GPR_TIMER_SCOPE("combiner.execute", 0); GRPC_STATS_INC_COMBINER_LOCKS_SCHEDULED_ITEMS(); - GPR_TIMER_BEGIN("combiner.execute", 0); grpc_combiner* lock = COMBINER_FROM_CLOSURE_SCHEDULER(cl, scheduler); gpr_atm last = gpr_atm_full_fetch_add(&lock->state, STATE_ELEM_COUNT_LOW_BIT); GRPC_COMBINER_TRACE(gpr_log(GPR_DEBUG, @@ -181,7 +181,6 @@ static void combiner_exec(grpc_closure* cl, grpc_error* error) { assert(cl->cb); cl->error_data.error = error; gpr_mpscq_push(&lock->queue, &cl->next_data.atm_next); - GPR_TIMER_END("combiner.execute", 0); } static void move_next() { @@ -207,11 +206,10 @@ static void queue_offload(grpc_combiner* lock) { } bool grpc_combiner_continue_exec_ctx() { - GPR_TIMER_BEGIN("combiner.continue_exec_ctx", 0); + GPR_TIMER_SCOPE("combiner.continue_exec_ctx", 0); grpc_combiner* lock = grpc_core::ExecCtx::Get()->combiner_data()->active_combiner; if (lock == nullptr) { - GPR_TIMER_END("combiner.continue_exec_ctx", 0); return false; } @@ -233,7 +231,6 @@ bool grpc_combiner_continue_exec_ctx() { // this execution context wants to move on: schedule remaining work to be // picked up on the executor queue_offload(lock); - GPR_TIMER_END("combiner.continue_exec_ctx", 0); return true; } @@ -249,10 +246,9 @@ bool grpc_combiner_continue_exec_ctx() { // go off and do something else for a while (and come back later) GPR_TIMER_MARK("delay_busy", 0); queue_offload(lock); - GPR_TIMER_END("combiner.continue_exec_ctx", 0); return true; } - GPR_TIMER_BEGIN("combiner.exec1", 0); + GPR_TIMER_SCOPE("combiner.exec1", 0); grpc_closure* cl = (grpc_closure*)n; grpc_error* cl_err = cl->error_data.error; #ifndef NDEBUG @@ -260,14 +256,13 @@ bool grpc_combiner_continue_exec_ctx() { #endif cl->cb(cl->cb_arg, cl_err); GRPC_ERROR_UNREF(cl_err); - GPR_TIMER_END("combiner.exec1", 0); } else { grpc_closure* c = lock->final_list.head; GPR_ASSERT(c != nullptr); grpc_closure_list_init(&lock->final_list); int loops = 0; while (c != nullptr) { - GPR_TIMER_BEGIN("combiner.exec_1final", 0); + GPR_TIMER_SCOPE("combiner.exec_1final", 0); GRPC_COMBINER_TRACE( gpr_log(GPR_DEBUG, "C:%p execute_final[%d] c=%p", lock, loops, c)); grpc_closure* next = c->next_data.next; @@ -278,7 +273,6 @@ bool grpc_combiner_continue_exec_ctx() { c->cb(c->cb_arg, error); GRPC_ERROR_UNREF(error); c = next; - GPR_TIMER_END("combiner.exec_1final", 0); } } @@ -308,41 +302,36 @@ bool grpc_combiner_continue_exec_ctx() { break; case OLD_STATE_WAS(false, 1): // had one count, one unorphaned --> unlocked unorphaned - GPR_TIMER_END("combiner.continue_exec_ctx", 0); return true; case OLD_STATE_WAS(true, 1): // and one count, one orphaned --> unlocked and orphaned really_destroy(lock); - GPR_TIMER_END("combiner.continue_exec_ctx", 0); return true; case OLD_STATE_WAS(false, 0): case OLD_STATE_WAS(true, 0): // these values are illegal - representing an already unlocked or // deleted lock - GPR_TIMER_END("combiner.continue_exec_ctx", 0); GPR_UNREACHABLE_CODE(return true); } push_first_on_exec_ctx(lock); - GPR_TIMER_END("combiner.continue_exec_ctx", 0); return true; } static void enqueue_finally(void* closure, grpc_error* error); static void combiner_finally_exec(grpc_closure* closure, grpc_error* error) { + GPR_TIMER_SCOPE("combiner.execute_finally", 0); GRPC_STATS_INC_COMBINER_LOCKS_SCHEDULED_FINAL_ITEMS(); grpc_combiner* lock = COMBINER_FROM_CLOSURE_SCHEDULER(closure, finally_scheduler); GRPC_COMBINER_TRACE(gpr_log( GPR_DEBUG, "C:%p grpc_combiner_execute_finally c=%p; ac=%p", lock, closure, grpc_core::ExecCtx::Get()->combiner_data()->active_combiner)); - GPR_TIMER_BEGIN("combiner.execute_finally", 0); if (grpc_core::ExecCtx::Get()->combiner_data()->active_combiner != lock) { GPR_TIMER_MARK("slowpath", 0); GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(enqueue_finally, closure, grpc_combiner_scheduler(lock)), error); - GPR_TIMER_END("combiner.execute_finally", 0); return; } @@ -350,7 +339,6 @@ static void combiner_finally_exec(grpc_closure* closure, grpc_error* error) { gpr_atm_full_fetch_add(&lock->state, STATE_ELEM_COUNT_LOW_BIT); } grpc_closure_list_append(&lock->final_list, closure, error); - GPR_TIMER_END("combiner.execute_finally", 0); } static void enqueue_finally(void* closure, grpc_error* error) { diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index 67c3caf5ee..0e27ad427c 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -314,7 +314,7 @@ static void internal_add_error(grpc_error** err, grpc_error* new_err) { grpc_error* grpc_error_create(const char* file, int line, grpc_slice desc, grpc_error** referencing, size_t num_referencing) { - GPR_TIMER_BEGIN("grpc_error_create", 0); + GPR_TIMER_SCOPE("grpc_error_create", 0); uint8_t initial_arena_capacity = (uint8_t)( DEFAULT_ERROR_CAPACITY + (uint8_t)(num_referencing * SLOTS_PER_LINKED_ERROR) + SURPLUS_CAPACITY); @@ -355,7 +355,6 @@ grpc_error* grpc_error_create(const char* file, int line, grpc_slice desc, gpr_atm_no_barrier_store(&err->atomics.error_string, 0); gpr_ref_init(&err->atomics.refs, 1); - GPR_TIMER_END("grpc_error_create", 0); return err; } @@ -378,7 +377,7 @@ static void ref_errs(grpc_error* err) { } static grpc_error* copy_error_and_unref(grpc_error* in) { - GPR_TIMER_BEGIN("copy_error_and_unref", 0); + GPR_TIMER_SCOPE("copy_error_and_unref", 0); grpc_error* out; if (grpc_error_is_special(in)) { out = GRPC_ERROR_CREATE_FROM_STATIC_STRING("unknown"); @@ -422,16 +421,14 @@ static grpc_error* copy_error_and_unref(grpc_error* in) { ref_errs(out); GRPC_ERROR_UNREF(in); } - GPR_TIMER_END("copy_error_and_unref", 0); return out; } grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which, intptr_t value) { - GPR_TIMER_BEGIN("grpc_error_set_int", 0); + GPR_TIMER_SCOPE("grpc_error_set_int", 0); grpc_error* new_err = copy_error_and_unref(src); internal_set_int(&new_err, which, value); - GPR_TIMER_END("grpc_error_set_int", 0); return new_err; } @@ -447,36 +444,31 @@ static special_error_status_map error_status_map[] = { }; bool grpc_error_get_int(grpc_error* err, grpc_error_ints which, intptr_t* p) { - GPR_TIMER_BEGIN("grpc_error_get_int", 0); + GPR_TIMER_SCOPE("grpc_error_get_int", 0); if (grpc_error_is_special(err)) { if (which == GRPC_ERROR_INT_GRPC_STATUS) { for (size_t i = 0; i < GPR_ARRAY_SIZE(error_status_map); i++) { if (error_status_map[i].error == err) { if (p != nullptr) *p = error_status_map[i].code; - GPR_TIMER_END("grpc_error_get_int", 0); return true; } } } - GPR_TIMER_END("grpc_error_get_int", 0); return false; } uint8_t slot = err->ints[which]; if (slot != UINT8_MAX) { if (p != nullptr) *p = err->arena[slot]; - GPR_TIMER_END("grpc_error_get_int", 0); return true; } - GPR_TIMER_END("grpc_error_get_int", 0); return false; } grpc_error* grpc_error_set_str(grpc_error* src, grpc_error_strs which, grpc_slice str) { - GPR_TIMER_BEGIN("grpc_error_set_str", 0); + GPR_TIMER_SCOPE("grpc_error_set_str", 0); grpc_error* new_err = copy_error_and_unref(src); internal_set_str(&new_err, which, str); - GPR_TIMER_END("grpc_error_set_str", 0); return new_err; } @@ -503,10 +495,9 @@ bool grpc_error_get_str(grpc_error* err, grpc_error_strs which, } grpc_error* grpc_error_add_child(grpc_error* src, grpc_error* child) { - GPR_TIMER_BEGIN("grpc_error_add_child", 0); + GPR_TIMER_SCOPE("grpc_error_add_child", 0); grpc_error* new_err = copy_error_and_unref(src); internal_add_error(&new_err, child); - GPR_TIMER_END("grpc_error_add_child", 0); return new_err; } @@ -722,14 +713,13 @@ static char* finish_kvs(kv_pairs* kvs) { } const char* grpc_error_string(grpc_error* err) { - GPR_TIMER_BEGIN("grpc_error_string", 0); + GPR_TIMER_SCOPE("grpc_error_string", 0); if (err == GRPC_ERROR_NONE) return no_error_string; if (err == GRPC_ERROR_OOM) return oom_error_string; if (err == GRPC_ERROR_CANCELLED) return cancelled_error_string; void* p = (void*)gpr_atm_acq_load(&err->atomics.error_string); if (p != nullptr) { - GPR_TIMER_END("grpc_error_string", 0); return (const char*)p; } @@ -752,7 +742,6 @@ const char* grpc_error_string(grpc_error* err) { out = (char*)gpr_atm_acq_load(&err->atomics.error_string); } - GPR_TIMER_END("grpc_error_string", 0); return out; } diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index aa4ff67bc9..b7b5662922 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -519,7 +519,7 @@ static void pollset_destroy(grpc_pollset* pollset) { } static grpc_error* pollset_kick_all(grpc_pollset* pollset) { - GPR_TIMER_BEGIN("pollset_kick_all", 0); + GPR_TIMER_SCOPE("pollset_kick_all", 0); grpc_error* error = GRPC_ERROR_NONE; if (pollset->root_worker != nullptr) { grpc_pollset_worker* worker = pollset->root_worker; @@ -549,7 +549,6 @@ static grpc_error* pollset_kick_all(grpc_pollset* pollset) { } // TODO: sreek. Check if we need to set 'kicked_without_poller' to true here // in the else case - GPR_TIMER_END("pollset_kick_all", 0); return error; } @@ -563,14 +562,13 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) { } static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { - GPR_TIMER_BEGIN("pollset_shutdown", 0); + GPR_TIMER_SCOPE("pollset_shutdown", 0); GPR_ASSERT(pollset->shutdown_closure == nullptr); GPR_ASSERT(!pollset->shutting_down); pollset->shutdown_closure = closure; pollset->shutting_down = true; GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(pollset)); pollset_maybe_finish_shutdown(pollset); - GPR_TIMER_END("pollset_shutdown", 0); } static int poll_deadline_to_millis_timeout(grpc_millis millis) { @@ -594,10 +592,10 @@ static int poll_deadline_to_millis_timeout(grpc_millis millis) { called by g_active_poller thread. So there is no need for synchronization when accessing fields in g_epoll_set */ static grpc_error* process_epoll_events(grpc_pollset* pollset) { + GPR_TIMER_SCOPE("process_epoll_events", 0); + static const char* err_desc = "process_events"; grpc_error* error = GRPC_ERROR_NONE; - - GPR_TIMER_BEGIN("process_epoll_events", 0); long num_events = gpr_atm_acq_load(&g_epoll_set.num_events); long cursor = gpr_atm_acq_load(&g_epoll_set.cursor); for (int idx = 0; @@ -626,7 +624,6 @@ static grpc_error* process_epoll_events(grpc_pollset* pollset) { } } gpr_atm_rel_store(&g_epoll_set.cursor, cursor); - GPR_TIMER_END("process_epoll_events", 0); return error; } @@ -638,7 +635,7 @@ static grpc_error* process_epoll_events(grpc_pollset* pollset) { (i.e the designated poller thread) will be calling this function. So there is no need for any synchronization when accesing fields in g_epoll_set */ static grpc_error* do_epoll_wait(grpc_pollset* ps, grpc_millis deadline) { - GPR_TIMER_BEGIN("do_epoll_wait", 0); + GPR_TIMER_SCOPE("do_epoll_wait", 0); int r; int timeout = poll_deadline_to_millis_timeout(deadline); @@ -665,14 +662,13 @@ static grpc_error* do_epoll_wait(grpc_pollset* ps, grpc_millis deadline) { gpr_atm_rel_store(&g_epoll_set.num_events, r); gpr_atm_rel_store(&g_epoll_set.cursor, 0); - GPR_TIMER_END("do_epoll_wait", 0); return GRPC_ERROR_NONE; } static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, grpc_pollset_worker** worker_hdl, grpc_millis deadline) { - GPR_TIMER_BEGIN("begin_worker", 0); + GPR_TIMER_SCOPE("begin_worker", 0); if (worker_hdl != nullptr) *worker_hdl = worker; worker->initialized_cv = false; SET_KICK_STATE(worker, UNKICKED); @@ -786,17 +782,15 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, if (pollset->kicked_without_poller) { pollset->kicked_without_poller = false; - GPR_TIMER_END("begin_worker", 0); return false; } - GPR_TIMER_END("begin_worker", 0); return worker->state == DESIGNATED_POLLER && !pollset->shutting_down; } static bool check_neighborhood_for_available_poller( pollset_neighborhood* neighborhood) { - GPR_TIMER_BEGIN("check_neighborhood_for_available_poller", 0); + GPR_TIMER_SCOPE("check_neighborhood_for_available_poller", 0); bool found_worker = false; do { grpc_pollset* inspect = neighborhood->active_root; @@ -855,13 +849,12 @@ static bool check_neighborhood_for_available_poller( } gpr_mu_unlock(&inspect->mu); } while (!found_worker); - GPR_TIMER_END("check_neighborhood_for_available_poller", 0); return found_worker; } static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, grpc_pollset_worker** worker_hdl) { - GPR_TIMER_BEGIN("end_worker", 0); + GPR_TIMER_SCOPE("end_worker", 0); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, "PS:%p END_WORKER:%p", pollset, worker); } @@ -931,7 +924,6 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, pollset_maybe_finish_shutdown(pollset); } GPR_ASSERT(gpr_atm_no_barrier_load(&g_active_poller) != (gpr_atm)worker); - GPR_TIMER_END("end_worker", 0); } /* pollset->po.mu lock must be held by the caller before calling this. @@ -941,13 +933,12 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, static grpc_error* pollset_work(grpc_pollset* ps, grpc_pollset_worker** worker_hdl, grpc_millis deadline) { + GPR_TIMER_SCOPE("pollset_work", 0); grpc_pollset_worker worker; grpc_error* error = GRPC_ERROR_NONE; static const char* err_desc = "pollset_work"; - GPR_TIMER_BEGIN("pollset_work", 0); if (ps->kicked_without_poller) { ps->kicked_without_poller = false; - GPR_TIMER_END("pollset_work", 0); return GRPC_ERROR_NONE; } @@ -987,13 +978,12 @@ static grpc_error* pollset_work(grpc_pollset* ps, end_worker(ps, &worker, worker_hdl); gpr_tls_set(&g_current_thread_pollset, 0); - GPR_TIMER_END("pollset_work", 0); return error; } static grpc_error* pollset_kick(grpc_pollset* pollset, grpc_pollset_worker* specific_worker) { - GPR_TIMER_BEGIN("pollset_kick", 0); + GPR_TIMER_SCOPE("pollset_kick", 0); GRPC_STATS_INC_POLLSET_KICK(); grpc_error* ret_err = GRPC_ERROR_NONE; if (grpc_polling_trace.enabled()) { @@ -1150,7 +1140,6 @@ static grpc_error* pollset_kick(grpc_pollset* pollset, goto done; } done: - GPR_TIMER_END("pollset_kick", 0); return ret_err; } diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index f82691dcc9..cd5a410545 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -57,7 +57,7 @@ //#define GRPC_EPOLLEX_CREATE_WORKERS_ON_HEAP 1 #define MAX_EPOLL_EVENTS 100 -#define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 5 +#define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 1 grpc_core::DebugOnlyTraceFlag grpc_trace_pollable_refcount(false, "pollable_refcount"); @@ -199,6 +199,7 @@ struct grpc_pollset { pollable* active_pollable; bool kicked_without_poller; grpc_closure* shutdown_closure; + bool already_shutdown; grpc_pollset_worker* root_worker; int containing_pollset_set_count; }; @@ -560,8 +561,10 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) { } if (pollset->shutdown_closure != nullptr && pollset->root_worker == nullptr && pollset->containing_pollset_set_count == 0) { + GPR_TIMER_MARK("pollset_finish_shutdown", 0); GRPC_CLOSURE_SCHED(pollset->shutdown_closure, GRPC_ERROR_NONE); pollset->shutdown_closure = nullptr; + pollset->already_shutdown = true; } } @@ -569,6 +572,7 @@ static void pollset_maybe_finish_shutdown(grpc_pollset* pollset) { * pollset->active_pollable->mu & specific_worker->pollable_obj->mu must not be * held */ static grpc_error* kick_one_worker(grpc_pollset_worker* specific_worker) { + GPR_TIMER_SCOPE("kick_one_worker", 0); pollable* p = specific_worker->pollable_obj; grpc_core::mu_guard lock(&p->mu); GPR_ASSERT(specific_worker != nullptr); @@ -612,6 +616,7 @@ static grpc_error* kick_one_worker(grpc_pollset_worker* specific_worker) { static grpc_error* pollset_kick(grpc_pollset* pollset, grpc_pollset_worker* specific_worker) { + GPR_TIMER_SCOPE("pollset_kick", 0); GRPC_STATS_INC_POLLSET_KICK(); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, @@ -661,6 +666,7 @@ static grpc_error* pollset_kick(grpc_pollset* pollset, } static grpc_error* pollset_kick_all(grpc_pollset* pollset) { + GPR_TIMER_SCOPE("pollset_kick_all", 0); grpc_error* error = GRPC_ERROR_NONE; const char* err_desc = "pollset_kick_all"; grpc_pollset_worker* w = pollset->root_worker; @@ -677,6 +683,11 @@ static grpc_error* pollset_kick_all(grpc_pollset* pollset) { static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) { gpr_mu_init(&pollset->mu); pollset->active_pollable = POLLABLE_REF(g_empty_pollable, "pollset"); + pollset->kicked_without_poller = false; + pollset->shutdown_closure = nullptr; + pollset->already_shutdown = false; + pollset->root_worker = nullptr; + pollset->containing_pollset_set_count = 0; *mu = &pollset->mu; } @@ -733,6 +744,7 @@ static grpc_error* fd_get_or_become_pollable(grpc_fd* fd, pollable** p) { /* pollset->po.mu lock must be held by the caller before calling this */ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { + GPR_TIMER_SCOPE("pollset_shutdown", 0); GPR_ASSERT(pollset->shutdown_closure == nullptr); pollset->shutdown_closure = closure; GRPC_LOG_IF_ERROR("pollset_shutdown", pollset_kick_all(pollset)); @@ -741,6 +753,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { static grpc_error* pollable_process_events(grpc_pollset* pollset, pollable* pollable_obj, bool drain) { + GPR_TIMER_SCOPE("pollable_process_events", 0); static const char* err_desc = "pollset_process_events"; grpc_error* error = GRPC_ERROR_NONE; for (int i = 0; (drain || i < MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL) && @@ -787,6 +800,7 @@ static void pollset_destroy(grpc_pollset* pollset) { } static grpc_error* pollable_epoll(pollable* p, grpc_millis deadline) { + GPR_TIMER_SCOPE("pollable_epoll", 0); int timeout = poll_deadline_to_millis_timeout(deadline); if (grpc_polling_trace.enabled()) { @@ -862,7 +876,9 @@ static worker_remove_result worker_remove(grpc_pollset_worker** root_worker, static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, grpc_pollset_worker** worker_hdl, grpc_millis deadline) { - bool do_poll = (pollset->shutdown_closure == nullptr); + GPR_TIMER_SCOPE("begin_worker", 0); + bool do_poll = + (pollset->shutdown_closure == nullptr && !pollset->already_shutdown); if (worker_hdl != nullptr) *worker_hdl = worker; worker->initialized_cv = false; worker->kicked = false; @@ -913,6 +929,7 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, grpc_pollset_worker** worker_hdl) { + GPR_TIMER_SCOPE("end_worker", 0); gpr_mu_lock(&pollset->mu); gpr_mu_lock(&worker->pollable_obj->mu); switch (worker_remove(&worker->pollable_obj->root_worker, worker, @@ -955,6 +972,7 @@ static long gettid(void) { return syscall(__NR_gettid); } static grpc_error* pollset_work(grpc_pollset* pollset, grpc_pollset_worker** worker_hdl, grpc_millis deadline) { + GPR_TIMER_SCOPE("pollset_work", 0); #ifdef GRPC_EPOLLEX_CREATE_WORKERS_ON_HEAP grpc_pollset_worker* worker = (grpc_pollset_worker*)gpr_malloc(sizeof(*worker)); @@ -1092,6 +1110,16 @@ static grpc_error* pollset_as_multipollable_locked(grpc_pollset* pollset, case PO_EMPTY: POLLABLE_UNREF(pollset->active_pollable, "pollset"); error = pollable_create(PO_MULTI, &pollset->active_pollable); + /* Any workers currently polling on this pollset must now be woked up so + * that they can pick up the new active_pollable */ + if (grpc_polling_trace.enabled()) { + gpr_log(GPR_DEBUG, + "PS:%p active pollable transition from empty to multi", + pollset); + } + static const char* err_desc = + "pollset_as_multipollable_locked: empty -> multi"; + append_error(&error, pollset_kick_all(pollset), err_desc); break; case PO_FD: gpr_mu_lock(&po_at_start->owner_fd->orphan_mu); @@ -1120,6 +1148,7 @@ static grpc_error* pollset_as_multipollable_locked(grpc_pollset* pollset, } static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) { + GPR_TIMER_SCOPE("pollset_add_fd", 0); gpr_mu_lock(&pollset->mu); grpc_error* error = pollset_add_fd_locked(pollset, fd); gpr_mu_unlock(&pollset->mu); @@ -1168,6 +1197,7 @@ static void pollset_set_unref(grpc_pollset_set* pss) { } static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) { + GPR_TIMER_SCOPE("pollset_set_add_fd", 0); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, "PSS:%p: add fd %p (%d)", pss, fd, fd->fd); } @@ -1191,6 +1221,7 @@ static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) { } static void pollset_set_del_fd(grpc_pollset_set* pss, grpc_fd* fd) { + GPR_TIMER_SCOPE("pollset_set_del_fd", 0); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, "PSS:%p: del fd %p", pss, fd); } @@ -1211,6 +1242,7 @@ static void pollset_set_del_fd(grpc_pollset_set* pss, grpc_fd* fd) { } static void pollset_set_del_pollset(grpc_pollset_set* pss, grpc_pollset* ps) { + GPR_TIMER_SCOPE("pollset_set_del_pollset", 0); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, "PSS:%p: del pollset %p", pss, ps); } @@ -1241,6 +1273,7 @@ static grpc_error* add_fds_to_pollsets(grpc_fd** fds, size_t fd_count, size_t pollset_count, const char* err_desc, grpc_fd** out_fds, size_t* out_fd_count) { + GPR_TIMER_SCOPE("add_fds_to_pollsets", 0); grpc_error* error = GRPC_ERROR_NONE; for (size_t i = 0; i < fd_count; i++) { gpr_mu_lock(&fds[i]->orphan_mu); @@ -1261,6 +1294,7 @@ static grpc_error* add_fds_to_pollsets(grpc_fd** fds, size_t fd_count, } static void pollset_set_add_pollset(grpc_pollset_set* pss, grpc_pollset* ps) { + GPR_TIMER_SCOPE("pollset_set_add_pollset", 0); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, "PSS:%p: add pollset %p", pss, ps); } @@ -1297,6 +1331,7 @@ static void pollset_set_add_pollset(grpc_pollset_set* pss, grpc_pollset* ps) { static void pollset_set_add_pollset_set(grpc_pollset_set* a, grpc_pollset_set* b) { + GPR_TIMER_SCOPE("pollset_set_add_pollset_set", 0); if (grpc_polling_trace.enabled()) { gpr_log(GPR_DEBUG, "PSS: merge (%p, %p)", a, b); } @@ -1417,10 +1452,6 @@ static const grpc_event_engine_vtable vtable = { const grpc_event_engine_vtable* grpc_init_epollex_linux( bool explicitly_requested) { - if (!explicitly_requested) { - return nullptr; - } - if (!grpc_has_wakeup_fd()) { gpr_log(GPR_ERROR, "Skipping epollex because of no wakeup fd."); return nullptr; diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc index 80ad9ebed2..416447f3da 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.cc +++ b/src/core/lib/iomgr/ev_epollsig_linux.cc @@ -1024,7 +1024,7 @@ static void push_front_worker(grpc_pollset* p, grpc_pollset_worker* worker) { /* p->mu must be held before calling this function */ static grpc_error* pollset_kick(grpc_pollset* p, grpc_pollset_worker* specific_worker) { - GPR_TIMER_BEGIN("pollset_kick", 0); + GPR_TIMER_SCOPE("pollset_kick", 0); grpc_error* error = GRPC_ERROR_NONE; GRPC_STATS_INC_POLLSET_KICK(); const char* err_desc = "Kick Failure"; @@ -1032,14 +1032,13 @@ static grpc_error* pollset_kick(grpc_pollset* p, if (worker != nullptr) { if (worker == GRPC_POLLSET_KICK_BROADCAST) { if (pollset_has_workers(p)) { - GPR_TIMER_BEGIN("pollset_kick.broadcast", 0); + GPR_TIMER_SCOPE("pollset_kick.broadcast", 0); for (worker = p->root_worker.next; worker != &p->root_worker; worker = worker->next) { if (gpr_tls_get(&g_current_thread_worker) != (intptr_t)worker) { append_error(&error, pollset_worker_kick(worker), err_desc); } } - GPR_TIMER_END("pollset_kick.broadcast", 0); } else { p->kicked_without_pollers = true; } @@ -1069,7 +1068,6 @@ static grpc_error* pollset_kick(grpc_pollset* p, } } - GPR_TIMER_END("pollset_kick", 0); GRPC_LOG_IF_ERROR("pollset_kick", GRPC_ERROR_REF(error)); return error; } @@ -1136,7 +1134,7 @@ static void finish_shutdown_locked(grpc_pollset* pollset) { /* pollset->po.mu lock must be held by the caller before calling this */ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { - GPR_TIMER_BEGIN("pollset_shutdown", 0); + GPR_TIMER_SCOPE("pollset_shutdown", 0); GPR_ASSERT(!pollset->shutting_down); pollset->shutting_down = true; pollset->shutdown_done = closure; @@ -1150,7 +1148,6 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { GPR_TIMER_MARK("pollset_shutdown.finish_shutdown_locked", 0); finish_shutdown_locked(pollset); } - GPR_TIMER_END("pollset_shutdown", 0); } /* pollset_shutdown is guaranteed to be called before pollset_destroy. So other @@ -1166,13 +1163,13 @@ static void pollset_destroy(grpc_pollset* pollset) { static void pollset_work_and_unlock(grpc_pollset* pollset, grpc_pollset_worker* worker, int timeout_ms, sigset_t* sig_mask, grpc_error** error) { + GPR_TIMER_SCOPE("pollset_work_and_unlock", 0); struct epoll_event ep_ev[GRPC_EPOLL_MAX_EVENTS]; int epoll_fd = -1; int ep_rv; polling_island* pi = nullptr; char* err_msg; const char* err_desc = "pollset_work_and_unlock"; - GPR_TIMER_BEGIN("pollset_work_and_unlock", 0); /* We need to get the epoll_fd to wait on. The epoll_fd is in inside the latest polling island pointed by pollset->po.pi @@ -1187,7 +1184,6 @@ static void pollset_work_and_unlock(grpc_pollset* pollset, if (pollset->po.pi == nullptr) { pollset->po.pi = polling_island_create(nullptr, error); if (pollset->po.pi == nullptr) { - GPR_TIMER_END("pollset_work_and_unlock", 0); return; /* Fatal error. We cannot continue */ } @@ -1279,8 +1275,6 @@ static void pollset_work_and_unlock(grpc_pollset* pollset, pollset->po.pi pointer might get udpated in other parts of the code when there is an island merge while we are doing epoll_wait() above */ PI_UNREF(pi, "ps_work"); - - GPR_TIMER_END("pollset_work_and_unlock", 0); } /* pollset->po.mu lock must be held by the caller before calling this. @@ -1290,7 +1284,7 @@ static void pollset_work_and_unlock(grpc_pollset* pollset, static grpc_error* pollset_work(grpc_pollset* pollset, grpc_pollset_worker** worker_hdl, grpc_millis deadline) { - GPR_TIMER_BEGIN("pollset_work", 0); + GPR_TIMER_SCOPE("pollset_work", 0); grpc_error* error = GRPC_ERROR_NONE; int timeout_ms = poll_deadline_to_millis_timeout(deadline); @@ -1384,15 +1378,13 @@ static grpc_error* pollset_work(grpc_pollset* pollset, gpr_tls_set(&g_current_thread_pollset, (intptr_t)0); gpr_tls_set(&g_current_thread_worker, (intptr_t)0); - GPR_TIMER_END("pollset_work", 0); - GRPC_LOG_IF_ERROR("pollset_work", GRPC_ERROR_REF(error)); return error; } static void add_poll_object(poll_obj* bag, poll_obj_type bag_type, poll_obj* item, poll_obj_type item_type) { - GPR_TIMER_BEGIN("add_poll_object", 0); + GPR_TIMER_SCOPE("add_poll_object", 0); #ifndef NDEBUG GPR_ASSERT(item->obj_type == item_type); @@ -1535,7 +1527,6 @@ retry: gpr_mu_unlock(&bag->mu); GRPC_LOG_IF_ERROR("add_poll_object", error); - GPR_TIMER_END("add_poll_object", 0); } static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) { diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index cad417892f..5284fb4104 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -457,16 +457,20 @@ static grpc_error* fd_shutdown_error(grpc_fd* fd) { if (!fd->shutdown) { return GRPC_ERROR_NONE; } else { - return GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "FD shutdown", &fd->shutdown_error, 1); + return grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "FD shutdown", &fd->shutdown_error, 1), + GRPC_ERROR_INT_GRPC_STATUS, + GRPC_STATUS_UNAVAILABLE); } } static void notify_on_locked(grpc_fd* fd, grpc_closure** st, grpc_closure* closure) { if (fd->shutdown || gpr_atm_no_barrier_load(&fd->pollhup)) { - GRPC_CLOSURE_SCHED(closure, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("FD shutdown")); + GRPC_CLOSURE_SCHED( + closure, grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("FD shutdown"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); } else if (*st == CLOSURE_NOT_READY) { /* not ready ==> switch to a waiting state by setting the closure */ *st = closure; @@ -706,14 +710,14 @@ static void kick_append_error(grpc_error** composite, grpc_error* error) { static grpc_error* pollset_kick_ext(grpc_pollset* p, grpc_pollset_worker* specific_worker, uint32_t flags) { - GPR_TIMER_BEGIN("pollset_kick_ext", 0); + GPR_TIMER_SCOPE("pollset_kick_ext", 0); grpc_error* error = GRPC_ERROR_NONE; GRPC_STATS_INC_POLLSET_KICK(); /* pollset->mu already held */ if (specific_worker != nullptr) { if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) { - GPR_TIMER_BEGIN("pollset_kick_ext.broadcast", 0); + GPR_TIMER_SCOPE("pollset_kick_ext.broadcast", 0); GPR_ASSERT((flags & GRPC_POLLSET_REEVALUATE_POLLING_ON_WAKEUP) == 0); for (specific_worker = p->root_worker.next; specific_worker != &p->root_worker; @@ -722,7 +726,6 @@ static grpc_error* pollset_kick_ext(grpc_pollset* p, &error, grpc_wakeup_fd_wakeup(&specific_worker->wakeup_fd->fd)); } p->kicked_without_pollers = true; - GPR_TIMER_END("pollset_kick_ext.broadcast", 0); } else if (gpr_tls_get(&g_current_thread_worker) != (intptr_t)specific_worker) { GPR_TIMER_MARK("different_thread_worker", 0); @@ -769,7 +772,6 @@ static grpc_error* pollset_kick_ext(grpc_pollset* p, } } - GPR_TIMER_END("pollset_kick_ext", 0); GRPC_LOG_IF_ERROR("pollset_kick_ext", GRPC_ERROR_REF(error)); return error; } @@ -864,6 +866,8 @@ static void work_combine_error(grpc_error** composite, grpc_error* error) { static grpc_error* pollset_work(grpc_pollset* pollset, grpc_pollset_worker** worker_hdl, grpc_millis deadline) { + GPR_TIMER_SCOPE("pollset_work", 0); + grpc_pollset_worker worker; if (worker_hdl) *worker_hdl = &worker; grpc_error* error = GRPC_ERROR_NONE; @@ -878,7 +882,6 @@ static grpc_error* pollset_work(grpc_pollset* pollset, int locked = 1; int queued_work = 0; int keep_polling = 0; - GPR_TIMER_BEGIN("pollset_work", 0); /* this must happen before we (potentially) drop pollset->mu */ worker.next = worker.prev = nullptr; worker.reevaluate_polling_on_wakeup = 0; @@ -921,7 +924,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, added_worker = 1; gpr_tls_set(&g_current_thread_worker, (intptr_t)&worker); } - GPR_TIMER_BEGIN("maybe_work_and_unlock", 0); + GPR_TIMER_SCOPE("maybe_work_and_unlock", 0); #define POLLOUT_CHECK (POLLOUT | POLLHUP | POLLERR) #define POLLIN_CHECK (POLLIN | POLLHUP | POLLERR) @@ -1037,7 +1040,6 @@ static grpc_error* pollset_work(grpc_pollset* pollset, gpr_free(pfds); } - GPR_TIMER_END("maybe_work_and_unlock", 0); locked = 0; } else { GPR_TIMER_MARK("pollset_work.kicked_without_pollers", 0); @@ -1097,7 +1099,6 @@ static grpc_error* pollset_work(grpc_pollset* pollset, } } if (worker_hdl) *worker_hdl = nullptr; - GPR_TIMER_END("pollset_work", 0); GRPC_LOG_IF_ERROR("pollset_work", GRPC_ERROR_REF(error)); return error; } diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index 3a5714132d..8100bece8f 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -39,6 +39,18 @@ grpc_core::TraceFlag grpc_polling_trace(false, "polling"); /* Disabled by default */ grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount(false, "fd_refcount"); +grpc_core::DebugOnlyTraceFlag grpc_polling_api_trace(false, "polling_api"); + +#ifndef NDEBUG + +// Polling API trace only enabled in debug builds +#define GRPC_POLLING_API_TRACE(format, ...) \ + if (grpc_polling_api_trace.enabled()) { \ + gpr_log(GPR_DEBUG, "(polling-api) " format, __VA_ARGS__); \ + } +#else +#define GRPC_POLLING_API_TRACE(...) +#endif /** Default poll() function - a pointer so that it can be overridden by some * tests */ @@ -177,6 +189,7 @@ void grpc_event_engine_shutdown(void) { } grpc_fd* grpc_fd_create(int fd, const char* name) { + GRPC_POLLING_API_TRACE("fd_create(%d, %s)", fd, name); return g_event_engine->fd_create(fd, name); } @@ -186,10 +199,14 @@ int grpc_fd_wrapped_fd(grpc_fd* fd) { void grpc_fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd, bool already_closed, const char* reason) { + GRPC_POLLING_API_TRACE("fd_orphan(%d, %p, %p, %d, %s)", + grpc_fd_wrapped_fd(fd), on_done, release_fd, + already_closed, reason); g_event_engine->fd_orphan(fd, on_done, release_fd, already_closed, reason); } void grpc_fd_shutdown(grpc_fd* fd, grpc_error* why) { + GRPC_POLLING_API_TRACE("fd_shutdown(%d)", grpc_fd_wrapped_fd(fd)); g_event_engine->fd_shutdown(fd, why); } @@ -208,65 +225,89 @@ void grpc_fd_notify_on_write(grpc_fd* fd, grpc_closure* closure) { size_t grpc_pollset_size(void) { return g_event_engine->pollset_size; } void grpc_pollset_init(grpc_pollset* pollset, gpr_mu** mu) { + GRPC_POLLING_API_TRACE("pollset_init(%p)", pollset); g_event_engine->pollset_init(pollset, mu); } void grpc_pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { + GRPC_POLLING_API_TRACE("pollset_shutdown(%p)", pollset); g_event_engine->pollset_shutdown(pollset, closure); } void grpc_pollset_destroy(grpc_pollset* pollset) { + GRPC_POLLING_API_TRACE("pollset_destroy(%p)", pollset); g_event_engine->pollset_destroy(pollset); } grpc_error* grpc_pollset_work(grpc_pollset* pollset, grpc_pollset_worker** worker, grpc_millis deadline) { - return g_event_engine->pollset_work(pollset, worker, deadline); + GRPC_POLLING_API_TRACE("pollset_work(%p, %" PRIdPTR ") begin", pollset, + deadline); + grpc_error* err = g_event_engine->pollset_work(pollset, worker, deadline); + GRPC_POLLING_API_TRACE("pollset_work(%p, %" PRIdPTR ") end", pollset, + deadline); + return err; } grpc_error* grpc_pollset_kick(grpc_pollset* pollset, grpc_pollset_worker* specific_worker) { + GRPC_POLLING_API_TRACE("pollset_kick(%p, %p)", pollset, specific_worker); return g_event_engine->pollset_kick(pollset, specific_worker); } void grpc_pollset_add_fd(grpc_pollset* pollset, struct grpc_fd* fd) { + GRPC_POLLING_API_TRACE("pollset_add_fd(%p, %d)", pollset, + grpc_fd_wrapped_fd(fd)); g_event_engine->pollset_add_fd(pollset, fd); } grpc_pollset_set* grpc_pollset_set_create(void) { - return g_event_engine->pollset_set_create(); + grpc_pollset_set* pss = g_event_engine->pollset_set_create(); + GRPC_POLLING_API_TRACE("pollset_set_create(%p)", pss); + return pss; } void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) { + GRPC_POLLING_API_TRACE("pollset_set_destroy(%p)", pollset_set); g_event_engine->pollset_set_destroy(pollset_set); } void grpc_pollset_set_add_pollset(grpc_pollset_set* pollset_set, grpc_pollset* pollset) { + GRPC_POLLING_API_TRACE("pollset_set_add_pollset(%p, %p)", pollset_set, + pollset); g_event_engine->pollset_set_add_pollset(pollset_set, pollset); } void grpc_pollset_set_del_pollset(grpc_pollset_set* pollset_set, grpc_pollset* pollset) { + GRPC_POLLING_API_TRACE("pollset_set_del_pollset(%p, %p)", pollset_set, + pollset); g_event_engine->pollset_set_del_pollset(pollset_set, pollset); } void grpc_pollset_set_add_pollset_set(grpc_pollset_set* bag, grpc_pollset_set* item) { + GRPC_POLLING_API_TRACE("pollset_set_add_pollset_set(%p, %p)", bag, item); g_event_engine->pollset_set_add_pollset_set(bag, item); } void grpc_pollset_set_del_pollset_set(grpc_pollset_set* bag, grpc_pollset_set* item) { + GRPC_POLLING_API_TRACE("pollset_set_del_pollset_set(%p, %p)", bag, item); g_event_engine->pollset_set_del_pollset_set(bag, item); } void grpc_pollset_set_add_fd(grpc_pollset_set* pollset_set, grpc_fd* fd) { + GRPC_POLLING_API_TRACE("pollset_set_add_fd(%p, %d)", pollset_set, + grpc_fd_wrapped_fd(fd)); g_event_engine->pollset_set_add_fd(pollset_set, fd); } void grpc_pollset_set_del_fd(grpc_pollset_set* pollset_set, grpc_fd* fd) { + GRPC_POLLING_API_TRACE("pollset_set_del_fd(%p, %d)", pollset_set, + grpc_fd_wrapped_fd(fd)); g_event_engine->pollset_set_del_fd(pollset_set, fd); } diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index e005437e0a..03c833ff07 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -113,7 +113,7 @@ void ExecCtx::GlobalInit(void) { bool ExecCtx::Flush() { bool did_something = 0; - GPR_TIMER_BEGIN("grpc_exec_ctx_flush", 0); + GPR_TIMER_SCOPE("grpc_exec_ctx_flush", 0); for (;;) { if (!grpc_closure_list_empty(closure_list_)) { grpc_closure* c = closure_list_.head; @@ -130,7 +130,6 @@ bool ExecCtx::Flush() { } } GPR_ASSERT(combiner_data_.active_combiner == nullptr); - GPR_TIMER_END("grpc_exec_ctx_flush", 0); return did_something; } diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc index 176caee490..7ed2862903 100644 --- a/src/core/lib/iomgr/resolve_address_posix.cc +++ b/src/core/lib/iomgr/resolve_address_posix.cc @@ -27,12 +27,13 @@ #include <sys/types.h> #include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> + +#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/executor.h" diff --git a/src/core/lib/iomgr/resolve_address_uv.cc b/src/core/lib/iomgr/resolve_address_uv.cc index 3eab04f3de..7252555bd0 100644 --- a/src/core/lib/iomgr/resolve_address_uv.cc +++ b/src/core/lib/iomgr/resolve_address_uv.cc @@ -22,11 +22,11 @@ #include <uv.h> #include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/useful.h> +#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/core/lib/iomgr/resolve_address_windows.cc b/src/core/lib/iomgr/resolve_address_windows.cc index e44ab396b3..e875d77fd8 100644 --- a/src/core/lib/iomgr/resolve_address_windows.cc +++ b/src/core/lib/iomgr/resolve_address_windows.cc @@ -28,12 +28,13 @@ #include <sys/types.h> #include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/log_windows.h> #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> + +#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/executor.h" diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc index 71e3e38624..ac97af4dee 100644 --- a/src/core/lib/iomgr/sockaddr_utils.cc +++ b/src/core/lib/iomgr/sockaddr_utils.cc @@ -23,11 +23,11 @@ #include <string.h> #include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/string_util.h> +#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils.h" diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc index 5068a8081d..d02d77eb02 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.cc +++ b/src/core/lib/iomgr/socket_utils_common_posix.cc @@ -36,10 +36,11 @@ #include <unistd.h> #include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/sync.h> + +#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/sockaddr_utils.h" diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 0ec5926227..07aed2d1fd 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -130,7 +130,7 @@ static void run_poller(void* bp, grpc_error* error_ignored) { gpr_log(GPR_DEBUG, "BACKUP_POLLER:%p run", p); } gpr_mu_lock(p->pollset_mu); - grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 13 * GPR_MS_PER_SEC; + grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 10 * GPR_MS_PER_SEC; GRPC_STATS_INC_TCP_BACKUP_POLLER_POLLS(); GRPC_LOG_IF_ERROR( "backup_poller:pollset_work", @@ -368,6 +368,7 @@ static void call_read_cb(grpc_tcp* tcp, grpc_error* error) { #define MAX_READ_IOVEC 4 static void tcp_do_read(grpc_tcp* tcp) { + GPR_TIMER_SCOPE("tcp_continue_read", 0); struct msghdr msg; struct iovec iov[MAX_READ_IOVEC]; ssize_t read_bytes; @@ -375,7 +376,6 @@ static void tcp_do_read(grpc_tcp* tcp) { GPR_ASSERT(!tcp->finished_edge); GPR_ASSERT(tcp->incoming_buffer->count <= MAX_READ_IOVEC); - GPR_TIMER_BEGIN("tcp_continue_read", 0); for (i = 0; i < tcp->incoming_buffer->count; i++) { iov[i].iov_base = GRPC_SLICE_START_PTR(tcp->incoming_buffer->slices[i]); @@ -393,12 +393,11 @@ static void tcp_do_read(grpc_tcp* tcp) { GRPC_STATS_INC_TCP_READ_OFFER(tcp->incoming_buffer->length); GRPC_STATS_INC_TCP_READ_OFFER_IOV_SIZE(tcp->incoming_buffer->count); - GPR_TIMER_BEGIN("recvmsg", 0); do { + GPR_TIMER_SCOPE("recvmsg", 0); GRPC_STATS_INC_SYSCALL_READ(); read_bytes = recvmsg(tcp->fd, &msg, 0); } while (read_bytes < 0 && errno == EINTR); - GPR_TIMER_END("recvmsg", read_bytes >= 0); if (read_bytes < 0) { /* NB: After calling call_read_cb a parallel call of the read handler may @@ -434,8 +433,6 @@ static void tcp_do_read(grpc_tcp* tcp) { call_read_cb(tcp, GRPC_ERROR_NONE); TCP_UNREF(tcp, "read"); } - - GPR_TIMER_END("tcp_continue_read", 0); } static void tcp_read_allocation_done(void* tcpp, grpc_error* error) { @@ -552,13 +549,12 @@ static bool tcp_flush(grpc_tcp* tcp, grpc_error** error) { GRPC_STATS_INC_TCP_WRITE_SIZE(sending_length); GRPC_STATS_INC_TCP_WRITE_IOV_SIZE(iov_size); - GPR_TIMER_BEGIN("sendmsg", 1); + GPR_TIMER_SCOPE("sendmsg", 1); do { /* TODO(klempner): Cork if this is a partial write */ GRPC_STATS_INC_SYSCALL_WRITE(); sent_length = sendmsg(tcp->fd, &msg, SENDMSG_FLAGS); } while (sent_length < 0 && errno == EINTR); - GPR_TIMER_END("sendmsg", 0); if (sent_length < 0) { if (errno == EAGAIN) { @@ -637,6 +633,7 @@ static void tcp_handle_write(void* arg /* grpc_tcp */, grpc_error* error) { static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf, grpc_closure* cb) { + GPR_TIMER_SCOPE("tcp_write", 0); grpc_tcp* tcp = (grpc_tcp*)ep; grpc_error* error = GRPC_ERROR_NONE; @@ -651,11 +648,9 @@ static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf, } } - GPR_TIMER_BEGIN("tcp_write", 0); GPR_ASSERT(tcp->write_cb == nullptr); if (buf->length == 0) { - GPR_TIMER_END("tcp_write", 0); GRPC_CLOSURE_SCHED( cb, grpc_fd_is_shutdown(tcp->em_fd) ? tcp_annotate_error( @@ -680,8 +675,6 @@ static void tcp_write(grpc_endpoint* ep, grpc_slice_buffer* buf, } GRPC_CLOSURE_SCHED(cb, error); } - - GPR_TIMER_END("tcp_write", 0); } static void tcp_add_to_pollset(grpc_endpoint* ep, grpc_pollset* pollset) { diff --git a/src/core/lib/iomgr/wakeup_fd_eventfd.cc b/src/core/lib/iomgr/wakeup_fd_eventfd.cc index 81cb7ee280..421ac55b00 100644 --- a/src/core/lib/iomgr/wakeup_fd_eventfd.cc +++ b/src/core/lib/iomgr/wakeup_fd_eventfd.cc @@ -52,15 +52,14 @@ static grpc_error* eventfd_consume(grpc_wakeup_fd* fd_info) { } static grpc_error* eventfd_wakeup(grpc_wakeup_fd* fd_info) { + GPR_TIMER_SCOPE("eventfd_wakeup", 0); int err; - GPR_TIMER_BEGIN("eventfd_wakeup", 0); do { err = eventfd_write(fd_info->read_fd, 1); } while (err < 0 && errno == EINTR); if (err < 0) { return GRPC_OS_ERROR(errno, "eventfd_write"); } - GPR_TIMER_END("eventfd_wakeup", 0); return GRPC_ERROR_NONE; } diff --git a/src/core/lib/profiling/timers.h b/src/core/lib/profiling/timers.h index 9f11f771e6..d0188b5054 100644 --- a/src/core/lib/profiling/timers.h +++ b/src/core/lib/profiling/timers.h @@ -40,14 +40,10 @@ void gpr_timer_set_enabled(int enabled); do { \ } while (0) -#define GPR_TIMER_BEGIN(tag, important) \ +#define GPR_TIMER_SCOPE(tag, important) \ do { \ } while (0) -#define GPR_TIMER_END(tag, important) \ - do { \ - } while (0) - #else /* at least one profiler requested... */ /* ... hopefully only one. */ #if defined(GRPC_STAP_PROFILER) && defined(GRPC_BASIC_PROFILER) @@ -64,12 +60,6 @@ void gpr_timer_set_enabled(int enabled); #define GPR_TIMER_MARK(tag, important) \ gpr_timer_add_mark(tag, important, __FILE__, __LINE__); -#define GPR_TIMER_BEGIN(tag, important) \ - gpr_timer_begin(tag, important, __FILE__, __LINE__); - -#define GPR_TIMER_END(tag, important) \ - gpr_timer_end(tag, important, __FILE__, __LINE__); - #ifdef GRPC_STAP_PROFILER /* Empty placeholder for now. */ #endif /* GRPC_STAP_PROFILER */ @@ -78,10 +68,6 @@ void gpr_timer_set_enabled(int enabled); /* Empty placeholder for now. */ #endif /* GRPC_BASIC_PROFILER */ -#endif /* at least one profiler requested. */ - -#if (defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER) + \ - defined(GRPC_CUSTOM_PROFILER)) namespace grpc { class ProfileScope { public: @@ -99,10 +85,7 @@ class ProfileScope { #define GPR_TIMER_SCOPE(tag, important) \ ::grpc::ProfileScope _profile_scope_##__LINE__((tag), (important), __FILE__, \ __LINE__) -#else -#define GPR_TIMER_SCOPE(tag, important) \ - do { \ - } while (false) -#endif + +#endif /* at least one profiler requested. */ #endif /* GRPC_CORE_LIB_PROFILING_TIMERS_H */ diff --git a/src/core/lib/security/transport/client_auth_filter.cc b/src/core/lib/security/transport/client_auth_filter.cc index 045cb3e239..802503c868 100644 --- a/src/core/lib/security/transport/client_auth_filter.cc +++ b/src/core/lib/security/transport/client_auth_filter.cc @@ -118,6 +118,7 @@ static void on_credentials_metadata(void* arg, grpc_error* input_error) { grpc_transport_stream_op_batch_finish_with_failure(batch, error, calld->call_combiner); } + GRPC_CALL_STACK_UNREF(calld->owning_call, "get_request_metadata"); } void grpc_auth_metadata_context_build( @@ -208,7 +209,7 @@ static void send_security_metadata(grpc_call_element* elem, chand->auth_context, &calld->auth_md_context); GPR_ASSERT(calld->pollent != nullptr); - + GRPC_CALL_STACK_REF(calld->owning_call, "get_request_metadata"); GRPC_CLOSURE_INIT(&calld->async_result_closure, on_credentials_metadata, batch, grpc_schedule_on_exec_ctx); grpc_error* error = GRPC_ERROR_NONE; @@ -250,6 +251,7 @@ static void on_host_checked(void* arg, grpc_error* error) { calld->call_combiner); gpr_free(error_msg); } + GRPC_CALL_STACK_UNREF(calld->owning_call, "check_call_host"); } static void cancel_check_call_host(void* arg, grpc_error* error) { @@ -266,7 +268,7 @@ static void cancel_check_call_host(void* arg, grpc_error* error) { static void auth_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { - GPR_TIMER_BEGIN("auth_start_transport_stream_op_batch", 0); + GPR_TIMER_SCOPE("auth_start_transport_stream_op_batch", 0); /* grab pointers to our data from the call element */ call_data* calld = (call_data*)elem->call_data; @@ -312,6 +314,7 @@ static void auth_start_transport_stream_op_batch( } if (calld->have_host) { batch->handler_private.extra_arg = elem; + GRPC_CALL_STACK_REF(calld->owning_call, "check_call_host"); GRPC_CLOSURE_INIT(&calld->async_result_closure, on_host_checked, batch, grpc_schedule_on_exec_ctx); char* call_host = grpc_slice_to_c_string(calld->host); @@ -332,14 +335,12 @@ static void auth_start_transport_stream_op_batch( grpc_schedule_on_exec_ctx)); } gpr_free(call_host); - GPR_TIMER_END("auth_start_transport_stream_op_batch", 0); return; /* early exit */ } } /* pass control down the stack */ grpc_call_next_op(elem, batch); - GPR_TIMER_END("auth_start_transport_stream_op_batch", 0); } /* Constructor for call_data */ diff --git a/src/core/lib/security/transport/secure_endpoint.cc b/src/core/lib/security/transport/secure_endpoint.cc index bd8a6cd76a..9eaa299897 100644 --- a/src/core/lib/security/transport/secure_endpoint.cc +++ b/src/core/lib/security/transport/secure_endpoint.cc @@ -252,7 +252,7 @@ static void flush_write_staging_buffer(secure_endpoint* ep, uint8_t** cur, static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices, grpc_closure* cb) { - GPR_TIMER_BEGIN("secure_endpoint.endpoint_write", 0); + GPR_TIMER_SCOPE("secure_endpoint.endpoint_write", 0); unsigned i; tsi_result result = TSI_OK; @@ -336,12 +336,10 @@ static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices, GRPC_CLOSURE_SCHED( cb, grpc_set_tsi_error_result( GRPC_ERROR_CREATE_FROM_STATIC_STRING("Wrap failed"), result)); - GPR_TIMER_END("secure_endpoint.endpoint_write", 0); return; } grpc_endpoint_write(ep->wrapped_ep, &ep->output_buffer, cb); - GPR_TIMER_END("secure_endpoint.endpoint_write", 0); } static void endpoint_shutdown(grpc_endpoint* secure_ep, grpc_error* why) { diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc index 1d962f94b2..fd632bdbab 100644 --- a/src/core/lib/security/transport/security_connector.cc +++ b/src/core/lib/security/transport/security_connector.cc @@ -23,7 +23,6 @@ #include <grpc/slice_buffer.h> #include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> @@ -31,6 +30,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/handshaker.h" #include "src/core/lib/gpr/env.h" +#include "src/core/lib/gpr/host_port.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/context/security_context.h" diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc index fe1770b92c..cf471f30f8 100644 --- a/src/core/lib/slice/slice_intern.cc +++ b/src/core/lib/slice/slice_intern.cc @@ -122,13 +122,13 @@ static const grpc_slice_refcount_vtable interned_slice_sub_vtable = { grpc_slice_default_eq_impl, grpc_slice_default_hash_impl}; static void grow_shard(slice_shard* shard) { + GPR_TIMER_SCOPE("grow_strtab", 0); + size_t capacity = shard->capacity * 2; size_t i; interned_slice_refcount** strtab; interned_slice_refcount *s, *next; - GPR_TIMER_BEGIN("grow_strtab", 0); - strtab = (interned_slice_refcount**)gpr_zalloc( sizeof(interned_slice_refcount*) * capacity); @@ -140,12 +140,9 @@ static void grow_shard(slice_shard* shard) { strtab[idx] = s; } } - gpr_free(shard->strs); shard->strs = strtab; shard->capacity = capacity; - - GPR_TIMER_END("grow_strtab", 0); } static grpc_slice materialize(interned_slice_refcount* s) { @@ -200,9 +197,8 @@ bool grpc_slice_is_interned(grpc_slice slice) { } grpc_slice grpc_slice_intern(grpc_slice slice) { - GPR_TIMER_BEGIN("grpc_slice_intern", 0); + GPR_TIMER_SCOPE("grpc_slice_intern", 0); if (GRPC_IS_STATIC_METADATA_STRING(slice)) { - GPR_TIMER_END("grpc_slice_intern", 0); return slice; } @@ -212,7 +208,6 @@ grpc_slice grpc_slice_intern(grpc_slice slice) { static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)]; if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT && grpc_slice_eq(grpc_static_slice_table[ent.idx], slice)) { - GPR_TIMER_END("grpc_slice_intern", 0); return grpc_static_slice_table[ent.idx]; } } @@ -235,7 +230,6 @@ grpc_slice grpc_slice_intern(grpc_slice slice) { /* and treat this as if we were never here... sshhh */ } else { gpr_mu_unlock(&shard->mu); - GPR_TIMER_END("grpc_slice_intern", 0); return materialize(s); } } @@ -264,7 +258,6 @@ grpc_slice grpc_slice_intern(grpc_slice slice) { gpr_mu_unlock(&shard->mu); - GPR_TIMER_END("grpc_slice_intern", 0); return materialize(s); } diff --git a/src/core/lib/surface/alarm.cc b/src/core/lib/surface/alarm.cc deleted file mode 100644 index f6ea016c33..0000000000 --- a/src/core/lib/surface/alarm.cc +++ /dev/null @@ -1,137 +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 <inttypes.h> - -#include "src/core/lib/surface/alarm_internal.h" - -#include <grpc/grpc.h> -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include "src/core/lib/iomgr/timer.h" -#include "src/core/lib/surface/completion_queue.h" - -grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount(false, - "alarm_refcount"); - -struct grpc_alarm { - gpr_refcount refs; - grpc_timer alarm; - grpc_closure on_alarm; - grpc_cq_completion completion; - /** completion queue where events about this alarm will be posted */ - grpc_completion_queue* cq; - /** user supplied tag */ - void* tag; -}; - -static void alarm_ref(grpc_alarm* alarm) { gpr_ref(&alarm->refs); } - -static void alarm_unref(grpc_alarm* alarm) { - if (gpr_unref(&alarm->refs)) { - grpc_core::ExecCtx exec_ctx; - if (alarm->cq != nullptr) { - GRPC_CQ_INTERNAL_UNREF(alarm->cq, "alarm"); - } - - gpr_free(alarm); - } -} - -#ifndef NDEBUG -static void alarm_ref_dbg(grpc_alarm* alarm, const char* reason, - const char* file, int line) { - if (grpc_trace_alarm_refcount.enabled()) { - gpr_atm val = gpr_atm_no_barrier_load(&alarm->refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "Alarm:%p ref %" PRIdPTR " -> %" PRIdPTR " %s", alarm, val, - val + 1, reason); - } - - alarm_ref(alarm); -} - -static void alarm_unref_dbg(grpc_alarm* alarm, const char* reason, - const char* file, int line) { - if (grpc_trace_alarm_refcount.enabled()) { - gpr_atm val = gpr_atm_no_barrier_load(&alarm->refs.count); - gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "Alarm:%p Unref %" PRIdPTR " -> %" PRIdPTR " %s", alarm, val, - val - 1, reason); - } - - alarm_unref(alarm); -} -#endif - -static void alarm_end_completion(void* arg, grpc_cq_completion* c) { - grpc_alarm* alarm = (grpc_alarm*)arg; - GRPC_ALARM_UNREF(alarm, "dequeue-end-op"); -} - -static void alarm_cb(void* arg, grpc_error* error) { - grpc_alarm* alarm = (grpc_alarm*)arg; - - /* We are queuing an op on completion queue. This means, the alarm's structure - cannot be destroyed until the op is dequeued. Adding an extra ref - here and unref'ing when the op is dequeued will achieve this */ - GRPC_ALARM_REF(alarm, "queue-end-op"); - grpc_cq_end_op(alarm->cq, alarm->tag, error, alarm_end_completion, - (void*)alarm, &alarm->completion); -} - -grpc_alarm* grpc_alarm_create(void* reserved) { - grpc_alarm* alarm = (grpc_alarm*)gpr_malloc(sizeof(grpc_alarm)); - -#ifndef NDEBUG - if (grpc_trace_alarm_refcount.enabled()) { - gpr_log(GPR_DEBUG, "Alarm:%p created (ref: 1)", alarm); - } -#endif - - gpr_ref_init(&alarm->refs, 1); - grpc_timer_init_unset(&alarm->alarm); - alarm->cq = nullptr; - GRPC_CLOSURE_INIT(&alarm->on_alarm, alarm_cb, alarm, - grpc_schedule_on_exec_ctx); - return alarm; -} - -void grpc_alarm_set(grpc_alarm* alarm, grpc_completion_queue* cq, - gpr_timespec deadline, void* tag, void* reserved) { - grpc_core::ExecCtx exec_ctx; - - GRPC_CQ_INTERNAL_REF(cq, "alarm"); - alarm->cq = cq; - alarm->tag = tag; - - GPR_ASSERT(grpc_cq_begin_op(cq, tag)); - grpc_timer_init(&alarm->alarm, grpc_timespec_to_millis_round_up(deadline), - &alarm->on_alarm); -} - -void grpc_alarm_cancel(grpc_alarm* alarm, void* reserved) { - grpc_core::ExecCtx exec_ctx; - grpc_timer_cancel(&alarm->alarm); -} - -void grpc_alarm_destroy(grpc_alarm* alarm, void* reserved) { - grpc_alarm_cancel(alarm, reserved); - GRPC_ALARM_UNREF(alarm, "alarm_destroy"); -} diff --git a/src/core/lib/surface/alarm_internal.h b/src/core/lib/surface/alarm_internal.h deleted file mode 100644 index 99e981234d..0000000000 --- a/src/core/lib/surface/alarm_internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright 2015-2017 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_SURFACE_ALARM_INTERNAL_H -#define GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H - -#include <grpc/support/log.h> -#include "src/core/lib/debug/trace.h" - -extern grpc_core::DebugOnlyTraceFlag grpc_trace_alarm_refcount; - -#ifndef NDEBUG - -#define GRPC_ALARM_REF(a, reason) alarm_ref_dbg(a, reason, __FILE__, __LINE__) -#define GRPC_ALARM_UNREF(a, reason) \ - alarm_unref_dbg(a, reason, __FILE__, __LINE__) - -#else /* !defined(NDEBUG) */ - -#define GRPC_ALARM_REF(a, reason) alarm_ref(a) -#define GRPC_ALARM_UNREF(a, reason) alarm_unref(a) - -#endif /* defined(NDEBUG) */ - -#endif /* GRPC_CORE_LIB_SURFACE_ALARM_INTERNAL_H */ diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index ce63fa4d67..b538cc0212 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -321,12 +321,12 @@ static parent_call* get_parent_call(grpc_call* call) { grpc_error* grpc_call_create(const grpc_call_create_args* args, grpc_call** out_call) { + GPR_TIMER_SCOPE("grpc_call_create", 0); size_t i, j; grpc_error* error = GRPC_ERROR_NONE; grpc_channel_stack* channel_stack = grpc_channel_get_channel_stack(args->channel); grpc_call* call; - GPR_TIMER_BEGIN("grpc_call_create", 0); size_t initial_size = grpc_channel_get_call_size_estimate(args->channel); GRPC_STATS_INC_CALL_INITIAL_SIZE(initial_size); gpr_arena* arena = gpr_arena_create(initial_size); @@ -467,7 +467,6 @@ grpc_error* grpc_call_create(const grpc_call_create_args* args, grpc_slice_unref_internal(path); - GPR_TIMER_END("grpc_call_create", 0); return error; } @@ -511,10 +510,10 @@ static void release_call(void* call, grpc_error* error) { static void set_status_value_directly(grpc_status_code status, void* dest); static void destroy_call(void* call, grpc_error* error) { + GPR_TIMER_SCOPE("destroy_call", 0); size_t i; int ii; grpc_call* c = (grpc_call*)call; - GPR_TIMER_BEGIN("destroy_call", 0); for (i = 0; i < 2; i++) { grpc_metadata_batch_destroy( &c->metadata_batch[1 /* is_receiving */][i /* is_initial */]); @@ -551,7 +550,6 @@ static void destroy_call(void* call, grpc_error* error) { grpc_call_stack_destroy(CALL_STACK_FROM_CALL(c), &c->final_info, GRPC_CLOSURE_INIT(&c->release_call, release_call, c, grpc_schedule_on_exec_ctx)); - GPR_TIMER_END("destroy_call", 0); } void grpc_call_ref(grpc_call* c) { gpr_ref(&c->ext_ref); } @@ -559,10 +557,11 @@ void grpc_call_ref(grpc_call* c) { gpr_ref(&c->ext_ref); } void grpc_call_unref(grpc_call* c) { if (!gpr_unref(&c->ext_ref)) return; + GPR_TIMER_SCOPE("grpc_call_unref", 0); + child_call* cc = c->child; grpc_core::ExecCtx exec_ctx; - GPR_TIMER_BEGIN("grpc_call_unref", 0); GRPC_API_TRACE("grpc_call_unref(c=%p)", 1, (c)); if (cc) { @@ -594,8 +593,6 @@ void grpc_call_unref(grpc_call* c) { grpc_call_combiner_set_notify_on_cancel(&c->call_combiner, nullptr); } GRPC_CALL_INTERNAL_UNREF(c, "destroy"); - - GPR_TIMER_END("grpc_call_unref", 0); } grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved) { @@ -610,13 +607,12 @@ grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved) { // This is called via the call combiner to start sending a batch down // the filter stack. static void execute_batch_in_call_combiner(void* arg, grpc_error* ignored) { + GPR_TIMER_SCOPE("execute_batch", 0); grpc_transport_stream_op_batch* batch = (grpc_transport_stream_op_batch*)arg; grpc_call* call = (grpc_call*)batch->handler_private.extra_arg; - GPR_TIMER_BEGIN("execute_batch", 0); grpc_call_element* elem = CALL_ELEM_FROM_CALL(call, 0); GRPC_CALL_LOG_OP(GPR_INFO, elem, batch); elem->filter->start_transport_stream_op_batch(elem, batch); - GPR_TIMER_END("execute_batch", 0); } // start_batch_closure points to a caller-allocated closure to be used @@ -1036,7 +1032,8 @@ static grpc_stream_compression_algorithm decode_stream_compression( static void publish_app_metadata(grpc_call* call, grpc_metadata_batch* b, int is_trailing) { if (b->list.count == 0) return; - GPR_TIMER_BEGIN("publish_app_metadata", 0); + if (is_trailing && call->buffered_metadata[1] == nullptr) return; + GPR_TIMER_SCOPE("publish_app_metadata", 0); grpc_metadata_array* dest; grpc_metadata* mdusr; dest = call->buffered_metadata[is_trailing]; @@ -1052,39 +1049,34 @@ static void publish_app_metadata(grpc_call* call, grpc_metadata_batch* b, mdusr->key = GRPC_MDKEY(l->md); mdusr->value = GRPC_MDVALUE(l->md); } - GPR_TIMER_END("publish_app_metadata", 0); } static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) { if (b->idx.named.content_encoding != nullptr) { - GPR_TIMER_BEGIN("incoming_stream_compression_algorithm", 0); + GPR_TIMER_SCOPE("incoming_stream_compression_algorithm", 0); set_incoming_stream_compression_algorithm( call, decode_stream_compression(b->idx.named.content_encoding->md)); - GPR_TIMER_END("incoming_stream_compression_algorithm", 0); grpc_metadata_batch_remove(b, b->idx.named.content_encoding); } if (b->idx.named.grpc_encoding != nullptr) { - GPR_TIMER_BEGIN("incoming_message_compression_algorithm", 0); + GPR_TIMER_SCOPE("incoming_message_compression_algorithm", 0); set_incoming_message_compression_algorithm( call, decode_message_compression(b->idx.named.grpc_encoding->md)); - GPR_TIMER_END("incoming_message_compression_algorithm", 0); grpc_metadata_batch_remove(b, b->idx.named.grpc_encoding); } uint32_t message_encodings_accepted_by_peer = 1u; uint32_t stream_encodings_accepted_by_peer = 1u; if (b->idx.named.grpc_accept_encoding != nullptr) { - GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0); + GPR_TIMER_SCOPE("encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(call, b->idx.named.grpc_accept_encoding->md, &message_encodings_accepted_by_peer, false); grpc_metadata_batch_remove(b, b->idx.named.grpc_accept_encoding); - GPR_TIMER_END("encodings_accepted_by_peer", 0); } if (b->idx.named.accept_encoding != nullptr) { - GPR_TIMER_BEGIN("stream_encodings_accepted_by_peer", 0); + GPR_TIMER_SCOPE("stream_encodings_accepted_by_peer", 0); set_encodings_accepted_by_peer(call, b->idx.named.accept_encoding->md, &stream_encodings_accepted_by_peer, true); grpc_metadata_batch_remove(b, b->idx.named.accept_encoding); - GPR_TIMER_END("stream_encodings_accepted_by_peer", 0); } call->encodings_accepted_by_peer = grpc_compression_bitset_from_message_stream_compression_bitset( @@ -1523,9 +1515,8 @@ static void receiving_initial_metadata_ready(void* bctlp, grpc_error* error) { recv_initial_filter(call, md); /* TODO(ctiller): this could be moved into recv_initial_filter now */ - GPR_TIMER_BEGIN("validate_filtered_metadata", 0); + GPR_TIMER_SCOPE("validate_filtered_metadata", 0); validate_filtered_metadata(bctl); - GPR_TIMER_END("validate_filtered_metadata", 0); if (md->deadline != GRPC_MILLIS_INF_FUTURE && !call->is_client) { call->send_deadline = md->deadline; @@ -1578,6 +1569,8 @@ static void free_no_op_completion(void* p, grpc_cq_completion* completion) { static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops, size_t nops, void* notify_tag, int is_notify_tag_closure) { + GPR_TIMER_SCOPE("grpc_call_start_batch", 0); + size_t i; const grpc_op* op; batch_control* bctl; @@ -1586,7 +1579,6 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops, grpc_transport_stream_op_batch* stream_op; grpc_transport_stream_op_batch_payload* stream_op_payload; - GPR_TIMER_BEGIN("grpc_call_start_batch", 0); GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag); if (nops == 0) { @@ -1923,7 +1915,6 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops, execute_batch(call, stream_op, &bctl->start_batch); done: - GPR_TIMER_END("grpc_call_start_batch", 0); return error; done_with_error: diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index 27f67054e4..a2c52082c2 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -421,9 +421,9 @@ static long cq_event_queue_num_items(grpc_cq_event_queue* q) { grpc_completion_queue* grpc_completion_queue_create_internal( grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type) { - grpc_completion_queue* cq; + GPR_TIMER_SCOPE("grpc_completion_queue_create_internal", 0); - GPR_TIMER_BEGIN("grpc_completion_queue_create_internal", 0); + grpc_completion_queue* cq; GRPC_API_TRACE( "grpc_completion_queue_create_internal(completion_type=%d, " @@ -452,9 +452,6 @@ grpc_completion_queue* grpc_completion_queue_create_internal( GRPC_CLOSURE_INIT(&cq->pollset_shutdown_done, on_pollset_shutdown_done, cq, grpc_schedule_on_exec_ctx); - - GPR_TIMER_END("grpc_completion_queue_create_internal", 0); - return cq; } @@ -622,7 +619,7 @@ static void cq_end_op_for_next(grpc_completion_queue* cq, void* tag, void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, grpc_cq_completion* storage) { - GPR_TIMER_BEGIN("cq_end_op_for_next", 0); + GPR_TIMER_SCOPE("cq_end_op_for_next", 0); if (grpc_api_trace.enabled() || (grpc_trace_operation_failures.enabled() && error != GRPC_ERROR_NONE)) { @@ -691,8 +688,6 @@ static void cq_end_op_for_next(grpc_completion_queue* cq, void* tag, } } - GPR_TIMER_END("cq_end_op_for_next", 0); - GRPC_ERROR_UNREF(error); } @@ -704,11 +699,11 @@ static void cq_end_op_for_pluck(grpc_completion_queue* cq, void* tag, void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, grpc_cq_completion* storage) { + GPR_TIMER_SCOPE("cq_end_op_for_pluck", 0); + cq_pluck_data* cqd = (cq_pluck_data*)DATA_FROM_CQ(cq); int is_success = (error == GRPC_ERROR_NONE); - GPR_TIMER_BEGIN("cq_end_op_for_pluck", 0); - if (grpc_api_trace.enabled() || (grpc_trace_operation_failures.enabled() && error != GRPC_ERROR_NONE)) { const char* errmsg = grpc_error_string(error); @@ -760,8 +755,6 @@ static void cq_end_op_for_pluck(grpc_completion_queue* cq, void* tag, } } - GPR_TIMER_END("cq_end_op_for_pluck", 0); - GRPC_ERROR_UNREF(error); } @@ -840,11 +833,11 @@ static void dump_pending_tags(grpc_completion_queue* cq) {} static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline, void* reserved) { + GPR_TIMER_SCOPE("grpc_completion_queue_next", 0); + grpc_event ret; cq_next_data* cqd = (cq_next_data*)DATA_FROM_CQ(cq); - GPR_TIMER_BEGIN("grpc_completion_queue_next", 0); - GRPC_API_TRACE( "grpc_completion_queue_next(" "cq=%p, " @@ -958,8 +951,6 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline, GPR_ASSERT(is_finished_arg.stolen_completion == nullptr); - GPR_TIMER_END("grpc_completion_queue_next", 0); - return ret; } @@ -1078,14 +1069,14 @@ class ExecCtxPluck : public grpc_core::ExecCtx { static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag, gpr_timespec deadline, void* reserved) { + GPR_TIMER_SCOPE("grpc_completion_queue_pluck", 0); + grpc_event ret; grpc_cq_completion* c; grpc_cq_completion* prev; grpc_pollset_worker* worker = nullptr; cq_pluck_data* cqd = (cq_pluck_data*)DATA_FROM_CQ(cq); - GPR_TIMER_BEGIN("grpc_completion_queue_pluck", 0); - if (grpc_cq_pluck_trace.enabled()) { GRPC_API_TRACE( "grpc_completion_queue_pluck(" @@ -1191,8 +1182,6 @@ done: GPR_ASSERT(is_finished_arg.stolen_completion == nullptr); - GPR_TIMER_END("grpc_completion_queue_pluck", 0); - return ret; } @@ -1240,23 +1229,19 @@ static void cq_shutdown_pluck(grpc_completion_queue* cq) { /* Shutdown simply drops a ref that we reserved at creation time; if we drop to zero here, then enter shutdown mode and wake up any waiters */ void grpc_completion_queue_shutdown(grpc_completion_queue* cq) { + GPR_TIMER_SCOPE("grpc_completion_queue_shutdown", 0); grpc_core::ExecCtx exec_ctx; - GPR_TIMER_BEGIN("grpc_completion_queue_shutdown", 0); GRPC_API_TRACE("grpc_completion_queue_shutdown(cq=%p)", 1, (cq)); cq->vtable->shutdown(cq); - - GPR_TIMER_END("grpc_completion_queue_shutdown", 0); } void grpc_completion_queue_destroy(grpc_completion_queue* cq) { + GPR_TIMER_SCOPE("grpc_completion_queue_destroy", 0); GRPC_API_TRACE("grpc_completion_queue_destroy(cq=%p)", 1, (cq)); - GPR_TIMER_BEGIN("grpc_completion_queue_destroy", 0); grpc_completion_queue_shutdown(cq); grpc_core::ExecCtx exec_ctx; GRPC_CQ_INTERNAL_UNREF(cq, "destroy"); - - GPR_TIMER_END("grpc_completion_queue_destroy", 0); } grpc_pollset* grpc_cq_pollset(grpc_completion_queue* cq) { diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 70329b09f4..7f7947faaa 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -42,7 +42,6 @@ #include "src/core/lib/iomgr/timer_manager.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" -#include "src/core/lib/surface/alarm_internal.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel_init.h" @@ -162,9 +161,9 @@ void grpc_shutdown(void) { { grpc_core::ExecCtx exec_ctx(0); { - grpc_executor_shutdown(); grpc_timer_manager_set_threading( false); // shutdown timer_manager thread + grpc_executor_shutdown(); for (i = g_number_of_plugins; i >= 0; i--) { if (g_all_of_the_plugins[i].destroy != nullptr) { g_all_of_the_plugins[i].destroy(); diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index 19498a6df7..51daad0368 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -21,6 +21,6 @@ #include <grpc/grpc.h> -const char* grpc_version_string(void) { return "5.0.0-dev"; } +const char* grpc_version_string(void) { return "6.0.0-dev"; } const char* grpc_g_stands_for(void) { return "glamorous"; } diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index 652222bd0b..cc1edd586f 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -166,12 +166,13 @@ static void ref_md_locked(mdtab_shard* shard, } static void gc_mdtab(mdtab_shard* shard) { + GPR_TIMER_SCOPE("gc_mdtab", 0); + size_t i; interned_metadata** prev_next; interned_metadata *md, *next; gpr_atm num_freed = 0; - GPR_TIMER_BEGIN("gc_mdtab", 0); for (i = 0; i < shard->capacity; i++) { prev_next = &shard->elems[i]; for (md = shard->elems[i]; md; md = next) { @@ -194,18 +195,17 @@ static void gc_mdtab(mdtab_shard* shard) { } } gpr_atm_no_barrier_fetch_add(&shard->free_estimate, -num_freed); - GPR_TIMER_END("gc_mdtab", 0); } static void grow_mdtab(mdtab_shard* shard) { + GPR_TIMER_SCOPE("grow_mdtab", 0); + size_t capacity = shard->capacity * 2; size_t i; interned_metadata** mdtab; interned_metadata *md, *next; uint32_t hash; - GPR_TIMER_BEGIN("grow_mdtab", 0); - mdtab = (interned_metadata**)gpr_zalloc(sizeof(interned_metadata*) * capacity); @@ -220,12 +220,9 @@ static void grow_mdtab(mdtab_shard* shard) { mdtab[idx] = md; } } - gpr_free(shard->elems); shard->elems = mdtab; shard->capacity = capacity; - - GPR_TIMER_END("grow_mdtab", 0); } static void rehash_mdtab(mdtab_shard* shard) { @@ -280,7 +277,7 @@ grpc_mdelem grpc_mdelem_create( mdtab_shard* shard = &g_shards[SHARD_IDX(hash)]; size_t idx; - GPR_TIMER_BEGIN("grpc_mdelem_from_metadata_strings", 0); + GPR_TIMER_SCOPE("grpc_mdelem_from_metadata_strings", 0); gpr_mu_lock(&shard->mu); @@ -290,7 +287,6 @@ grpc_mdelem grpc_mdelem_create( if (grpc_slice_eq(key, md->key) && grpc_slice_eq(value, md->value)) { REF_MD_LOCKED(shard, md); gpr_mu_unlock(&shard->mu); - GPR_TIMER_END("grpc_mdelem_from_metadata_strings", 0); return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED); } } @@ -323,8 +319,6 @@ grpc_mdelem grpc_mdelem_create( gpr_mu_unlock(&shard->mu); - GPR_TIMER_END("grpc_mdelem_from_metadata_strings", 0); - return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED); } diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index 82ba7ac51a..ebc75724cf 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -20,7 +20,7 @@ * To make changes to this file, change * tools/codegen/core/gen_static_metadata.py, and then re-run it. * - * See metadata.h for an explanation of the interface here, and metadata.c for + * See metadata.h for an explanation of the interface here, and metadata.cc for * an explanation of what's going on. */ @@ -57,53 +57,52 @@ static uint8_t g_bytes[] = { 112, 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, - 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 109, 101, 115, 115, 97, - 103, 101, 47, 100, 101, 102, 108, 97, 116, 101, 109, 101, 115, 115, 97, - 103, 101, 47, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, - 122, 105, 112, 48, 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 103, - 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, 116, 114, 97, 105, 108, - 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, - 103, 114, 112, 99, 80, 79, 83, 84, 50, 48, 48, 52, 48, 52, 104, - 116, 116, 112, 104, 116, 116, 112, 115, 103, 114, 112, 99, 71, 69, 84, - 80, 85, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, 108, - 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 53, 48, 48, - 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 103, - 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, 99, - 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, 99, - 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, 112, - 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108, - 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103, - 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, 97, - 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, 114, - 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, 111, - 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 108, - 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, 45, - 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, 108, - 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, - 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, 101, - 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, 114, - 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, 105, - 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, - 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, - 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, - 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, - 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 98, 45, 99, 111, 115, - 116, 45, 98, 105, 110, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, - 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, - 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, - 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, - 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, - 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, - 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, - 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, - 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, - 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, - 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, - 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, 101, - 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, - 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, - 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, - 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; + 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 100, 101, 102, 108, 97, + 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, + 105, 112, 48, 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 116, 114, + 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, + 111, 110, 47, 103, 114, 112, 99, 80, 79, 83, 84, 50, 48, 48, 52, + 48, 52, 104, 116, 116, 112, 104, 116, 116, 112, 115, 103, 114, 112, 99, + 71, 69, 84, 80, 85, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, + 116, 109, 108, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, + 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, + 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, + 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, + 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, + 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, + 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, + 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, + 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, + 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, + 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, + 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, + 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, + 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, + 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, + 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, + 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, + 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, + 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, + 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, + 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, + 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 98, 45, + 99, 111, 115, 116, 45, 98, 105, 110, 108, 105, 110, 107, 108, 111, 99, + 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, + 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, + 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, + 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, + 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, + 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, + 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, + 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, + 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, + 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, + 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, + 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, + 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, + 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, + 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, + 105, 112}; static void static_ref(void* unused) {} static void static_unref(void* unused) {} @@ -216,8 +215,6 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, - {&grpc_static_metadata_vtable, &static_sub_refcnt}, - {&grpc_static_metadata_vtable, &static_sub_refcnt}, }; const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { @@ -250,80 +247,78 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { {&grpc_static_metadata_refcounts[26], {{g_bytes + 333, 30}}}, {&grpc_static_metadata_refcounts[27], {{g_bytes + 363, 31}}}, {&grpc_static_metadata_refcounts[28], {{g_bytes + 394, 36}}}, - {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 15}}}, - {&grpc_static_metadata_refcounts[30], {{g_bytes + 445, 12}}}, - {&grpc_static_metadata_refcounts[31], {{g_bytes + 457, 11}}}, - {&grpc_static_metadata_refcounts[32], {{g_bytes + 468, 1}}}, - {&grpc_static_metadata_refcounts[33], {{g_bytes + 469, 1}}}, - {&grpc_static_metadata_refcounts[34], {{g_bytes + 470, 1}}}, - {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}, - {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}, - {&grpc_static_metadata_refcounts[37], {{g_bytes + 483, 7}}}, - {&grpc_static_metadata_refcounts[38], {{g_bytes + 490, 8}}}, - {&grpc_static_metadata_refcounts[39], {{g_bytes + 498, 16}}}, - {&grpc_static_metadata_refcounts[40], {{g_bytes + 514, 4}}}, - {&grpc_static_metadata_refcounts[41], {{g_bytes + 518, 3}}}, - {&grpc_static_metadata_refcounts[42], {{g_bytes + 521, 3}}}, - {&grpc_static_metadata_refcounts[43], {{g_bytes + 524, 4}}}, - {&grpc_static_metadata_refcounts[44], {{g_bytes + 528, 5}}}, - {&grpc_static_metadata_refcounts[45], {{g_bytes + 533, 4}}}, - {&grpc_static_metadata_refcounts[46], {{g_bytes + 537, 3}}}, - {&grpc_static_metadata_refcounts[47], {{g_bytes + 540, 3}}}, - {&grpc_static_metadata_refcounts[48], {{g_bytes + 543, 1}}}, - {&grpc_static_metadata_refcounts[49], {{g_bytes + 544, 11}}}, - {&grpc_static_metadata_refcounts[50], {{g_bytes + 555, 3}}}, - {&grpc_static_metadata_refcounts[51], {{g_bytes + 558, 3}}}, - {&grpc_static_metadata_refcounts[52], {{g_bytes + 561, 3}}}, - {&grpc_static_metadata_refcounts[53], {{g_bytes + 564, 3}}}, - {&grpc_static_metadata_refcounts[54], {{g_bytes + 567, 3}}}, - {&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 14}}}, - {&grpc_static_metadata_refcounts[56], {{g_bytes + 584, 13}}}, - {&grpc_static_metadata_refcounts[57], {{g_bytes + 597, 15}}}, - {&grpc_static_metadata_refcounts[58], {{g_bytes + 612, 13}}}, - {&grpc_static_metadata_refcounts[59], {{g_bytes + 625, 6}}}, - {&grpc_static_metadata_refcounts[60], {{g_bytes + 631, 27}}}, - {&grpc_static_metadata_refcounts[61], {{g_bytes + 658, 3}}}, - {&grpc_static_metadata_refcounts[62], {{g_bytes + 661, 5}}}, - {&grpc_static_metadata_refcounts[63], {{g_bytes + 666, 13}}}, - {&grpc_static_metadata_refcounts[64], {{g_bytes + 679, 13}}}, - {&grpc_static_metadata_refcounts[65], {{g_bytes + 692, 19}}}, - {&grpc_static_metadata_refcounts[66], {{g_bytes + 711, 16}}}, - {&grpc_static_metadata_refcounts[67], {{g_bytes + 727, 14}}}, - {&grpc_static_metadata_refcounts[68], {{g_bytes + 741, 16}}}, - {&grpc_static_metadata_refcounts[69], {{g_bytes + 757, 13}}}, - {&grpc_static_metadata_refcounts[70], {{g_bytes + 770, 6}}}, - {&grpc_static_metadata_refcounts[71], {{g_bytes + 776, 4}}}, - {&grpc_static_metadata_refcounts[72], {{g_bytes + 780, 4}}}, - {&grpc_static_metadata_refcounts[73], {{g_bytes + 784, 6}}}, - {&grpc_static_metadata_refcounts[74], {{g_bytes + 790, 7}}}, - {&grpc_static_metadata_refcounts[75], {{g_bytes + 797, 4}}}, - {&grpc_static_metadata_refcounts[76], {{g_bytes + 801, 8}}}, - {&grpc_static_metadata_refcounts[77], {{g_bytes + 809, 17}}}, - {&grpc_static_metadata_refcounts[78], {{g_bytes + 826, 13}}}, - {&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 8}}}, - {&grpc_static_metadata_refcounts[80], {{g_bytes + 847, 19}}}, - {&grpc_static_metadata_refcounts[81], {{g_bytes + 866, 13}}}, - {&grpc_static_metadata_refcounts[82], {{g_bytes + 879, 11}}}, - {&grpc_static_metadata_refcounts[83], {{g_bytes + 890, 4}}}, - {&grpc_static_metadata_refcounts[84], {{g_bytes + 894, 8}}}, - {&grpc_static_metadata_refcounts[85], {{g_bytes + 902, 12}}}, - {&grpc_static_metadata_refcounts[86], {{g_bytes + 914, 18}}}, - {&grpc_static_metadata_refcounts[87], {{g_bytes + 932, 19}}}, - {&grpc_static_metadata_refcounts[88], {{g_bytes + 951, 5}}}, - {&grpc_static_metadata_refcounts[89], {{g_bytes + 956, 7}}}, - {&grpc_static_metadata_refcounts[90], {{g_bytes + 963, 7}}}, - {&grpc_static_metadata_refcounts[91], {{g_bytes + 970, 11}}}, - {&grpc_static_metadata_refcounts[92], {{g_bytes + 981, 6}}}, - {&grpc_static_metadata_refcounts[93], {{g_bytes + 987, 10}}}, - {&grpc_static_metadata_refcounts[94], {{g_bytes + 997, 25}}}, - {&grpc_static_metadata_refcounts[95], {{g_bytes + 1022, 17}}}, - {&grpc_static_metadata_refcounts[96], {{g_bytes + 1039, 4}}}, - {&grpc_static_metadata_refcounts[97], {{g_bytes + 1043, 3}}}, - {&grpc_static_metadata_refcounts[98], {{g_bytes + 1046, 16}}}, - {&grpc_static_metadata_refcounts[99], {{g_bytes + 1062, 16}}}, - {&grpc_static_metadata_refcounts[100], {{g_bytes + 1078, 13}}}, - {&grpc_static_metadata_refcounts[101], {{g_bytes + 1091, 12}}}, - {&grpc_static_metadata_refcounts[102], {{g_bytes + 1103, 21}}}, + {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 7}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}, + {&grpc_static_metadata_refcounts[31], {{g_bytes + 441, 11}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 452, 1}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 453, 1}}}, + {&grpc_static_metadata_refcounts[34], {{g_bytes + 454, 1}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}, + {&grpc_static_metadata_refcounts[36], {{g_bytes + 463, 8}}}, + {&grpc_static_metadata_refcounts[37], {{g_bytes + 471, 16}}}, + {&grpc_static_metadata_refcounts[38], {{g_bytes + 487, 4}}}, + {&grpc_static_metadata_refcounts[39], {{g_bytes + 491, 3}}}, + {&grpc_static_metadata_refcounts[40], {{g_bytes + 494, 3}}}, + {&grpc_static_metadata_refcounts[41], {{g_bytes + 497, 4}}}, + {&grpc_static_metadata_refcounts[42], {{g_bytes + 501, 5}}}, + {&grpc_static_metadata_refcounts[43], {{g_bytes + 506, 4}}}, + {&grpc_static_metadata_refcounts[44], {{g_bytes + 510, 3}}}, + {&grpc_static_metadata_refcounts[45], {{g_bytes + 513, 3}}}, + {&grpc_static_metadata_refcounts[46], {{g_bytes + 516, 1}}}, + {&grpc_static_metadata_refcounts[47], {{g_bytes + 517, 11}}}, + {&grpc_static_metadata_refcounts[48], {{g_bytes + 528, 3}}}, + {&grpc_static_metadata_refcounts[49], {{g_bytes + 531, 3}}}, + {&grpc_static_metadata_refcounts[50], {{g_bytes + 534, 3}}}, + {&grpc_static_metadata_refcounts[51], {{g_bytes + 537, 3}}}, + {&grpc_static_metadata_refcounts[52], {{g_bytes + 540, 3}}}, + {&grpc_static_metadata_refcounts[53], {{g_bytes + 543, 14}}}, + {&grpc_static_metadata_refcounts[54], {{g_bytes + 557, 13}}}, + {&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 15}}}, + {&grpc_static_metadata_refcounts[56], {{g_bytes + 585, 13}}}, + {&grpc_static_metadata_refcounts[57], {{g_bytes + 598, 6}}}, + {&grpc_static_metadata_refcounts[58], {{g_bytes + 604, 27}}}, + {&grpc_static_metadata_refcounts[59], {{g_bytes + 631, 3}}}, + {&grpc_static_metadata_refcounts[60], {{g_bytes + 634, 5}}}, + {&grpc_static_metadata_refcounts[61], {{g_bytes + 639, 13}}}, + {&grpc_static_metadata_refcounts[62], {{g_bytes + 652, 13}}}, + {&grpc_static_metadata_refcounts[63], {{g_bytes + 665, 19}}}, + {&grpc_static_metadata_refcounts[64], {{g_bytes + 684, 16}}}, + {&grpc_static_metadata_refcounts[65], {{g_bytes + 700, 14}}}, + {&grpc_static_metadata_refcounts[66], {{g_bytes + 714, 16}}}, + {&grpc_static_metadata_refcounts[67], {{g_bytes + 730, 13}}}, + {&grpc_static_metadata_refcounts[68], {{g_bytes + 743, 6}}}, + {&grpc_static_metadata_refcounts[69], {{g_bytes + 749, 4}}}, + {&grpc_static_metadata_refcounts[70], {{g_bytes + 753, 4}}}, + {&grpc_static_metadata_refcounts[71], {{g_bytes + 757, 6}}}, + {&grpc_static_metadata_refcounts[72], {{g_bytes + 763, 7}}}, + {&grpc_static_metadata_refcounts[73], {{g_bytes + 770, 4}}}, + {&grpc_static_metadata_refcounts[74], {{g_bytes + 774, 8}}}, + {&grpc_static_metadata_refcounts[75], {{g_bytes + 782, 17}}}, + {&grpc_static_metadata_refcounts[76], {{g_bytes + 799, 13}}}, + {&grpc_static_metadata_refcounts[77], {{g_bytes + 812, 8}}}, + {&grpc_static_metadata_refcounts[78], {{g_bytes + 820, 19}}}, + {&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 13}}}, + {&grpc_static_metadata_refcounts[80], {{g_bytes + 852, 11}}}, + {&grpc_static_metadata_refcounts[81], {{g_bytes + 863, 4}}}, + {&grpc_static_metadata_refcounts[82], {{g_bytes + 867, 8}}}, + {&grpc_static_metadata_refcounts[83], {{g_bytes + 875, 12}}}, + {&grpc_static_metadata_refcounts[84], {{g_bytes + 887, 18}}}, + {&grpc_static_metadata_refcounts[85], {{g_bytes + 905, 19}}}, + {&grpc_static_metadata_refcounts[86], {{g_bytes + 924, 5}}}, + {&grpc_static_metadata_refcounts[87], {{g_bytes + 929, 7}}}, + {&grpc_static_metadata_refcounts[88], {{g_bytes + 936, 7}}}, + {&grpc_static_metadata_refcounts[89], {{g_bytes + 943, 11}}}, + {&grpc_static_metadata_refcounts[90], {{g_bytes + 954, 6}}}, + {&grpc_static_metadata_refcounts[91], {{g_bytes + 960, 10}}}, + {&grpc_static_metadata_refcounts[92], {{g_bytes + 970, 25}}}, + {&grpc_static_metadata_refcounts[93], {{g_bytes + 995, 17}}}, + {&grpc_static_metadata_refcounts[94], {{g_bytes + 1012, 4}}}, + {&grpc_static_metadata_refcounts[95], {{g_bytes + 1016, 3}}}, + {&grpc_static_metadata_refcounts[96], {{g_bytes + 1019, 16}}}, + {&grpc_static_metadata_refcounts[97], {{g_bytes + 1035, 16}}}, + {&grpc_static_metadata_refcounts[98], {{g_bytes + 1051, 13}}}, + {&grpc_static_metadata_refcounts[99], {{g_bytes + 1064, 12}}}, + {&grpc_static_metadata_refcounts[100], {{g_bytes + 1076, 21}}}, }; uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { @@ -333,16 +328,16 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; static const int8_t elems_r[] = { - 11, 9, -3, 0, 10, 25, -77, 26, 0, 11, -7, 0, 0, 0, 21, 14, 1, - 0, 0, 33, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -56, 0, -36, -61, -60, -39, -63, -64, 0, 36, 35, 34, 33, - 34, 33, 32, 31, 31, 30, 29, 28, 27, 26, 26, 25, 25, 24, 23, 22, 21, - 20, 19, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 12, 11, 0}; + 13, 2, 1, 0, 15, 4, 0, 21, 0, 23, -3, 0, 0, 0, 10, 19, -4, + 0, 0, 1, 10, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -52, 0, -55, -36, -57, -58, -58, -58, 0, 40, 39, 38, 37, 36, 35, + 34, 33, 32, 31, 30, 29, 28, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, + 18, 17, 16, 15, 18, 17, 16, 15, 14, 13, 12, 11, 11, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 48; - uint32_t x = i % 101; - uint32_t y = i / 101; + i -= 46; + uint32_t x = i % 99; + uint32_t y = i / 99; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -352,31 +347,31 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 1065, 1066, 1067, 256, 257, 258, 259, 260, 1671, 149, 150, 48, - 49, 455, 456, 457, 962, 963, 964, 1568, 1683, 1684, 753, 754, - 1465, 553, 755, 2083, 2186, 5688, 5997, 1580, 1581, 6100, 6306, 6409, - 6512, 6615, 6718, 6821, 1481, 1704, 6924, 7027, 7130, 7233, 1980, 7336, - 7439, 7542, 7645, 7748, 7851, 5894, 7954, 8057, 6203, 8160, 8263, 8366, - 8469, 8572, 8675, 8778, 1129, 1130, 1131, 1132, 8881, 8984, 9087, 9190, - 9293, 9396, 9499, 9602, 9705, 9808, 9911, 332, 10014, 10117, 0, 0, - 0, 1748, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 247, - 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0}; + 1039, 1040, 145, 146, 541, 1639, 1045, 250, 251, 252, 253, 254, + 1646, 46, 47, 1437, 1942, 1651, 445, 446, 447, 739, 740, 741, + 938, 939, 1538, 2043, 2144, 1451, 944, 5376, 5578, 1545, 5780, 5881, + 1670, 5982, 1550, 6083, 6184, 6285, 6386, 6487, 6588, 6689, 6790, 6891, + 6992, 7093, 7194, 7295, 7396, 5679, 7497, 7598, 7699, 7800, 7901, 8002, + 8103, 8204, 8305, 8406, 8507, 8608, 8709, 8810, 1107, 1108, 1109, 1110, + 8911, 9012, 9113, 9214, 9315, 9416, 9517, 9618, 1714, 9719, 0, 326, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 241, 242, 0, 0, 0, 0, 0, 0, 139, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0}; static const uint8_t elem_idxs[] = { - 76, 79, 77, 19, 20, 21, 22, 23, 25, 15, 16, 17, 18, 11, - 12, 13, 3, 4, 5, 38, 83, 84, 0, 1, 43, 6, 2, 50, - 57, 24, 28, 36, 37, 29, 31, 32, 33, 34, 35, 39, 7, 26, - 40, 41, 42, 44, 72, 45, 46, 47, 48, 49, 51, 27, 52, 53, - 30, 54, 55, 56, 58, 59, 60, 61, 78, 80, 81, 82, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 73, 14, 74, 75, 255, 255, - 255, 85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; + 77, 79, 15, 16, 6, 25, 76, 19, 20, 21, 22, 23, 84, 17, + 18, 43, 72, 83, 11, 12, 13, 0, 1, 2, 5, 4, 38, 50, + 57, 7, 3, 24, 27, 37, 29, 30, 26, 31, 36, 32, 33, 34, + 35, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 28, 51, 52, + 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 78, 80, + 81, 82, 66, 67, 68, 69, 70, 71, 73, 74, 85, 75, 255, 14, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 9, 10, 255, 255, 255, 255, 255, 255, 8}; grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = (uint32_t)(a * 103 + b); + uint32_t k = (uint32_t)(a * 101 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 @@ -387,177 +382,177 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { {{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, - {&grpc_static_metadata_refcounts[32], {{g_bytes + 468, 1}}}}, + {&grpc_static_metadata_refcounts[32], {{g_bytes + 452, 1}}}}, {{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, - {&grpc_static_metadata_refcounts[33], {{g_bytes + 469, 1}}}}, + {&grpc_static_metadata_refcounts[33], {{g_bytes + 453, 1}}}}, {{&grpc_static_metadata_refcounts[7], {{g_bytes + 50, 11}}}, - {&grpc_static_metadata_refcounts[34], {{g_bytes + 470, 1}}}}, + {&grpc_static_metadata_refcounts[34], {{g_bytes + 454, 1}}}}, {{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, - {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}}, {{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, - {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}}, {{&grpc_static_metadata_refcounts[9], {{g_bytes + 77, 13}}}, - {&grpc_static_metadata_refcounts[37], {{g_bytes + 483, 7}}}}, + {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 7}}}}, {{&grpc_static_metadata_refcounts[5], {{g_bytes + 36, 2}}}, - {&grpc_static_metadata_refcounts[38], {{g_bytes + 490, 8}}}}, + {&grpc_static_metadata_refcounts[36], {{g_bytes + 463, 8}}}}, {{&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}}, - {&grpc_static_metadata_refcounts[39], {{g_bytes + 498, 16}}}}, + {&grpc_static_metadata_refcounts[37], {{g_bytes + 471, 16}}}}, {{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, - {&grpc_static_metadata_refcounts[40], {{g_bytes + 514, 4}}}}, + {&grpc_static_metadata_refcounts[38], {{g_bytes + 487, 4}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[41], {{g_bytes + 518, 3}}}}, + {&grpc_static_metadata_refcounts[39], {{g_bytes + 491, 3}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[42], {{g_bytes + 521, 3}}}}, + {&grpc_static_metadata_refcounts[40], {{g_bytes + 494, 3}}}}, {{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, - {&grpc_static_metadata_refcounts[43], {{g_bytes + 524, 4}}}}, + {&grpc_static_metadata_refcounts[41], {{g_bytes + 497, 4}}}}, {{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, - {&grpc_static_metadata_refcounts[44], {{g_bytes + 528, 5}}}}, + {&grpc_static_metadata_refcounts[42], {{g_bytes + 501, 5}}}}, {{&grpc_static_metadata_refcounts[4], {{g_bytes + 29, 7}}}, - {&grpc_static_metadata_refcounts[45], {{g_bytes + 533, 4}}}}, + {&grpc_static_metadata_refcounts[43], {{g_bytes + 506, 4}}}}, {{&grpc_static_metadata_refcounts[3], {{g_bytes + 19, 10}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, - {&grpc_static_metadata_refcounts[46], {{g_bytes + 537, 3}}}}, + {&grpc_static_metadata_refcounts[44], {{g_bytes + 510, 3}}}}, {{&grpc_static_metadata_refcounts[1], {{g_bytes + 5, 7}}}, - {&grpc_static_metadata_refcounts[47], {{g_bytes + 540, 3}}}}, + {&grpc_static_metadata_refcounts[45], {{g_bytes + 513, 3}}}}, {{&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}}, - {&grpc_static_metadata_refcounts[48], {{g_bytes + 543, 1}}}}, + {&grpc_static_metadata_refcounts[46], {{g_bytes + 516, 1}}}}, {{&grpc_static_metadata_refcounts[0], {{g_bytes + 0, 5}}}, - {&grpc_static_metadata_refcounts[49], {{g_bytes + 544, 11}}}}, + {&grpc_static_metadata_refcounts[47], {{g_bytes + 517, 11}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[50], {{g_bytes + 555, 3}}}}, + {&grpc_static_metadata_refcounts[48], {{g_bytes + 528, 3}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[51], {{g_bytes + 558, 3}}}}, + {&grpc_static_metadata_refcounts[49], {{g_bytes + 531, 3}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[52], {{g_bytes + 561, 3}}}}, + {&grpc_static_metadata_refcounts[50], {{g_bytes + 534, 3}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[53], {{g_bytes + 564, 3}}}}, + {&grpc_static_metadata_refcounts[51], {{g_bytes + 537, 3}}}}, {{&grpc_static_metadata_refcounts[2], {{g_bytes + 12, 7}}}, - {&grpc_static_metadata_refcounts[54], {{g_bytes + 567, 3}}}}, - {{&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 14}}}, + {&grpc_static_metadata_refcounts[52], {{g_bytes + 540, 3}}}}, + {{&grpc_static_metadata_refcounts[53], {{g_bytes + 543, 14}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, - {&grpc_static_metadata_refcounts[56], {{g_bytes + 584, 13}}}}, - {{&grpc_static_metadata_refcounts[57], {{g_bytes + 597, 15}}}, + {&grpc_static_metadata_refcounts[54], {{g_bytes + 557, 13}}}}, + {{&grpc_static_metadata_refcounts[55], {{g_bytes + 570, 15}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[58], {{g_bytes + 612, 13}}}, + {{&grpc_static_metadata_refcounts[56], {{g_bytes + 585, 13}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[59], {{g_bytes + 625, 6}}}, + {{&grpc_static_metadata_refcounts[57], {{g_bytes + 598, 6}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[60], {{g_bytes + 631, 27}}}, + {{&grpc_static_metadata_refcounts[58], {{g_bytes + 604, 27}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[61], {{g_bytes + 658, 3}}}, + {{&grpc_static_metadata_refcounts[59], {{g_bytes + 631, 3}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[62], {{g_bytes + 661, 5}}}, + {{&grpc_static_metadata_refcounts[60], {{g_bytes + 634, 5}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[63], {{g_bytes + 666, 13}}}, + {{&grpc_static_metadata_refcounts[61], {{g_bytes + 639, 13}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[64], {{g_bytes + 679, 13}}}, + {{&grpc_static_metadata_refcounts[62], {{g_bytes + 652, 13}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[65], {{g_bytes + 692, 19}}}, + {{&grpc_static_metadata_refcounts[63], {{g_bytes + 665, 19}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, - {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}}, {{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, - {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}}, {{&grpc_static_metadata_refcounts[15], {{g_bytes + 170, 16}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[66], {{g_bytes + 711, 16}}}, + {{&grpc_static_metadata_refcounts[64], {{g_bytes + 684, 16}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[67], {{g_bytes + 727, 14}}}, + {{&grpc_static_metadata_refcounts[65], {{g_bytes + 700, 14}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[68], {{g_bytes + 741, 16}}}, + {{&grpc_static_metadata_refcounts[66], {{g_bytes + 714, 16}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[69], {{g_bytes + 757, 13}}}, + {{&grpc_static_metadata_refcounts[67], {{g_bytes + 730, 13}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[14], {{g_bytes + 158, 12}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[70], {{g_bytes + 770, 6}}}, + {{&grpc_static_metadata_refcounts[68], {{g_bytes + 743, 6}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[71], {{g_bytes + 776, 4}}}, + {{&grpc_static_metadata_refcounts[69], {{g_bytes + 749, 4}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[72], {{g_bytes + 780, 4}}}, + {{&grpc_static_metadata_refcounts[70], {{g_bytes + 753, 4}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[73], {{g_bytes + 784, 6}}}, + {{&grpc_static_metadata_refcounts[71], {{g_bytes + 757, 6}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[74], {{g_bytes + 790, 7}}}, + {{&grpc_static_metadata_refcounts[72], {{g_bytes + 763, 7}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[75], {{g_bytes + 797, 4}}}, + {{&grpc_static_metadata_refcounts[73], {{g_bytes + 770, 4}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[20], {{g_bytes + 278, 4}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[76], {{g_bytes + 801, 8}}}, + {{&grpc_static_metadata_refcounts[74], {{g_bytes + 774, 8}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[77], {{g_bytes + 809, 17}}}, + {{&grpc_static_metadata_refcounts[75], {{g_bytes + 782, 17}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[78], {{g_bytes + 826, 13}}}, + {{&grpc_static_metadata_refcounts[76], {{g_bytes + 799, 13}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 8}}}, + {{&grpc_static_metadata_refcounts[77], {{g_bytes + 812, 8}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[80], {{g_bytes + 847, 19}}}, + {{&grpc_static_metadata_refcounts[78], {{g_bytes + 820, 19}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[81], {{g_bytes + 866, 13}}}, + {{&grpc_static_metadata_refcounts[79], {{g_bytes + 839, 13}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[21], {{g_bytes + 282, 8}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[82], {{g_bytes + 879, 11}}}, + {{&grpc_static_metadata_refcounts[80], {{g_bytes + 852, 11}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[83], {{g_bytes + 890, 4}}}, + {{&grpc_static_metadata_refcounts[81], {{g_bytes + 863, 4}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[84], {{g_bytes + 894, 8}}}, + {{&grpc_static_metadata_refcounts[82], {{g_bytes + 867, 8}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[85], {{g_bytes + 902, 12}}}, + {{&grpc_static_metadata_refcounts[83], {{g_bytes + 875, 12}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[86], {{g_bytes + 914, 18}}}, + {{&grpc_static_metadata_refcounts[84], {{g_bytes + 887, 18}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[87], {{g_bytes + 932, 19}}}, + {{&grpc_static_metadata_refcounts[85], {{g_bytes + 905, 19}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[88], {{g_bytes + 951, 5}}}, + {{&grpc_static_metadata_refcounts[86], {{g_bytes + 924, 5}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[89], {{g_bytes + 956, 7}}}, + {{&grpc_static_metadata_refcounts[87], {{g_bytes + 929, 7}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[90], {{g_bytes + 963, 7}}}, + {{&grpc_static_metadata_refcounts[88], {{g_bytes + 936, 7}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[91], {{g_bytes + 970, 11}}}, + {{&grpc_static_metadata_refcounts[89], {{g_bytes + 943, 11}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[92], {{g_bytes + 981, 6}}}, + {{&grpc_static_metadata_refcounts[90], {{g_bytes + 954, 6}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[93], {{g_bytes + 987, 10}}}, + {{&grpc_static_metadata_refcounts[91], {{g_bytes + 960, 10}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[94], {{g_bytes + 997, 25}}}, + {{&grpc_static_metadata_refcounts[92], {{g_bytes + 970, 25}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[95], {{g_bytes + 1022, 17}}}, + {{&grpc_static_metadata_refcounts[93], {{g_bytes + 995, 17}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[19], {{g_bytes + 268, 10}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[96], {{g_bytes + 1039, 4}}}, + {{&grpc_static_metadata_refcounts[94], {{g_bytes + 1012, 4}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[97], {{g_bytes + 1043, 3}}}, + {{&grpc_static_metadata_refcounts[95], {{g_bytes + 1016, 3}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, - {{&grpc_static_metadata_refcounts[98], {{g_bytes + 1046, 16}}}, + {{&grpc_static_metadata_refcounts[96], {{g_bytes + 1019, 16}}}, {&grpc_static_metadata_refcounts[23], {{g_bytes + 302, 0}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[37], {{g_bytes + 483, 7}}}}, + {&grpc_static_metadata_refcounts[29], {{g_bytes + 430, 7}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[99], {{g_bytes + 1062, 16}}}}, + {&grpc_static_metadata_refcounts[97], {{g_bytes + 1035, 16}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[100], {{g_bytes + 1078, 13}}}}, + {&grpc_static_metadata_refcounts[98], {{g_bytes + 1051, 13}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[101], {{g_bytes + 1091, 12}}}}, + {&grpc_static_metadata_refcounts[99], {{g_bytes + 1064, 12}}}}, {{&grpc_static_metadata_refcounts[10], {{g_bytes + 90, 20}}}, - {&grpc_static_metadata_refcounts[102], {{g_bytes + 1103, 21}}}}, + {&grpc_static_metadata_refcounts[100], {{g_bytes + 1076, 21}}}}, {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, - {&grpc_static_metadata_refcounts[35], {{g_bytes + 471, 8}}}}, + {&grpc_static_metadata_refcounts[35], {{g_bytes + 455, 8}}}}, {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, - {&grpc_static_metadata_refcounts[36], {{g_bytes + 479, 4}}}}, + {&grpc_static_metadata_refcounts[30], {{g_bytes + 437, 4}}}}, {{&grpc_static_metadata_refcounts[16], {{g_bytes + 186, 15}}}, - {&grpc_static_metadata_refcounts[100], {{g_bytes + 1078, 13}}}}, + {&grpc_static_metadata_refcounts[98], {{g_bytes + 1051, 13}}}}, }; bool grpc_static_callout_is_default[GRPC_BATCH_CALLOUTS_COUNT] = { true, // :path diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 21dc7a3d3f..8ce9b21bc1 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -20,7 +20,7 @@ * To make changes to this file, change * tools/codegen/core/gen_static_metadata.py, and then re-run it. * - * See metadata.h for an explanation of the interface here, and metadata.c for + * See metadata.h for an explanation of the interface here, and metadata.cc for * an explanation of what's going on. */ @@ -29,7 +29,7 @@ #include "src/core/lib/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 103 +#define GRPC_STATIC_MDSTR_COUNT 101 extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) @@ -93,10 +93,10 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ (grpc_static_slice_table[28]) -/* "message/deflate" */ -#define GRPC_MDSTR_MESSAGE_SLASH_DEFLATE (grpc_static_slice_table[29]) -/* "message/gzip" */ -#define GRPC_MDSTR_MESSAGE_SLASH_GZIP (grpc_static_slice_table[30]) +/* "deflate" */ +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[29]) +/* "gzip" */ +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[30]) /* "stream/gzip" */ #define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[31]) /* "0" */ @@ -107,141 +107,137 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_2 (grpc_static_slice_table[34]) /* "identity" */ #define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[35]) -/* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[36]) -/* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[38]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[36]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[39]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[37]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[40]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[38]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[41]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[39]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[42]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[40]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[43]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[41]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[44]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[42]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[45]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[43]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[46]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[44]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[47]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[45]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[48]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[46]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[49]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[47]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[50]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[48]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[51]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[49]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[52]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[50]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[53]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[51]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[54]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[52]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[55]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[56]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[58]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[59]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[60]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[61]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[59]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[62]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[63]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[66]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[67]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[68]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[69]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[70]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[71]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[69]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[72]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[73]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[74]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[75]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[73]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[77]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[78]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[79]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[80]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[81]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[82]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[80]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[83]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[81]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[84]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[82]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[85]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[83]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[86]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[84]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[87]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[85]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[88]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[86]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[89]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[87]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[90]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[88]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[91]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[89]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[92]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[90]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[93]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[91]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[94]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[92]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[95]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[93]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[96]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[94]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[97]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[95]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[98]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[96]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[99]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[97]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[100]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[98]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[101]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[99]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[102]) + (grpc_static_slice_table[100]) extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable; extern grpc_slice_refcount @@ -590,5 +586,4 @@ extern const uint8_t grpc_static_accept_stream_encoding_metadata[4]; (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table \ [grpc_static_accept_stream_encoding_metadata[(algs)]], \ GRPC_MDELEM_STORAGE_STATIC)) - #endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */ |