summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-14 18:54:18 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-14 18:54:18 +0000
commite078ec05a608fc762b03cca5e17cec0a0528a567 (patch)
treed605563213405a7b3a66f17a14da56001a9fdd25
parentb78739b62184439d3e08fc414cadc06b6207add1 (diff)
downloadppe42-gcc-e078ec05a608fc762b03cca5e17cec0a0528a567.tar.gz
ppe42-gcc-e078ec05a608fc762b03cca5e17cec0a0528a567.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75875 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h17
-rw-r--r--libstdc++-v3/testsuite/performance/allocator.cc4
-rw-r--r--libstdc++-v3/testsuite/performance/allocator_thread.cc4
4 files changed, 15 insertions, 16 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index fab586eb6bd..2afafcaf9db 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index ec77192db26..5b69e6375ae 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -232,7 +232,7 @@ namespace __gnu_cxx
* 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)
@@ -263,7 +263,7 @@ namespace __gnu_cxx
/*
* 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();
@@ -408,7 +408,7 @@ namespace __gnu_cxx
* Requests larger than _S_max_bytes are handled by
* malloc/free directly
*/
- if (__n > _S_max_bytes)
+ if (__n * sizeof(_Tp) > _S_max_bytes)
{
free(__p);
return;
@@ -417,7 +417,7 @@ namespace __gnu_cxx
/*
* 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();
@@ -607,14 +607,8 @@ namespace __gnu_cxx
/*
* 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_freelist
*/
- _S_thread_key_destr(NULL);
__gthread_key_create(&_S_thread_key, _S_thread_key_destr);
}
#endif
@@ -647,7 +641,6 @@ namespace __gnu_cxx
if (!_S_bin[bin].free)
__throw_bad_alloc();
-
_S_bin[bin].used = (size_t*) malloc(sizeof(size_t) * __n);
if (!_S_bin[bin].used)
diff --git a/libstdc++-v3/testsuite/performance/allocator.cc b/libstdc++-v3/testsuite/performance/allocator.cc
index 88314a13bef..c7299fc5508 100644
--- a/libstdc++-v3/testsuite/performance/allocator.cc
+++ b/libstdc++-v3/testsuite/performance/allocator.cc
@@ -133,12 +133,12 @@ int main(void)
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> >());
- //test_container(list<test_type, __mt_alloc<test_type> >());
+ test_container(list<test_type, __mt_alloc<test_type> >());
return 0;
}
diff --git a/libstdc++-v3/testsuite/performance/allocator_thread.cc b/libstdc++-v3/testsuite/performance/allocator_thread.cc
index 98cf2b14291..68da4d7bcc2 100644
--- a/libstdc++-v3/testsuite/performance/allocator_thread.cc
+++ b/libstdc++-v3/testsuite/performance/allocator_thread.cc
@@ -147,12 +147,12 @@ int main(void)
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> >());
- //test_container(list<test_type, __mt_alloc<test_type> >());
+ test_container(list<test_type, __mt_alloc<test_type> >());
return 0;
}
OpenPOWER on IntegriCloud