From d5d32221533e280d32556806b3455eb2cacc57bf Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Tue, 18 Feb 2025 14:10:06 -0700 Subject: [PATCH] :art: Remove inlining attributes from logging functions Problem: - The interplay of inlining and outlining is too complex. CE experiments show that the compiler does the right thing without it all. Solution: - Remove it all. --- include/log/catalog/mipi_builder.hpp | 10 +++++----- include/log/catalog/mipi_encoder.hpp | 10 ++++------ include/log/log.hpp | 7 +++---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/log/catalog/mipi_builder.hpp b/include/log/catalog/mipi_builder.hpp index 75f4f05f..a49cd0a0 100644 --- a/include/log/catalog/mipi_builder.hpp +++ b/include/log/catalog/mipi_builder.hpp @@ -17,7 +17,7 @@ template struct builder; template <> struct builder { template ... Ts> - ALWAYS_INLINE static auto build(string_id id, module_id, Ts...) { + static auto build(string_id id, module_id, Ts...) { using namespace msg; return owning{"payload"_field = id}; } @@ -25,7 +25,7 @@ template <> struct builder { template struct catalog_builder { template ... Ts> - ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) { + static auto build(string_id id, module_id m, Ts... msg_data) { using namespace msg; defn::catalog_msg_t::owner_t message{"severity"_field = Level, "module_id"_field = m}; @@ -48,7 +48,7 @@ template requires std::same_as struct catalog_builder { template ... Ts> - ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) { + static auto build(string_id id, module_id m, Ts... msg_data) { using namespace msg; defn::catalog_msg_t::owner_t message{"severity"_field = Level, "module_id"_field = m}; @@ -65,7 +65,7 @@ struct catalog_builder { template <> struct builder { template ... Ts> - ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) { + static auto build(string_id id, module_id m, Ts... msg_data) { using namespace msg; if constexpr (sizeof...(Ts) <= 2u) { constexpr auto header_size = @@ -89,7 +89,7 @@ template <> struct builder { struct default_builder { template ... Ts> - ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) { + static auto build(string_id id, module_id m, Ts... msg_data) { if constexpr (sizeof...(Ts) == 0u) { return builder{}.template build( id, m, msg_data...); diff --git a/include/log/catalog/mipi_encoder.hpp b/include/log/catalog/mipi_encoder.hpp index b95222a6..dc092c98 100644 --- a/include/log/catalog/mipi_encoder.hpp +++ b/include/log/catalog/mipi_encoder.hpp @@ -43,13 +43,11 @@ template struct log_handler { template - ALWAYS_INLINE auto log(FilenameStringType, LineNumberType, - MsgType const &msg) -> void { + auto log(FilenameStringType, LineNumberType, MsgType const &msg) -> void { log_msg(msg); } - template - ALWAYS_INLINE auto log_msg(Msg msg) -> void { + template auto log_msg(Msg msg) -> void { msg.apply([&](S, Args... args) { constexpr auto L = stdx::to_underlying(get_level(Env{}).value); using Message = decltype(detail::to_message()); @@ -93,7 +91,7 @@ template struct log_handler { private: template - NEVER_INLINE auto write(stdx::span msg) -> void { + auto write(stdx::span msg) -> void { stdx::for_each( [&](Dest &dest) { conc::call_in_critical_section( @@ -103,7 +101,7 @@ template struct log_handler { } template - NEVER_INLINE auto write(stdx::span msg) -> void { + auto write(stdx::span msg) -> void { [&](std::index_sequence) { stdx::for_each( [&](Dest &dest) { diff --git a/include/log/log.hpp b/include/log/log.hpp index 2078c7cf..4bebb621 100644 --- a/include/log/log.hpp +++ b/include/log/log.hpp @@ -39,7 +39,7 @@ struct config { template inline auto config = null::config{}; template -ALWAYS_INLINE constexpr static auto get_config() -> auto & { +constexpr static auto get_config() -> auto & { using flavor_t = typename decltype(get_flavor(Env{}).value)::type; if constexpr (std::same_as) { return config; @@ -49,7 +49,7 @@ ALWAYS_INLINE constexpr static auto get_config() -> auto & { } template -ALWAYS_INLINE static auto log(TArgs &&...args) -> void { +static auto log(TArgs &&...args) -> void { auto &cfg = get_config(); cfg.logger.template log(std::forward(args)...); } @@ -89,8 +89,7 @@ ALWAYS_INLINE static auto log(TArgs &&...args) -> void { ((expr) ? void(0) : CIB_FATAL("Assertion failure: " #expr)) namespace logging { -template -ALWAYS_INLINE static auto log_version() -> void { +template static auto log_version() -> void { auto &l_cfg = get_config(); auto &v_cfg = ::version::config; if constexpr (requires {