From 2b8594dc85ce0303cda3e23ebdba15b742e3adca Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 9 Mar 2024 20:46:49 -0500 Subject: [PATCH] LibGfx: Replace FLATTEN with ALWAYS_INLINE for `draw_glyph()` overload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While IMO, the change makes sense on its own as flattening this function will just duplicate the code from `draw_glyph()` with no benefits, this is not what motivated this patch. When compiling with debug information and ASAN, GCC 13.2 would issue this warning: Userland/Libraries/LibGfx/Painter.cpp: In member function ‘void Gfx::Pai nter::draw_glyph(Gfx::FloatPoint, u32, Gfx::Color)’: Userland/Libraries/LibGfx/Painter.cpp:1354:14: note: variable tracking s ize limit exceeded with ‘-fvar-tracking-assignments’, retrying without 1354 | FLATTEN void Painter::draw_glyph(FloatPoint point, u32 code_poin t, Color color) | ^~~~~~~ From what I've read online, this is caused by some limit on the number of symbols in the compiler's internal data structures. People at Google have fixed this warning by splitting functions: https://codereview.chromium.org/1164893003 While getting us rid of the warning, it also drastically improves compilation time. Going from 1min27 to 59s on my machine. --- Userland/Libraries/LibGfx/Painter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index 99cf89e453..5b8f1a40aa 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -1351,7 +1351,7 @@ void Painter::draw_scaled_bitmap(IntRect const& a_dst_rect, Gfx::Bitmap const& s } } -FLATTEN void Painter::draw_glyph(FloatPoint point, u32 code_point, Color color) +ALWAYS_INLINE void Painter::draw_glyph(FloatPoint point, u32 code_point, Color color) { draw_glyph(point, code_point, font(), color); }