GNOME Bugzilla – Bug 64982
Unicode decomposition table could be improved
Last modified: 2004-12-22 21:47:04 UTC
The table for storing Unicode decomposition data in gunidecomp.h could be improved. This bug is related to bug 64433, and addresses the suggested improvements from Owen in http://mail.gnome.org/archives/gtk-devel-list/2001-November/msg00375.html. The table has a char pointer to a string constant in each record. This causes the linker to insert about 3500 unnecessary relocations and forces the table into the .data section instead of the .rodata section of an ELF executable. Additionally, because char pointers rather than const char pointers are used, all the character data goes into .data as well. Given that glib is shared among many programs, getting as much data as possible in the .rodata section is important. Like bug 64433, the footprint can be reduced by storing indices as shorts rather than pointers. Furthermore, many of the decomposition expansions are duplicated and can be folded.
Created attachment 6054 [details] [review] Proposed fix.
Here is a patch that fixes this bug. It puts the decomposition data into a seperate static const decomp_expansion_string, and stores indices into this string in the decomp_table. In addition, table entries that have the same expansion are not duplicated in the decomp_expansion_string. The return value of find_decomposition had to be changed to const, but the behavior of all functions that depend on it is unchanged. The footprint savings are summarized here: | .rodata .data relocs -------+----------------------- before | 114,727 29,508 3955 after | 135,783 1,636 468 -------+----------------------- +21,056 -27,872 -3487 In other words, about 6k is saved, another 21k is moved from .data to .rodata, and 3487 relocations are saved. The .rodata and .data sizes were measured with objdump -h, the relocations with objdump -R.
Applied. Thanks! Mon Nov 19 16:14:05 2001 Owen Taylor <otaylor@redhat.com> * tests/Makefile.am (libmoduletestplugin_[ab]_la_LDFLAGS): Add dummy -rpath argument. On some (but not all) platforms, libtool will only build a convenience library without this. (#63486, Dan Winship)