[v3] libstdc++/16614

Benjamin Kosnik bkoz@redhat.com
Wed Sep 1 22:16:00 GMT 2004


The libstdc++ part of 16614. This is a re-organization of the
__mt_allocator code into the following:

A __pool class, conditioned on thread support. This allows threaded
configs to use non-threaded allocators.

Policy classes for per-type and common pools. More info in the docs.

I believe this design fixes the previous issues with this code, while
allowing interesting new uses and possibilities. This is source-code
compatible, meaning people using __mt_alloc right now won't have to do
changes to their code to use this version.

Performance characteristics are similar to pre-reorg. Single threaded
codepaths have seen an increase in performance, not surprisingly. For
the __common_pool_policy, destruction times lag around 7%. I don't think
this is a serious problem.

Gaby and Paolo have given feedback and encouragement on this task.
Thanks!

I'm unable to add 16614 to the testsuite, as compiling it takes a huge
ammount of machine resources (1G RAM, 8min + on P4 3gig).

I'm currently having issues testing on darwin. Previous versions of this
patch did test well on darwin, however, so I am not expecting any
issues.

tested x86/linux
tested x86/linux threads disabled
performance tested x86/linux

2004-09-01  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/16614
	* include/ext/mt_allocator.h (__mt_base): Not type dependent,
	split into..
	(__pool): New, specialize.
	(__common_pool): New, static bits here.
	(__per_type_pool): New, and here.
	(__mt_alloc_base): New.
	(__mt_alloc): Add template parameter, inherit from it.
	* src/allocator.cc: Split this...
	* src/allocator-inst.cc: And this...
	* src/pool_allocator.cc: ...into this.
	* src/mt_allocator.cc: ... and this. Add definitions for
	__mt_base.
	* src/Makefile.am (sources): Split allocator.cc to
	pool_allocator.cc and mt_allocator.cc.
	* src/Makefile.in: Regenerate.
	* config/linker-map.gnu: Add symbols.
	* docs/html/ext/mt_allocator.html: Document new design.
	* testsuite/ext/mt_allocator/tune-1.cc: New.
	* testsuite/ext/mt_allocator/tune-2.cc: New.
	* testsuite/ext/mt_allocator/tune-3.cc: New.
	* testsuite/ext/mt_allocator/tune-4.cc: New.	

	* testsuite/testsuite_allocator.h (__gnu_test::check_new): New.
	* testsuite/ext/allocators.cc: Use check_new, split into...
	* testsuite/ext/mt_allocator/check_new.cc: this.
	* testsuite/ext/pool_allocator/check_new.cc: this.
	* testsuite/ext/malloc_allocator/check_new.cc: this.	
	* testsuite/ext/debug_allocator/check_new.cc: this.	
	* testsuite/ext/mt_allocator/instantiate.cc: this.
	* testsuite/ext/pool_allocator/instantiate.cc: this.
	* testsuite/ext/malloc_allocator/instantiate.cc: this.	
	* testsuite/ext/debug_allocator/instantiate.cc: this.	
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.20040901.bz2
Type: application/x-bzip2
Size: 17124 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040901/a1181bdc/attachment.bz2>


More information about the Libstdc++ mailing list