mirror of
https://github.com/matrix-construct/construct
synced 2024-09-26 02:18:53 +02:00
ircd: Tweak exception stack linkages for optimal code generation.
This commit is contained in:
parent
1023d0eab2
commit
5f96613c27
3 changed files with 40 additions and 10 deletions
|
@ -96,11 +96,7 @@ struct ircd::exception
|
|||
public:
|
||||
const char *what() const noexcept override;
|
||||
|
||||
exception(generate_skip_t = {}) noexcept
|
||||
{
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
exception(generate_skip_t = {}) noexcept;
|
||||
exception(exception &&) = delete;
|
||||
exception(const exception &) = delete;
|
||||
exception &operator=(exception &&) = delete;
|
||||
|
@ -144,6 +140,7 @@ struct name \
|
|||
:parent \
|
||||
{ \
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(hide_name_t, const string_view &fmt, args&&... ap) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -151,6 +148,7 @@ struct name \
|
|||
} \
|
||||
\
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(hide_name_t, const string_view &fmt = " ") noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -158,6 +156,7 @@ struct name \
|
|||
} \
|
||||
\
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(const string_view &fmt, args&&... ap) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -165,12 +164,14 @@ struct name \
|
|||
} \
|
||||
\
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(const string_view &fmt = " ") noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
generate(#name, fmt, ircd::va_rtti{}); \
|
||||
} \
|
||||
\
|
||||
[[using gnu: flatten, always_inline]] \
|
||||
name(generate_skip_t) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -183,6 +184,7 @@ struct name \
|
|||
:parent \
|
||||
{ \
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(const string_view &fmt, args&&... ap) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -190,12 +192,14 @@ struct name \
|
|||
} \
|
||||
\
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(const string_view &fmt = " ") noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
generate(fmt, ircd::va_rtti{}); \
|
||||
} \
|
||||
\
|
||||
[[using gnu: flatten, always_inline]] \
|
||||
name(generate_skip_t = {}) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -240,3 +244,11 @@ ircd::make_system_eptr(args&&... a)
|
|||
{
|
||||
return std::make_exception_ptr(make_system_error(std::forward<args>(a)...));
|
||||
}
|
||||
|
||||
[[gnu::always_inline]]
|
||||
inline
|
||||
ircd::exception::exception(generate_skip_t)
|
||||
noexcept
|
||||
{
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
|
|
@ -38,9 +38,7 @@ class ircd::m::error
|
|||
|
||||
protected:
|
||||
IRCD_OVERLOAD(child)
|
||||
template<class... args> error(child_t, args&&... a)
|
||||
:error{std::forward<args>(a)...}
|
||||
{}
|
||||
template<class... args> error(child_t, args&&...);
|
||||
|
||||
public:
|
||||
string_view errcode() const noexcept;
|
||||
|
@ -78,19 +76,24 @@ class ircd::m::error
|
|||
struct _name_ \
|
||||
: _parent_ \
|
||||
{ \
|
||||
[[gnu::noinline]] \
|
||||
_name_() \
|
||||
: _parent_ \
|
||||
{ \
|
||||
child, _httpcode_, "M_"#_name_, "%s", http::status(_httpcode_) \
|
||||
}{} \
|
||||
\
|
||||
template<class... args> _name_(const string_view &fmt, args&&... a) \
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
_name_(const string_view &fmt, args&&... a) \
|
||||
: _parent_ \
|
||||
{ \
|
||||
child, _httpcode_, "M_"#_name_, fmt, std::forward<args>(a)... \
|
||||
}{} \
|
||||
\
|
||||
template<class... args> _name_(child_t, args&&... a) \
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
_name_(child_t, args&&... a) \
|
||||
: _parent_ \
|
||||
{ \
|
||||
child, std::forward<args>(a)... \
|
||||
|
@ -116,6 +119,7 @@ namespace ircd::m
|
|||
}
|
||||
|
||||
template<class... args>
|
||||
[[using gnu: flatten]]
|
||||
inline
|
||||
ircd::m::error::error(const http::code &status,
|
||||
const string_view &errcode,
|
||||
|
@ -151,3 +155,14 @@ ircd::m::error::error(const string_view &errcode,
|
|||
http::INTERNAL_SERVER_ERROR, errcode, fmt, std::forward<args>(a)...
|
||||
}
|
||||
{}
|
||||
|
||||
template<class... args>
|
||||
[[using gnu: flatten, always_inline]]
|
||||
inline
|
||||
ircd::m::error::error(child_t,
|
||||
args&&... a)
|
||||
:error
|
||||
{
|
||||
std::forward<args>(a)...
|
||||
}
|
||||
{}
|
||||
|
|
|
@ -41,6 +41,7 @@ struct name \
|
|||
:parent \
|
||||
{ \
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(const string_view &fmt, args&&... ap) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -49,6 +50,7 @@ struct name \
|
|||
} \
|
||||
\
|
||||
template<class... args> \
|
||||
[[gnu::noinline]] \
|
||||
name(const string_view &fmt = " ") noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
@ -56,6 +58,7 @@ struct name \
|
|||
ircd::panicking(*this); \
|
||||
} \
|
||||
\
|
||||
[[gnu::always_inline]] \
|
||||
name(generate_skip_t) \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
|
|
Loading…
Reference in a new issue