diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-03-07 08:07:15 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-03-10 07:21:22 +0100 |
| commit | 74765ebe65b8b67b2d2bbe3f4fa3eb1879d030aa (patch) | |
| tree | 673981f0790ce95e88661ce3e03c0e8b0ad8be18 /src/gui/opengl/qopenglprogrambinarycache.cpp | |
| parent | ec2e3e7ac92d000e0df0c693b9a636390d34a9eb (diff) | |
QUnicodeTools: reduce unneeded relocations
Turn the charAttributeFunction array of function pointers into a
switch. This has two benefits:
- The compiler now warns when we introduce a new QChar::Script value
and statically forces us to think whether a new attribute handling
function is needed.
- A table of function pointers requires relocations. A switch might
not. GCC uses a jump table to implement this switch, jumping to
distinct lea instructions fetching distinct function pointer values,
and thereby removes relocations, while Clang actually forms a
function pointer table and turns the switch into an indexing
operation (with compiler-generated guards). I didn't check whether
Clang's table actually requires relocations, relinfo.pl doesn't
report any reductions, but it's become unreliable over the years,
because it doesn't for GCC, either.
Difference:
qunicodetools.cpp.o:
- 0000000000000000 l O .data.rel.ro.local 0000000000000108 QUnicodeTools::Tailored::charAttributeFunction
0000000000000000 l d .data.rel.ro.local 0000000000000000 .data.rel.ro.local
See
https://stackoverflow.com/questions/19067010/finding-where-relocations-originate/19338343#19338343
for the script to generate this output.
See https://www.akkadia.org/drepper/dsohowto.pdf Section 1.6 for why
we care.
Instead of collapsing identical return statements from adjacent case
statements into one, keep the per-case return statements for now, to
aid review, and clean up in a follow-up commit.
Amends dd7d8304bbe599320b163b94e9a4ad9a6f35b740.
Pick-to: 6.9 6.8 6.5
Task-number: QTBUG-100536
Change-Id: Ic5b6bd29e3a3a88f0d194fa7d76272a4770b9840
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/opengl/qopenglprogrambinarycache.cpp')
0 files changed, 0 insertions, 0 deletions
