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>
* include/tr1/array: Don't use layout_type.
......
......@@ -273,7 +273,7 @@ GLIBCXX_3.4.3 {
_ZN9__gnu_cxx9free_list12_S_free_listE;
_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;
# stub functions from libmath
......
......@@ -41,11 +41,11 @@ namespace __gnu_cxx
<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
(unsigned int**, unsigned int**,
unsigned int const&, free_list::_LT_pointer_compare);
template size_t** __lower_bound
(size_t**, size_t**,
size_t const&, free_list::_LT_pointer_compare);
}
#if defined __GTHREADS
......@@ -53,9 +53,9 @@ namespace __gnu_cxx
#endif
free_list::vector_type free_list::_S_free_list;
unsigned int*
size_t*
free_list::
_M_get(unsigned int __sz) throw(std::bad_alloc)
_M_get(size_t __sz) throw(std::bad_alloc)
{
#if defined __GTHREADS
_Lock __bfl_lock(&_S_bfl_mutex);
......@@ -77,15 +77,15 @@ namespace __gnu_cxx
// Try twice to get the memory: once directly, and the 2nd
// time after clearing the free list. If both fail, then
// throw std::bad_alloc().
unsigned int __ctr = 2;
int __ctr = 2;
while (__ctr)
{
unsigned int* __ret = 0;
size_t* __ret = 0;
--__ctr;
try
{
__ret = reinterpret_cast<unsigned int*>
(::operator new(__sz + sizeof(unsigned int)));
__ret = reinterpret_cast<size_t*>
(::operator new(__sz + sizeof(size_t)));
}
catch(...)
{
......@@ -94,20 +94,18 @@ namespace __gnu_cxx
if (!__ret)
continue;
*__ret = __sz;
return reinterpret_cast<unsigned int*>
(reinterpret_cast<char*>(__ret) + sizeof(unsigned int));
return __ret + 1;
}
throw std::bad_alloc();
}
else
{
unsigned int* __ret = *__temp;
size_t* __ret = *__temp;
_S_free_list.erase(__temp);
#if defined __GTHREADS
__bfl_lock._M_unlock();
#endif
return reinterpret_cast<unsigned int*>
(reinterpret_cast<char*>(__ret) + sizeof(unsigned int));
return __ret + 1;
}
}
......
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