diff options
author | Yao Qi <yao.qi@linaro.org> | 2018-02-26 15:38:00 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2018-02-26 15:38:00 +0000 |
commit | cd9983dd5f16803aa60e9fe1692b7e6716ac3927 (patch) | |
tree | 95f270d2de9aecfb9f60455a5501ddeb87535ee9 /libiberty/simple-object.txh | |
parent | f46cd62a69b8050c7c30a53b29a781a9b5e9f062 (diff) | |
download | gdb-cd9983dd5f16803aa60e9fe1692b7e6716ac3927.zip gdb-cd9983dd5f16803aa60e9fe1692b7e6716ac3927.tar.gz gdb-cd9983dd5f16803aa60e9fe1692b7e6716ac3927.tar.bz2 |
Re-write partial_die_info allocation in load_partial_dies
load_partial_dies has a "while (1)" loop to visit each die, and create
partial_die_info if needed in each iteration, like this,
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
while (1)
{
if (foo1) continue;
if (foo2) continue;
read_partial_die (, , part_die, ,);
....
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
};
the code was written in a way that spaces are allocated on necessary on
cu->comp_unit_obstack. I want to class-fy partial_die_info, but
partial_die_info ctor can't follow XOBNEW immediately, so this patch
rewrite this loop to:
while (1)
{
if (foo1) continue;
if (foo2) continue;
struct partial_die_info pdi;
read_partial_die (, , &pdi, ,);
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
memcpy (part_die, &pdi, sizeof (pdi));
};
we create a local variable pdi, if we need it, call XOBNEW, and copy.
This also reduce one XOBNEW call. I measured the number of XOBNEW call in
load_partial_dies when gdb reads dwarf2read.o, without this patch, it is
18827, and with this patch, it is 18826.
gdb:
2018-026-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (load_partial_dies): Move the location of XOBNEW.
Diffstat (limited to 'libiberty/simple-object.txh')
0 files changed, 0 insertions, 0 deletions