* include/ext/mt_allocator.h: Fixups.
* testsuite/performance/allocator.cc: Enable __mt_alloc tests.
* testsuite/performance/allocator_thread.cc: Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75875
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-01-14 Stefan Olsson <stefan@snon.net>
+
+ * include/ext/mt_allocator.h: Fixups.
+ * testsuite/performance/allocator.cc: Enable __mt_alloc tests.
+ * testsuite/performance/allocator_thread.cc: Same.
+
2004-01-13 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/performance/ifstream_extract_float.cc: Add higher
2004-01-13 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/performance/ifstream_extract_float.cc: Add higher
* Requests larger than _S_max_bytes are handled by
* new/delete directly
*/
* Requests larger than _S_max_bytes are handled by
* new/delete directly
*/
- if (__n > _S_max_bytes)
+ if (__n * sizeof(_Tp) > _S_max_bytes)
{
void* __ret = malloc(__n * sizeof(_Tp));
if (!__ret)
{
void* __ret = malloc(__n * sizeof(_Tp));
if (!__ret)
/*
* Round up to power of 2 and figure out which bin to use
*/
/*
* Round up to power of 2 and figure out which bin to use
*/
- size_t bin = _S_binmap[__n];
+ size_t bin = _S_binmap[__n * sizeof(_Tp)];
#ifdef __GTHREADS
size_t thread_id = _S_get_thread_id();
#ifdef __GTHREADS
size_t thread_id = _S_get_thread_id();
* Requests larger than _S_max_bytes are handled by
* malloc/free directly
*/
* Requests larger than _S_max_bytes are handled by
* malloc/free directly
*/
- if (__n > _S_max_bytes)
+ if (__n * sizeof(_Tp) > _S_max_bytes)
/*
* Round up to power of 2 and figure out which bin to use
*/
/*
* Round up to power of 2 and figure out which bin to use
*/
- size_t bin = _S_binmap[__n];
+ size_t bin = _S_binmap[__n * sizeof(_Tp)];
#ifdef __GTHREADS
size_t thread_id = _S_get_thread_id();
#ifdef __GTHREADS
size_t thread_id = _S_get_thread_id();
/*
* Initialize per thread key to hold pointer to
/*
* Initialize per thread key to hold pointer to
- * _S_thread_freelist NOTE! Here's an ugly workaround - if
- * _S_thread_key_destr is not explicitly called at least
- * once it won't be linked into the application. This is the
- * behavior of template methods and __gthread_key_create()
- * takes only a pointer to the function and does not cause
- * the compiler to create an instance.
- _S_thread_key_destr(NULL);
__gthread_key_create(&_S_thread_key, _S_thread_key_destr);
}
#endif
__gthread_key_create(&_S_thread_key, _S_thread_key_destr);
}
#endif
if (!_S_bin[bin].free)
__throw_bad_alloc();
if (!_S_bin[bin].free)
__throw_bad_alloc();
_S_bin[bin].used = (size_t*) malloc(sizeof(size_t) * __n);
if (!_S_bin[bin].used)
_S_bin[bin].used = (size_t*) malloc(sizeof(size_t) * __n);
if (!_S_bin[bin].used)
calibrate_iterations<vector<test_type> >();
test_container(vector<test_type>());
test_container(vector<test_type, malloc_allocator<test_type> >());
calibrate_iterations<vector<test_type> >();
test_container(vector<test_type>());
test_container(vector<test_type, malloc_allocator<test_type> >());
- //test_container(vector<test_type, __mt_alloc<test_type> >());
+ test_container(vector<test_type, __mt_alloc<test_type> >());
calibrate_iterations<list<test_type> >();
test_container(list<test_type>());
test_container(list<test_type, malloc_allocator<test_type> >());
calibrate_iterations<list<test_type> >();
test_container(list<test_type>());
test_container(list<test_type, malloc_allocator<test_type> >());
- //test_container(list<test_type, __mt_alloc<test_type> >());
+ test_container(list<test_type, __mt_alloc<test_type> >());
calibrate_iterations<vector<test_type> >();
test_container(vector<test_type>());
test_container(vector<test_type, malloc_allocator<test_type> >());
calibrate_iterations<vector<test_type> >();
test_container(vector<test_type>());
test_container(vector<test_type, malloc_allocator<test_type> >());
- //test_container(vector<test_type, __mt_alloc<test_type> >());
+ test_container(vector<test_type, __mt_alloc<test_type> >());
calibrate_iterations<list<test_type> >();
test_container(list<test_type>());
test_container(list<test_type, malloc_allocator<test_type> >());
calibrate_iterations<list<test_type> >();
test_container(list<test_type>());
test_container(list<test_type, malloc_allocator<test_type> >());
- //test_container(list<test_type, __mt_alloc<test_type> >());
+ test_container(list<test_type, __mt_alloc<test_type> >());