[optimization] Add support for `[[clang:always_inline]]` and similar attributes (#36948)

We can demonstrably do a better job than compiler heuristics for large chunks of call-v3, so give ourselves that lever.

Closes #36948

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36948 from ctiller:always-inline 315c77a272
PiperOrigin-RevId: 644101013
pull/36951/head
Craig Tiller 5 months ago committed by Copybara-Service
parent 4df07a77f0
commit 3e3d21164b
  1. 11
      include/grpc/support/port_platform.h

@ -746,6 +746,17 @@ extern void gpr_unreachable_code(const char* reason, const char* file,
#endif
#endif /* GPR_ATTRIBUTE_NOINLINE */
#ifndef GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
#if GPR_HAS_CPP_ATTRIBUTE(clang::always_inline)
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION [[clang::always_inline]]
#elif GPR_HAS_ATTRIBUTE(always_inline)
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION __attribute__((always_inline))
#else
// TODO(ctiller): add __forceinline for MSVC
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
#endif
#endif /* GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION */
#ifndef GPR_NO_UNIQUE_ADDRESS
#if GPR_HAS_CPP_ATTRIBUTE(no_unique_address)
#define GPR_NO_UNIQUE_ADDRESS [[no_unique_address]]

Loading…
Cancel
Save