gcc dwarf2out: Drop the size + performance overhead of DW_AT_sibling
Jan Kratochvil
jan.kratochvil@redhat.com
Wed Oct 19 15:38:00 GMT 2011
Hi Mark,
(.debug size)
5059640 = -3.71% no DW_AT_sibling
stap 0m0.577s (real)
gdb 0m0.234s (real)
5061160 = -3.68% DW_AT_sibling if >= 256 total children
stap 0m0.572s
gdb 0m0.232s
5084040 = -3.25%; DW_AT_sibling if >= 16 total children
stap 0m0.545s
gdb 0m0.231s
5169888 = -1.62%; DW_AT_sibling if >= 4 total children
stap 0m0.540s
gdb 0m0.235s
5254792 = ------; all DW_AT_sibling
stap 0m0.536s
gdb 0m0.243s
So the stap vs. gdb performance is exactly the opposite.
I will redo the timings after another change (DW_FORM_ref_udata) which may yet
change the timing / magic threshold.
Thanks,
Jan
gcc/
2011-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2out.c (add_sibling_attributes): New variables next_die_no and
this_die_no. Do not produce DW_AT_sibling for too few children and no
-gstruct-dwarf.
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -7490,14 +7490,21 @@ static void
add_sibling_attributes (dw_die_ref die)
{
dw_die_ref c;
+ static unsigned long next_die_no;
+ unsigned long this_die_no = next_die_no++;
if (! die->die_child)
return;
+ FOR_EACH_CHILD (die, c, add_sibling_attributes (c));
+
+ /* -gstruct-dwarf can be used for unconditional DW_AT_sibling for backward
+ compatibility. */
+ if (!dwarf_strict && next_die_no - this_die_no < 16)
+ return;
+
if (die->die_parent && die != die->die_parent->die_child)
add_AT_die_ref (die, DW_AT_sibling, die->die_sib);
-
- FOR_EACH_CHILD (die, c, add_sibling_attributes (c));
}
/* Output all location lists for the DIE and its children. */
More information about the Archer
mailing list