mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
AK+Kernel: Help the compiler inline a bunch of trivial methods
If these methods get inlined, the compiler is able to statically eliminate most of the assertions. Alas, it doesn't realize this, and believes inlining them to be too expensive. So give it a strong hint that it's not the case. This *decreases* the kernel binary size.
This commit is contained in:
parent
36dcbce161
commit
d2b500fbcb
6 changed files with 51 additions and 56 deletions
|
@ -57,25 +57,25 @@ constexpr auto call_one_ref_left_if_present(...) -> FalseType
|
|||
|
||||
class RefCountedBase {
|
||||
public:
|
||||
void ref() const
|
||||
ALWAYS_INLINE void ref() const
|
||||
{
|
||||
ASSERT(m_ref_count);
|
||||
++m_ref_count;
|
||||
}
|
||||
|
||||
int ref_count() const
|
||||
ALWAYS_INLINE int ref_count() const
|
||||
{
|
||||
return m_ref_count;
|
||||
}
|
||||
|
||||
protected:
|
||||
RefCountedBase() {}
|
||||
~RefCountedBase()
|
||||
ALWAYS_INLINE ~RefCountedBase()
|
||||
{
|
||||
ASSERT(!m_ref_count);
|
||||
}
|
||||
|
||||
void deref_base() const
|
||||
ALWAYS_INLINE void deref_base() const
|
||||
{
|
||||
ASSERT(m_ref_count);
|
||||
--m_ref_count;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue