Skip to content

Commit d5d3222

Browse files
committed
🎨 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.
1 parent a8f1362 commit d5d3222

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

include/log/catalog/mipi_builder.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ template <typename> struct builder;
1717

1818
template <> struct builder<defn::short32_msg_t> {
1919
template <auto Level, std::same_as<std::uint32_t>... Ts>
20-
ALWAYS_INLINE static auto build(string_id id, module_id, Ts...) {
20+
static auto build(string_id id, module_id, Ts...) {
2121
using namespace msg;
2222
return owning<defn::short32_msg_t>{"payload"_field = id};
2323
}
2424
};
2525

2626
template <typename Storage> struct catalog_builder {
2727
template <auto Level, std::same_as<std::uint32_t>... Ts>
28-
ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) {
28+
static auto build(string_id id, module_id m, Ts... msg_data) {
2929
using namespace msg;
3030
defn::catalog_msg_t::owner_t<Storage> message{"severity"_field = Level,
3131
"module_id"_field = m};
@@ -48,7 +48,7 @@ template <typename Storage>
4848
requires std::same_as<typename Storage::value_type, std::uint32_t>
4949
struct catalog_builder<Storage> {
5050
template <auto Level, std::same_as<std::uint32_t>... Ts>
51-
ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) {
51+
static auto build(string_id id, module_id m, Ts... msg_data) {
5252
using namespace msg;
5353
defn::catalog_msg_t::owner_t<Storage> message{"severity"_field = Level,
5454
"module_id"_field = m};
@@ -65,7 +65,7 @@ struct catalog_builder<Storage> {
6565

6666
template <> struct builder<defn::catalog_msg_t> {
6767
template <auto Level, std::same_as<std::uint32_t>... Ts>
68-
ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) {
68+
static auto build(string_id id, module_id m, Ts... msg_data) {
6969
using namespace msg;
7070
if constexpr (sizeof...(Ts) <= 2u) {
7171
constexpr auto header_size =
@@ -89,7 +89,7 @@ template <> struct builder<defn::catalog_msg_t> {
8989

9090
struct default_builder {
9191
template <auto Level, std::same_as<std::uint32_t>... Ts>
92-
ALWAYS_INLINE static auto build(string_id id, module_id m, Ts... msg_data) {
92+
static auto build(string_id id, module_id m, Ts... msg_data) {
9393
if constexpr (sizeof...(Ts) == 0u) {
9494
return builder<defn::short32_msg_t>{}.template build<Level>(
9595
id, m, msg_data...);

include/log/catalog/mipi_encoder.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ template <typename TDestinations> struct log_handler {
4343

4444
template <typename Env, typename FilenameStringType,
4545
typename LineNumberType, typename MsgType>
46-
ALWAYS_INLINE auto log(FilenameStringType, LineNumberType,
47-
MsgType const &msg) -> void {
46+
auto log(FilenameStringType, LineNumberType, MsgType const &msg) -> void {
4847
log_msg<Env>(msg);
4948
}
5049

51-
template <typename Env, typename Msg>
52-
ALWAYS_INLINE auto log_msg(Msg msg) -> void {
50+
template <typename Env, typename Msg> auto log_msg(Msg msg) -> void {
5351
msg.apply([&]<typename S, typename... Args>(S, Args... args) {
5452
constexpr auto L = stdx::to_underlying(get_level(Env{}).value);
5553
using Message = decltype(detail::to_message<S, Args...>());
@@ -93,7 +91,7 @@ template <typename TDestinations> struct log_handler {
9391

9492
private:
9593
template <std::size_t N>
96-
NEVER_INLINE auto write(stdx::span<std::uint8_t const, N> msg) -> void {
94+
auto write(stdx::span<std::uint8_t const, N> msg) -> void {
9795
stdx::for_each(
9896
[&]<typename Dest>(Dest &dest) {
9997
conc::call_in_critical_section<Dest>(
@@ -103,7 +101,7 @@ template <typename TDestinations> struct log_handler {
103101
}
104102

105103
template <std::size_t N>
106-
NEVER_INLINE auto write(stdx::span<std::uint32_t const, N> msg) -> void {
104+
auto write(stdx::span<std::uint32_t const, N> msg) -> void {
107105
[&]<std::size_t... Is>(std::index_sequence<Is...>) {
108106
stdx::for_each(
109107
[&]<typename Dest>(Dest &dest) {

include/log/log.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct config {
3939
template <typename...> inline auto config = null::config{};
4040

4141
template <typename Env, typename... Ts>
42-
ALWAYS_INLINE constexpr static auto get_config() -> auto & {
42+
constexpr static auto get_config() -> auto & {
4343
using flavor_t = typename decltype(get_flavor(Env{}).value)::type;
4444
if constexpr (std::same_as<flavor_t, default_flavor_t>) {
4545
return config<Ts...>;
@@ -49,7 +49,7 @@ ALWAYS_INLINE constexpr static auto get_config() -> auto & {
4949
}
5050

5151
template <typename Env, typename... Ts, typename... TArgs>
52-
ALWAYS_INLINE static auto log(TArgs &&...args) -> void {
52+
static auto log(TArgs &&...args) -> void {
5353
auto &cfg = get_config<Env, Ts...>();
5454
cfg.logger.template log<Env>(std::forward<TArgs>(args)...);
5555
}
@@ -89,8 +89,7 @@ ALWAYS_INLINE static auto log(TArgs &&...args) -> void {
8989
((expr) ? void(0) : CIB_FATAL("Assertion failure: " #expr))
9090

9191
namespace logging {
92-
template <typename Env, typename... Ts>
93-
ALWAYS_INLINE static auto log_version() -> void {
92+
template <typename Env, typename... Ts> static auto log_version() -> void {
9493
auto &l_cfg = get_config<Env, Ts...>();
9594
auto &v_cfg = ::version::config<Ts...>;
9695
if constexpr (requires {

0 commit comments

Comments
 (0)