Commit a8155711 by Dhruv Matani Committed by Paolo Carlini

bitmap_allocator.h: Change unsigned int -> size_t...

2004-10-17  Dhruv Matani  <dhruvbird@gmx.net>
	    Paolo Carlini  <pcarlini@suse.de>

	* include/ext/bitmap_allocator.h: Change unsigned int -> size_t: this
	makes the code 64-bit correct and also fixes (together with using at
	the beginning a bitmap 2 * size_t bytes wide) alignment issues: now
	8 is guaranteed, easily tunable to 16 via _BALLOC_ALIGN_BYTES.
	Fix pthread-rope7.cc fail by nulling out __mini_vector<> destructor.
	* src/bitmap_allocator.cc: Change to size_t.
	* config/linker-map.gnu: Adjust.

Co-Authored-By: Paolo Carlini <pcarlini@suse.de>

From-SVN: r89170
parent 05dfb0b0
2004-10-17 Dhruv Matani <dhruvbird@gmx.net>
Paolo Carlini <pcarlini@suse.de>
* include/ext/bitmap_allocator.h: Change unsigned int -> size_t: this
makes the code 64-bit correct and also fixes (together with using at
the beginning a bitmap 2 * size_t bytes wide) alignment issues: now
8 is guaranteed, easily tunable to 16 via _BALLOC_ALIGN_BYTES.
Fix pthread-rope7.cc fail by nulling out __mini_vector<> destructor.
* src/bitmap_allocator.cc: Change to size_t.
* config/linker-map.gnu: Adjust.
2004-10-16 Benjamin Kosnik <bkoz@redhat.com> 2004-10-16 Benjamin Kosnik <bkoz@redhat.com>
* include/tr1/array: Don't use layout_type. * include/tr1/array: Don't use layout_type.
......
...@@ -273,7 +273,7 @@ GLIBCXX_3.4.3 { ...@@ -273,7 +273,7 @@ GLIBCXX_3.4.3 {
_ZN9__gnu_cxx9free_list12_S_free_listE; _ZN9__gnu_cxx9free_list12_S_free_listE;
_ZN9__gnu_cxx9free_list12_S_bfl_mutexE; _ZN9__gnu_cxx9free_list12_S_bfl_mutexE;
_ZN9__gnu_cxx9free_list6_M_getEj; _ZN9__gnu_cxx9free_list6_M_getE*;
_ZN9__gnu_cxx9free_list8_M_clearEv; _ZN9__gnu_cxx9free_list8_M_clearEv;
# stub functions from libmath # stub functions from libmath
......
...@@ -41,11 +41,11 @@ namespace __gnu_cxx ...@@ -41,11 +41,11 @@ namespace __gnu_cxx
<bitmap_allocator<wchar_t>::_Alloc_block*, <bitmap_allocator<wchar_t>::_Alloc_block*,
bitmap_allocator<wchar_t>::_Alloc_block*> >; bitmap_allocator<wchar_t>::_Alloc_block*> >;
template class __mini_vector<unsigned int*>; template class __mini_vector<size_t*>;
template unsigned int** __lower_bound template size_t** __lower_bound
(unsigned int**, unsigned int**, (size_t**, size_t**,
unsigned int const&, free_list::_LT_pointer_compare); size_t const&, free_list::_LT_pointer_compare);
} }
#if defined __GTHREADS #if defined __GTHREADS
...@@ -53,9 +53,9 @@ namespace __gnu_cxx ...@@ -53,9 +53,9 @@ namespace __gnu_cxx
#endif #endif
free_list::vector_type free_list::_S_free_list; free_list::vector_type free_list::_S_free_list;
unsigned int* size_t*
free_list:: free_list::
_M_get(unsigned int __sz) throw(std::bad_alloc) _M_get(size_t __sz) throw(std::bad_alloc)
{ {
#if defined __GTHREADS #if defined __GTHREADS
_Lock __bfl_lock(&_S_bfl_mutex); _Lock __bfl_lock(&_S_bfl_mutex);
...@@ -77,15 +77,15 @@ namespace __gnu_cxx ...@@ -77,15 +77,15 @@ namespace __gnu_cxx
// Try twice to get the memory: once directly, and the 2nd // Try twice to get the memory: once directly, and the 2nd
// time after clearing the free list. If both fail, then // time after clearing the free list. If both fail, then
// throw std::bad_alloc(). // throw std::bad_alloc().
unsigned int __ctr = 2; int __ctr = 2;
while (__ctr) while (__ctr)
{ {
unsigned int* __ret = 0; size_t* __ret = 0;
--__ctr; --__ctr;
try try
{ {
__ret = reinterpret_cast<unsigned int*> __ret = reinterpret_cast<size_t*>
(::operator new(__sz + sizeof(unsigned int))); (::operator new(__sz + sizeof(size_t)));
} }
catch(...) catch(...)
{ {
...@@ -94,20 +94,18 @@ namespace __gnu_cxx ...@@ -94,20 +94,18 @@ namespace __gnu_cxx
if (!__ret) if (!__ret)
continue; continue;
*__ret = __sz; *__ret = __sz;
return reinterpret_cast<unsigned int*> return __ret + 1;
(reinterpret_cast<char*>(__ret) + sizeof(unsigned int));
} }
throw std::bad_alloc(); throw std::bad_alloc();
} }
else else
{ {
unsigned int* __ret = *__temp; size_t* __ret = *__temp;
_S_free_list.erase(__temp); _S_free_list.erase(__temp);
#if defined __GTHREADS #if defined __GTHREADS
__bfl_lock._M_unlock(); __bfl_lock._M_unlock();
#endif #endif
return reinterpret_cast<unsigned int*> return __ret + 1;
(reinterpret_cast<char*>(__ret) + sizeof(unsigned int));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment