This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold patch] Decompress sections in Read_symbols task

When gold is running with multiple threads, we're missing an
opportunity to parallelize the decompression of the .zdebug_str
section. Currently, we decompress it in order to do string merge
processing during the Add_symbols task, which essentially runs
single-threaded with other Add_symbols tasks. This patch decompresses
the .zdebug_str section during the Read_symbols task, where it can run
in parallel with other Read_symbols tasks, and stores the decompressed
section contents in the compressed_section map for the object. At the
end of the Add_symbols task, the decompressed sections are discarded.
(They'll be needed again during Relocate_task, but for large links it
would use too much memory to keep them all around until then.)

Testing this on a large (3.5 GB with debug info) binary yields about a
20% wall time improvement with 2 or more threads.

(Best of 3 runs, wall times in seconds)

                        Baseline        Patched
--thread-count=1        31.68           31.72
--thread-count=2        24.31           20.02   (18%)
--thread-count=4        21.78           17.06   (22%)

This patch also lays some groundwork for the --gdb-index patch (on the
way), where we'll need several decompressed debug sections during the
Add_symbols tasks (and we don't want to decompress .zdebug_str twice
-- once for string merge and once for gdb index).



2012-02-29  Cary Coutant  <>

	* gold/ (Sized_dwarf_line_info::Sized_dwarf_line_info):
	Call Object::decompressed_section_contents.
	* gold/dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
	New dtor.
	(Sized_dwarf_line_info::buffer_start_): New data member.
	* gold/ (Output_merge_data::do_add_input_section): Call
	(Output_merge_string::do_add_input_section): Likewise.
	* gold/ (need_decompressed_section): New function.
	(build_compressed_section_map): Decompress sections needed later.
	(Sized_relobj_file::do_decompressed_section_contents): New function.
	(Sized_relobj_file::do_discard_decompressed_sections): New function.
	* gold/object.h (Object::decompressed_section_contents): New function.
	(Object::discard_decompressed_sections): New function.
	(Object::do_decompressed_section_contents): New function.
	(Object::do_discard_decompressed_sections): New function.
	(Compressed_section_info): New type.
	(Compressed_section_map): Include decompressed section contents.
	(Sized_relobj_file::do_decompressed_section_contents): New function.
	(Sized_relobj_file::do_discard_decompressed_sections): New function.

Attachment: gold-predecompress-patch.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]